@realsee/five 6.8.0-alpha.17 → 6.8.0-alpha.19
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/docs/documents/api.html +15 -15
- package/docs/documents/features_flowing-light-2d-pass.html +6 -6
- package/docs/documents/features_flowing-light-3d-pass.html +6 -6
- package/docs/documents/features_gaussian-blur-pass.html +5 -5
- package/five/index.js +144 -665
- package/five/index.mjs +26204 -32253
- package/five/thirdparty/hammer.d.ts +371 -255
- package/five/thirdparty/jsrsasign.d.ts +5 -20
- package/gltf-loader/index.js +9 -9
- package/gltf-loader/index.mjs +1351 -1451
- package/line/index.js +4 -4
- package/line/index.mjs +334 -513
- package/package.json +2 -2
- package/plugins/index.js +17 -21
- package/plugins/index.mjs +3342 -4245
- package/react/index.js +3 -3
- package/react/index.mjs +572 -783
- package/shader-lib/index.js +13 -14
- package/shader-lib/index.mjs +424 -824
- package/sticker/index.js +3 -3
- package/sticker/index.mjs +102 -142
- package/umd/five-gltf-loader.js +9 -9
- package/umd/five-line.js +4 -4
- package/umd/five-plugins.js +17 -21
- package/umd/five-react.js +3 -3
- package/umd/five-shader-lib.js +13 -14
- package/umd/five-sticker.js +3 -3
- package/umd/five-vfx.js +21 -21
- package/umd/five-vue.js +3 -3
- package/umd/five.js +139 -660
- package/vfx/index.js +21 -21
- package/vfx/index.mjs +454 -910
- package/vue/index.js +3 -3
- package/vue/index.mjs +309 -301
- package/work-downloader/index.js +3 -3
- package/work-downloader/index.mjs +317 -556
- /package/five/assets/{realsee-pmg-data-url.d.ts → realsee-png-data-url.d.ts} +0 -0
package/vfx/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five
|
|
4
|
-
* Generated: 3/
|
|
5
|
-
* Version: 6.8.0-alpha.
|
|
4
|
+
* Generated: 3/18/2026
|
|
5
|
+
* Version: 6.8.0-alpha.19
|
|
6
6
|
* Terms:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
* Update: July 28, 2021
|
|
@@ -252,152 +252,9 @@
|
|
|
252
252
|
* No amendment to or modification of this Agreement will be binding unless in
|
|
253
253
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
254
254
|
* Agreement and all related documents shall be drafted in English.
|
|
255
|
-
*/import * as
|
|
256
|
-
|
|
257
|
-
return
|
|
258
|
-
e.__proto__ = t;
|
|
259
|
-
} || function(e, t) {
|
|
260
|
-
for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]);
|
|
261
|
-
}, ae(o, i);
|
|
262
|
-
};
|
|
263
|
-
function Y(o, i) {
|
|
264
|
-
if (typeof i != "function" && i !== null)
|
|
265
|
-
throw new TypeError("Class extends value " + String(i) + " is not a constructor or null");
|
|
266
|
-
ae(o, i);
|
|
267
|
-
function e() {
|
|
268
|
-
this.constructor = o;
|
|
269
|
-
}
|
|
270
|
-
o.prototype = i === null ? Object.create(i) : (e.prototype = i.prototype, new e());
|
|
271
|
-
}
|
|
272
|
-
var be = `
|
|
273
|
-
uniform vec3 uColor1;
|
|
274
|
-
uniform vec3 uColor2;
|
|
275
|
-
uniform float uOpacity;
|
|
276
|
-
|
|
277
|
-
varying vec3 vPosition;
|
|
278
|
-
varying float vNoise;
|
|
279
|
-
|
|
280
|
-
void main() {
|
|
281
|
-
float alpha = 1.0;
|
|
282
|
-
float gradient = mix(0.0, 1.0, -vPosition.y + 1.75);
|
|
283
|
-
if(vNoise > 0.3 * gradient) {
|
|
284
|
-
alpha = 0.0;
|
|
285
|
-
}
|
|
286
|
-
float mask = mix(0.3, 1.0, -vPosition.y + 0.5);
|
|
287
|
-
alpha = clamp(alpha * (mask * 10.0), 0.0, 1.0);
|
|
288
|
-
vec3 color = mix(uColor1, uColor2, -vPosition.y + 0.5);
|
|
289
|
-
color.g = color.g * (1.0 + gradient * vNoise);
|
|
290
|
-
gl_FragColor = vec4(color, alpha * uOpacity);
|
|
291
|
-
}
|
|
292
|
-
`, le = `
|
|
293
|
-
// Simplex 4D Noise
|
|
294
|
-
// by Ian McEwan, Ashima Arts
|
|
295
|
-
//
|
|
296
|
-
vec4 permute(vec4 x) {
|
|
297
|
-
return mod((x * 34.0 + 1.0) * x, 289.0);
|
|
298
|
-
}
|
|
299
|
-
float permute(float x) {
|
|
300
|
-
return floor( mod((x * 34.0 + 1.0) * x, 289.0) );
|
|
301
|
-
}
|
|
302
|
-
vec4 taylorInvSqrt(vec4 r) {
|
|
303
|
-
return 1.79284291400159 - 0.85373472095314 * r;
|
|
304
|
-
}
|
|
305
|
-
float taylorInvSqrt(float r) {
|
|
306
|
-
return 1.79284291400159 - 0.85373472095314 * r;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
vec4 grad4(float j, vec4 ip) {
|
|
310
|
-
const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);
|
|
311
|
-
vec4 p,s;
|
|
312
|
-
|
|
313
|
-
p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;
|
|
314
|
-
p.w = 1.5 - dot(abs(p.xyz), ones.xyz);
|
|
315
|
-
s = vec4(lessThan(p, vec4(0.0)));
|
|
316
|
-
p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;
|
|
317
|
-
|
|
318
|
-
return p;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
float simplexNoise(vec4 v) {
|
|
322
|
-
const vec2 C = vec2( 0.138196601125010504, // (5 - sqrt(5))/20 G4
|
|
323
|
-
0.309016994374947451); // (sqrt(5) - 1)/4 F4
|
|
324
|
-
// First corner
|
|
325
|
-
vec4 i = floor(v + dot(v, C.yyyy) );
|
|
326
|
-
vec4 x0 = v - i + dot(i, C.xxxx);
|
|
327
|
-
|
|
328
|
-
// Other corners
|
|
329
|
-
|
|
330
|
-
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
|
|
331
|
-
vec4 i0;
|
|
332
|
-
|
|
333
|
-
vec3 isX = step( x0.yzw, x0.xxx );
|
|
334
|
-
vec3 isYZ = step( x0.zww, x0.yyz );
|
|
335
|
-
|
|
336
|
-
// i0.x = dot( isX, vec3( 1.0 ) );
|
|
337
|
-
i0.x = isX.x + isX.y + isX.z;
|
|
338
|
-
i0.yzw = 1.0 - isX;
|
|
339
|
-
|
|
340
|
-
// i0.y += dot( isYZ.xy, vec2( 1.0 ) );
|
|
341
|
-
i0.y += isYZ.x + isYZ.y;
|
|
342
|
-
i0.zw += 1.0 - isYZ.xy;
|
|
343
|
-
|
|
344
|
-
i0.z += isYZ.z;
|
|
345
|
-
i0.w += 1.0 - isYZ.z;
|
|
346
|
-
|
|
347
|
-
// i0 now contains the unique values 0,1,2,3 in each channel
|
|
348
|
-
vec4 i3 = clamp( i0, 0.0, 1.0 );
|
|
349
|
-
vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );
|
|
350
|
-
vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );
|
|
351
|
-
|
|
352
|
-
// x0 = x0 - 0.0 + 0.0 * C
|
|
353
|
-
vec4 x1 = x0 - i1 + 1.0 * C.xxxx;
|
|
354
|
-
vec4 x2 = x0 - i2 + 2.0 * C.xxxx;
|
|
355
|
-
vec4 x3 = x0 - i3 + 3.0 * C.xxxx;
|
|
356
|
-
vec4 x4 = x0 - 1.0 + 4.0 * C.xxxx;
|
|
357
|
-
|
|
358
|
-
// Permutations
|
|
359
|
-
i = mod(i, 289.0);
|
|
360
|
-
float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);
|
|
361
|
-
vec4 j1 = permute( permute( permute( permute (
|
|
362
|
-
i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))
|
|
363
|
-
+ i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))
|
|
364
|
-
+ i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))
|
|
365
|
-
+ i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));
|
|
366
|
-
|
|
367
|
-
// Gradients
|
|
368
|
-
// ( 7*7*6 points uniformly over a cube, mapped onto a 4-octahedron.)
|
|
369
|
-
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
|
|
370
|
-
|
|
371
|
-
vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;
|
|
372
|
-
|
|
373
|
-
vec4 p0 = grad4(j0, ip);
|
|
374
|
-
vec4 p1 = grad4(j1.x, ip);
|
|
375
|
-
vec4 p2 = grad4(j1.y, ip);
|
|
376
|
-
vec4 p3 = grad4(j1.z, ip);
|
|
377
|
-
vec4 p4 = grad4(j1.w, ip);
|
|
378
|
-
|
|
379
|
-
// Normalise gradients
|
|
380
|
-
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
|
|
381
|
-
p0 *= norm.x;
|
|
382
|
-
p1 *= norm.y;
|
|
383
|
-
p2 *= norm.z;
|
|
384
|
-
p3 *= norm.w;
|
|
385
|
-
p4 *= taylorInvSqrt(dot(p4,p4));
|
|
386
|
-
|
|
387
|
-
// Mix contributions from the five corners
|
|
388
|
-
vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);
|
|
389
|
-
vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);
|
|
390
|
-
m0 = m0 * m0;
|
|
391
|
-
m1 = m1 * m1;
|
|
392
|
-
return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))
|
|
393
|
-
+ dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;
|
|
394
|
-
|
|
395
|
-
}
|
|
396
|
-
`, se = `
|
|
397
|
-
float scale(float value, float fromMin, float fromMax, float toMin, float toMax) {
|
|
398
|
-
return toMin + (value - fromMin) * (toMax - toMin) / (fromMax - fromMin);
|
|
399
|
-
}
|
|
400
|
-
`, Ae = `
|
|
255
|
+
*/import * as e from "three";
|
|
256
|
+
//#region build/vfx/frame/fragment-shader.js
|
|
257
|
+
var t = "\nuniform vec3 uColor1;\nuniform vec3 uColor2;\nuniform float uOpacity;\n\nvarying vec3 vPosition;\nvarying float vNoise;\n\nvoid main() {\n float alpha = 1.0;\n float gradient = mix(0.0, 1.0, -vPosition.y + 1.75);\n if(vNoise > 0.3 * gradient) {\n alpha = 0.0;\n }\n float mask = mix(0.3, 1.0, -vPosition.y + 0.5);\n alpha = clamp(alpha * (mask * 10.0), 0.0, 1.0);\n vec3 color = mix(uColor1, uColor2, -vPosition.y + 0.5);\n color.g = color.g * (1.0 + gradient * vNoise);\n gl_FragColor = vec4(color, alpha * uOpacity);\n}\n", n = "\n// Simplex 4D Noise\n// by Ian McEwan, Ashima Arts\n//\nvec4 permute(vec4 x) {\n return mod((x * 34.0 + 1.0) * x, 289.0);\n}\nfloat permute(float x) {\n return floor( mod((x * 34.0 + 1.0) * x, 289.0) );\n}\nvec4 taylorInvSqrt(vec4 r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\nfloat taylorInvSqrt(float r) {\n return 1.79284291400159 - 0.85373472095314 * r;\n}\n\nvec4 grad4(float j, vec4 ip) {\n const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\n vec4 p,s;\n\n p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\n p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\n s = vec4(lessThan(p, vec4(0.0)));\n p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n return p;\n}\n\nfloat simplexNoise(vec4 v) {\n const vec2 C = vec2( 0.138196601125010504, // (5 - sqrt(5))/20 G4\n 0.309016994374947451); // (sqrt(5) - 1)/4 F4\n // First corner\n vec4 i = floor(v + dot(v, C.yyyy) );\n vec4 x0 = v - i + dot(i, C.xxxx);\n\n // Other corners\n\n // Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)\n vec4 i0;\n\n vec3 isX = step( x0.yzw, x0.xxx );\n vec3 isYZ = step( x0.zww, x0.yyz );\n\n // i0.x = dot( isX, vec3( 1.0 ) );\n i0.x = isX.x + isX.y + isX.z;\n i0.yzw = 1.0 - isX;\n\n // i0.y += dot( isYZ.xy, vec2( 1.0 ) );\n i0.y += isYZ.x + isYZ.y;\n i0.zw += 1.0 - isYZ.xy;\n\n i0.z += isYZ.z;\n i0.w += 1.0 - isYZ.z;\n\n // i0 now contains the unique values 0,1,2,3 in each channel\n vec4 i3 = clamp( i0, 0.0, 1.0 );\n vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );\n vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );\n\n // x0 = x0 - 0.0 + 0.0 * C\n vec4 x1 = x0 - i1 + 1.0 * C.xxxx;\n vec4 x2 = x0 - i2 + 2.0 * C.xxxx;\n vec4 x3 = x0 - i3 + 3.0 * C.xxxx;\n vec4 x4 = x0 - 1.0 + 4.0 * C.xxxx;\n\n // Permutations\n i = mod(i, 289.0);\n float j0 = permute( permute( permute( permute(i.w) + i.z) + i.y) + i.x);\n vec4 j1 = permute( permute( permute( permute (\n i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))\n + i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))\n + i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))\n + i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));\n\n // Gradients\n // ( 7*7*6 points uniformly over a cube, mapped onto a 4-octahedron.)\n // 7*7*6 = 294, which is close to the ring size 17*17 = 289.\n\n vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n vec4 p0 = grad4(j0, ip);\n vec4 p1 = grad4(j1.x, ip);\n vec4 p2 = grad4(j1.y, ip);\n vec4 p3 = grad4(j1.z, ip);\n vec4 p4 = grad4(j1.w, ip);\n\n // Normalise gradients\n vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\n p0 *= norm.x;\n p1 *= norm.y;\n p2 *= norm.z;\n p3 *= norm.w;\n p4 *= taylorInvSqrt(dot(p4,p4));\n\n // Mix contributions from the five corners\n vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\n vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4) ), 0.0);\n m0 = m0 * m0;\n m1 = m1 * m1;\n return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))\n + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;\n\n}\n", r = "\nfloat scale(float value, float fromMin, float fromMax, float toMin, float toMax) {\n return toMin + (value - fromMin) * (toMax - toMin) / (fromMax - fromMin);\n}\n", i = `
|
|
401
258
|
uniform float uTime;
|
|
402
259
|
uniform float uNoise;
|
|
403
260
|
uniform float uSpeed;
|
|
@@ -405,8 +262,8 @@ uniform float uSpeed;
|
|
|
405
262
|
varying vec3 vPosition;
|
|
406
263
|
varying float vNoise;
|
|
407
264
|
|
|
408
|
-
|
|
409
|
-
|
|
265
|
+
${n}
|
|
266
|
+
${r}
|
|
410
267
|
|
|
411
268
|
float fbm(vec4 x) {
|
|
412
269
|
float v = 0.0;
|
|
@@ -429,151 +286,90 @@ void main() {
|
|
|
429
286
|
|
|
430
287
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(vPosition, 1.0);
|
|
431
288
|
}
|
|
432
|
-
|
|
433
|
-
for (
|
|
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
|
-
}), Object.defineProperty(i.prototype, "speed", {
|
|
517
|
-
get: function() {
|
|
518
|
-
return this.uniforms.uSpeed.value;
|
|
519
|
-
},
|
|
520
|
-
set: function(e) {
|
|
521
|
-
this.uniforms.uSpeed.value = e;
|
|
522
|
-
},
|
|
523
|
-
enumerable: !1,
|
|
524
|
-
configurable: !0
|
|
525
|
-
}), Object.defineProperty(i.prototype, "noise", {
|
|
526
|
-
get: function() {
|
|
527
|
-
return this.uniforms.uSpeed.value;
|
|
528
|
-
},
|
|
529
|
-
set: function(e) {
|
|
530
|
-
this.uniforms.uSpeed.value = e, this.needsRender = !0;
|
|
531
|
-
},
|
|
532
|
-
enumerable: !1,
|
|
533
|
-
configurable: !0
|
|
534
|
-
}), Object.defineProperty(i.prototype, "opacity", {
|
|
535
|
-
get: function() {
|
|
536
|
-
return this.uniforms.opacity.value;
|
|
537
|
-
},
|
|
538
|
-
set: function(e) {
|
|
539
|
-
this.uniforms.uOpacity.value = e, this.needsRender = !0;
|
|
540
|
-
},
|
|
541
|
-
enumerable: !1,
|
|
542
|
-
configurable: !0
|
|
543
|
-
}), Object.defineProperty(i.prototype, "fragmentationDegree", {
|
|
544
|
-
get: function() {
|
|
545
|
-
return this.defines.FRAGMENTATION_DEGREE;
|
|
546
|
-
},
|
|
547
|
-
set: function(e) {
|
|
548
|
-
this.defines.FRAGMENTATION_DEGREE = e, this.traverse(function(t) {
|
|
549
|
-
t instanceof n.Mesh && t.material instanceof n.ShaderMaterial && (t.material.needsUpdate = !0);
|
|
550
|
-
}), this.needsRender = !0;
|
|
551
|
-
},
|
|
552
|
-
enumerable: !1,
|
|
553
|
-
configurable: !0
|
|
554
|
-
}), i;
|
|
555
|
-
})(n.Group)
|
|
556
|
-
), Me = `
|
|
557
|
-
uniform vec3 uLightColor;
|
|
558
|
-
uniform vec3 uSpotPosition;
|
|
559
|
-
uniform float uAttenuation;
|
|
560
|
-
uniform float uAnglePower;
|
|
561
|
-
|
|
562
|
-
varying vec3 vNormal;
|
|
563
|
-
varying vec3 vWorldPosition;
|
|
564
|
-
varying float vNoise;
|
|
565
|
-
|
|
566
|
-
void main() {
|
|
567
|
-
float intensity;
|
|
568
|
-
intensity = distance(vWorldPosition, uSpotPosition) / uAttenuation;
|
|
569
|
-
intensity = 1.0 - clamp(intensity, 0.1, 1.0);
|
|
570
|
-
|
|
571
|
-
vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));
|
|
572
|
-
float angleIntensity = pow( dot(normal, vec3(0.0, 0.0, 1.0)), uAnglePower * vNoise );
|
|
573
|
-
intensity = intensity * angleIntensity * vNoise;
|
|
574
|
-
gl_FragColor = vec4( uLightColor, intensity );
|
|
575
|
-
}
|
|
576
|
-
`, ze = `
|
|
289
|
+
`, a = new e.SphereBufferGeometry(1, 300, 300), o = [];
|
|
290
|
+
for (let t = 0; t < 2; t++) o.push(new e.Vector2(Math.sin(t) / 2 + 1, t * 2 - .8));
|
|
291
|
+
var s = new e.LatheBufferGeometry(o, 300), c = class extends e.Group {
|
|
292
|
+
constructor(n) {
|
|
293
|
+
super(), this.needsRender = !0;
|
|
294
|
+
let r;
|
|
295
|
+
if (n instanceof e.BufferGeometry) r = n;
|
|
296
|
+
else switch (n) {
|
|
297
|
+
case "ring":
|
|
298
|
+
r = s;
|
|
299
|
+
break;
|
|
300
|
+
default:
|
|
301
|
+
r = a;
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
this.uniforms = {
|
|
305
|
+
uTime: { value: 0 },
|
|
306
|
+
uColor1: { value: new e.Color("rgb(255, 177, 20)") },
|
|
307
|
+
uColor2: { value: new e.Color("rgb(255, 0, 0)") },
|
|
308
|
+
uNoise: { value: 1.2 },
|
|
309
|
+
uSpeed: { value: 1 },
|
|
310
|
+
uOpacity: { value: 1 }
|
|
311
|
+
}, this.defines = { FRAGMENTATION_DEGREE: 2 };
|
|
312
|
+
let o = new e.Mesh(r, new e.ShaderMaterial({
|
|
313
|
+
uniforms: this.uniforms,
|
|
314
|
+
defines: this.defines,
|
|
315
|
+
vertexShader: i,
|
|
316
|
+
fragmentShader: t,
|
|
317
|
+
transparent: !0,
|
|
318
|
+
depthWrite: !1,
|
|
319
|
+
side: e.BackSide
|
|
320
|
+
})), c = new e.Mesh(r, new e.ShaderMaterial({
|
|
321
|
+
uniforms: this.uniforms,
|
|
322
|
+
defines: this.defines,
|
|
323
|
+
vertexShader: i,
|
|
324
|
+
fragmentShader: t,
|
|
325
|
+
transparent: !0,
|
|
326
|
+
depthWrite: !1,
|
|
327
|
+
side: e.FrontSide
|
|
328
|
+
}));
|
|
329
|
+
o.scale.setScalar(.1), c.scale.setScalar(.1), this.add(o), this.add(c);
|
|
330
|
+
}
|
|
331
|
+
setTime(e) {
|
|
332
|
+
this.startTime === void 0 && (this.startTime = e), this.uniforms.uTime.value = (e - this.startTime) / 1e3, this.needsRender = !0;
|
|
333
|
+
}
|
|
334
|
+
set color1(e) {
|
|
335
|
+
this.uniforms.uColor1.value = e, this.needsRender = !0;
|
|
336
|
+
}
|
|
337
|
+
get color1() {
|
|
338
|
+
return this.uniforms.uColor1.value;
|
|
339
|
+
}
|
|
340
|
+
set color2(e) {
|
|
341
|
+
this.uniforms.uColor2.value = e, this.needsRender = !0;
|
|
342
|
+
}
|
|
343
|
+
get color2() {
|
|
344
|
+
return this.uniforms.uColor2.value;
|
|
345
|
+
}
|
|
346
|
+
set speed(e) {
|
|
347
|
+
this.uniforms.uSpeed.value = e;
|
|
348
|
+
}
|
|
349
|
+
get speed() {
|
|
350
|
+
return this.uniforms.uSpeed.value;
|
|
351
|
+
}
|
|
352
|
+
set noise(e) {
|
|
353
|
+
this.uniforms.uSpeed.value = e, this.needsRender = !0;
|
|
354
|
+
}
|
|
355
|
+
get noise() {
|
|
356
|
+
return this.uniforms.uSpeed.value;
|
|
357
|
+
}
|
|
358
|
+
set opacity(e) {
|
|
359
|
+
this.uniforms.uOpacity.value = e, this.needsRender = !0;
|
|
360
|
+
}
|
|
361
|
+
get opacity() {
|
|
362
|
+
return this.uniforms.opacity.value;
|
|
363
|
+
}
|
|
364
|
+
set fragmentationDegree(t) {
|
|
365
|
+
this.defines.FRAGMENTATION_DEGREE = t, this.traverse((t) => {
|
|
366
|
+
t instanceof e.Mesh && t.material instanceof e.ShaderMaterial && (t.material.needsUpdate = !0);
|
|
367
|
+
}), this.needsRender = !0;
|
|
368
|
+
}
|
|
369
|
+
get fragmentationDegree() {
|
|
370
|
+
return this.defines.FRAGMENTATION_DEGREE;
|
|
371
|
+
}
|
|
372
|
+
}, l = "\nuniform vec3 uLightColor;\nuniform vec3 uSpotPosition;\nuniform float uAttenuation;\nuniform float uAnglePower;\n\nvarying vec3 vNormal;\nvarying vec3 vWorldPosition;\nvarying float vNoise;\n\nvoid main() {\n float intensity;\n intensity = distance(vWorldPosition, uSpotPosition) / uAttenuation;\n intensity = 1.0 - clamp(intensity, 0.1, 1.0);\n\n vec3 normal = vec3(vNormal.x, vNormal.y, abs(vNormal.z));\n float angleIntensity = pow( dot(normal, vec3(0.0, 0.0, 1.0)), uAnglePower * vNoise );\n intensity = intensity * angleIntensity * vNoise;\n gl_FragColor = vec4( uLightColor, intensity );\n}\n", u = `
|
|
577
373
|
|
|
578
374
|
uniform float uTime;
|
|
579
375
|
|
|
@@ -581,8 +377,8 @@ varying vec3 vNormal;
|
|
|
581
377
|
varying vec3 vWorldPosition;
|
|
582
378
|
varying float vNoise;
|
|
583
379
|
|
|
584
|
-
|
|
585
|
-
|
|
380
|
+
${n}
|
|
381
|
+
${r}
|
|
586
382
|
|
|
587
383
|
void main(){
|
|
588
384
|
|
|
@@ -594,84 +390,49 @@ void main(){
|
|
|
594
390
|
|
|
595
391
|
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
|
|
596
392
|
}
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
this.uniforms.uAttenuation.value = e, this.needsRender = !0;
|
|
641
|
-
},
|
|
642
|
-
enumerable: !1,
|
|
643
|
-
configurable: !0
|
|
644
|
-
}), Object.defineProperty(i.prototype, "anglePower", {
|
|
645
|
-
get: function() {
|
|
646
|
-
return this.uniforms.uAnglePower.value;
|
|
647
|
-
},
|
|
648
|
-
set: function(e) {
|
|
649
|
-
this.uniforms.uAnglePower.value = e, this.needsRender = !0;
|
|
650
|
-
},
|
|
651
|
-
enumerable: !1,
|
|
652
|
-
configurable: !0
|
|
653
|
-
}), Object.defineProperty(i.prototype, "color", {
|
|
654
|
-
get: function() {
|
|
655
|
-
return this.uniforms.uLightColor.value;
|
|
656
|
-
},
|
|
657
|
-
set: function(e) {
|
|
658
|
-
this.uniforms.uLightColor.value = e, this.needsRender = !0;
|
|
659
|
-
},
|
|
660
|
-
enumerable: !1,
|
|
661
|
-
configurable: !0
|
|
662
|
-
}), i;
|
|
663
|
-
})(n.Group)
|
|
664
|
-
), Se = `
|
|
665
|
-
uniform vec3 uColor;
|
|
666
|
-
uniform float uOpacity;
|
|
667
|
-
varying vec3 vPosition;
|
|
668
|
-
varying float vNoise;
|
|
669
|
-
|
|
670
|
-
void main() {
|
|
671
|
-
float gradient = mix(0.0, 1.0, 1.0 + vPosition.y);
|
|
672
|
-
gl_FragColor = vec4(uColor, vNoise * gradient * uOpacity);
|
|
673
|
-
}
|
|
674
|
-
`, we = `
|
|
393
|
+
`, d = class extends e.Group {
|
|
394
|
+
constructor(t = 1, n = .1, r = .2) {
|
|
395
|
+
super(), this.needsRender = !0, this.uniforms = {
|
|
396
|
+
uTime: { value: 0 },
|
|
397
|
+
uAttenuation: { value: t * .9 },
|
|
398
|
+
uAnglePower: { value: 2 },
|
|
399
|
+
uSpotPosition: { value: this.position },
|
|
400
|
+
uLightColor: { value: new e.Color(16777215) }
|
|
401
|
+
};
|
|
402
|
+
let i = new e.CylinderBufferGeometry(n, r, t, 64, 20, !0);
|
|
403
|
+
i.applyMatrix4(new e.Matrix4().makeTranslation(0, -t / 2, 0)), i.applyMatrix4(new e.Matrix4().makeRotationX(-Math.PI / 2));
|
|
404
|
+
let a = new e.Mesh(i, new e.ShaderMaterial({
|
|
405
|
+
uniforms: this.uniforms,
|
|
406
|
+
vertexShader: u,
|
|
407
|
+
fragmentShader: l,
|
|
408
|
+
transparent: !0,
|
|
409
|
+
side: e.FrontSide,
|
|
410
|
+
depthWrite: !1
|
|
411
|
+
}));
|
|
412
|
+
this.add(a);
|
|
413
|
+
}
|
|
414
|
+
setTime(e) {
|
|
415
|
+
this.startTime === void 0 && (this.startTime = e), this.uniforms.uTime.value = (e - this.startTime) / 1e3, this.needsRender = !0;
|
|
416
|
+
}
|
|
417
|
+
set attenuation(e) {
|
|
418
|
+
this.uniforms.uAttenuation.value = e, this.needsRender = !0;
|
|
419
|
+
}
|
|
420
|
+
get attenuation() {
|
|
421
|
+
return this.uniforms.uAttenuation.value;
|
|
422
|
+
}
|
|
423
|
+
set anglePower(e) {
|
|
424
|
+
this.uniforms.uAnglePower.value = e, this.needsRender = !0;
|
|
425
|
+
}
|
|
426
|
+
get anglePower() {
|
|
427
|
+
return this.uniforms.uAnglePower.value;
|
|
428
|
+
}
|
|
429
|
+
set color(e) {
|
|
430
|
+
this.uniforms.uLightColor.value = e, this.needsRender = !0;
|
|
431
|
+
}
|
|
432
|
+
get color() {
|
|
433
|
+
return this.uniforms.uLightColor.value;
|
|
434
|
+
}
|
|
435
|
+
}, f = "\nuniform vec3 uColor;\nuniform float uOpacity;\nvarying vec3 vPosition;\nvarying float vNoise;\n\nvoid main() {\n float gradient = mix(0.0, 1.0, 1.0 + vPosition.y);\n gl_FragColor = vec4(uColor, vNoise * gradient * uOpacity);\n}\n", p = `
|
|
675
436
|
|
|
676
437
|
uniform float uTime;
|
|
677
438
|
uniform float uSpeed;
|
|
@@ -680,8 +441,8 @@ uniform float uExpand;
|
|
|
680
441
|
varying float vNoise;
|
|
681
442
|
varying vec3 vPosition;
|
|
682
443
|
|
|
683
|
-
|
|
684
|
-
|
|
444
|
+
${n}
|
|
445
|
+
${r}
|
|
685
446
|
|
|
686
447
|
void main(){
|
|
687
448
|
|
|
@@ -694,544 +455,327 @@ void main(){
|
|
|
694
455
|
|
|
695
456
|
gl_Position = projectionMatrix * modelViewMatrix * transformed;
|
|
696
457
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
var
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
return this.outer.material.uniforms.uExpand.value;
|
|
768
|
-
},
|
|
769
|
-
set: function(e) {
|
|
770
|
-
this.outer.material.uniforms.uExpand.value = e, this.inner.material.uniforms.uExpand.value = e, this.needsRender = !0;
|
|
771
|
-
},
|
|
772
|
-
enumerable: !1,
|
|
773
|
-
configurable: !0
|
|
774
|
-
}), Object.defineProperty(i.prototype, "speed", {
|
|
775
|
-
get: function() {
|
|
776
|
-
return this.inner.material.uniforms.speed.value;
|
|
777
|
-
},
|
|
778
|
-
set: function(e) {
|
|
779
|
-
this.inner.material.uniforms.speed.value = e, this.needsRender = !0;
|
|
780
|
-
},
|
|
781
|
-
enumerable: !1,
|
|
782
|
-
configurable: !0
|
|
783
|
-
}), Object.defineProperty(i.prototype, "color", {
|
|
784
|
-
get: function() {
|
|
785
|
-
return this.outer.material.uniforms.color.value;
|
|
786
|
-
},
|
|
787
|
-
set: function(e) {
|
|
788
|
-
this.outer.material.uniforms.color.value = e, this.needsRender = !0;
|
|
789
|
-
},
|
|
790
|
-
enumerable: !1,
|
|
791
|
-
configurable: !0
|
|
792
|
-
}), Object.defineProperty(i.prototype, "flowColor", {
|
|
793
|
-
get: function() {
|
|
794
|
-
return this.inner.material.uniforms.color.value;
|
|
795
|
-
},
|
|
796
|
-
set: function(e) {
|
|
797
|
-
this.inner.material.uniforms.color.value = e, this.needsRender = !0;
|
|
798
|
-
},
|
|
799
|
-
enumerable: !1,
|
|
800
|
-
configurable: !0
|
|
801
|
-
}), i;
|
|
802
|
-
})(n.Group)
|
|
803
|
-
);
|
|
804
|
-
function q(o, i) {
|
|
805
|
-
return o + i * (Math.random() - 0.5);
|
|
806
|
-
}
|
|
807
|
-
function K(o, i) {
|
|
808
|
-
var e = new n.Vector3(Math.random() - 0.5, Math.random() - 0.5, Math.random() - 0.5);
|
|
809
|
-
return new n.Vector3().addVectors(o, new n.Vector3().multiplyVectors(i, e));
|
|
810
|
-
}
|
|
811
|
-
function te(o, i, e) {
|
|
812
|
-
return o * e + i * e * e / 2;
|
|
813
|
-
}
|
|
814
|
-
function Ve(o, i, e) {
|
|
815
|
-
return new n.Vector3(te(o.x, i.x, e), te(o.y, i.y, e), te(o.z, i.z, e));
|
|
816
|
-
}
|
|
817
|
-
function oe(o, i) {
|
|
818
|
-
for (var e = o.times.length, t = 0; t < e && i > o.times[t]; )
|
|
819
|
-
t++;
|
|
820
|
-
if (t == 0)
|
|
821
|
-
return o.values[0];
|
|
822
|
-
if (t == e)
|
|
823
|
-
return o.values[e - 1];
|
|
824
|
-
var r = (i - o.times[t - 1]) / (o.times[t] - o.times[t - 1]), u = o.values[t - 1], a = o.values[t];
|
|
825
|
-
return typeof o.values[0] == "number" ? u + r * (a - u) : u.clone().lerp(a, r);
|
|
826
|
-
}
|
|
827
|
-
var De = (
|
|
828
|
-
/** @class */
|
|
829
|
-
(function() {
|
|
830
|
-
function o(i, e, t, r, u, a, s, c, f, m, h, d, y, b) {
|
|
831
|
-
this.birthTime = i, this.deathAge = e, this.position = t.clone(), this.velocity = r.clone(), this.acceleration = u.clone(), this.angle = a, this.angleVelocity = s, this.angleAcceleration = c, this.color = f, this.colorTween = m, this.size = h, this.sizeTween = d, this.opacity = y, this.opacityTween = b;
|
|
832
|
-
}
|
|
833
|
-
return o.prototype.getAlive = function(i) {
|
|
834
|
-
return this.deathAge > i - this.birthTime;
|
|
835
|
-
}, o.prototype.getState = function(i) {
|
|
836
|
-
var e = this.getAlive(i), t = Math.min(this.deathAge, i - this.birthTime), r = Ve(this.velocity, this.acceleration, t).add(this.position), u = te(this.angleVelocity, this.angleAcceleration, t) + this.angle, a = (this.sizeTween ? oe(this.sizeTween, t) : 0) + this.size, s = (this.colorTween ? oe(this.colorTween, t) : new n.Vector3()).add(this.color), c = new n.Color().setHSL(s.x, s.y, s.z), f = (this.opacityTween ? oe(this.opacityTween, t) : 0) + this.opacity;
|
|
837
|
-
return { alive: e, age: t, position: r, angle: u, size: a, color: c, opacity: f };
|
|
838
|
-
}, o;
|
|
839
|
-
})()
|
|
840
|
-
), Re = `
|
|
841
|
-
attribute vec3 color;
|
|
842
|
-
attribute float opacity;
|
|
843
|
-
attribute float size;
|
|
844
|
-
attribute float alive; // float used as boolean (0 = false, 1 = true)
|
|
845
|
-
|
|
846
|
-
varying vec4 vColor;
|
|
847
|
-
|
|
848
|
-
#if defined(USE_MAP)
|
|
849
|
-
attribute float angle;
|
|
850
|
-
varying float vAngle;
|
|
851
|
-
#endif
|
|
852
|
-
|
|
853
|
-
void main() {
|
|
854
|
-
if (alive > 0.5) {
|
|
855
|
-
vColor = vec4(color, opacity);
|
|
856
|
-
} else {
|
|
857
|
-
vColor = vec4(0.0, 0.0, 0.0, 0.0);
|
|
858
|
-
}
|
|
859
|
-
#if defined(USE_MAP)
|
|
860
|
-
vAngle = angle;
|
|
861
|
-
#endif
|
|
862
|
-
vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
|
|
863
|
-
gl_PointSize = size * ( 300.0 / length( mvPosition.xyz ) );
|
|
864
|
-
gl_Position = projectionMatrix * mvPosition;
|
|
865
|
-
}
|
|
866
|
-
`, Ne = `
|
|
867
|
-
varying vec4 vColor;
|
|
868
|
-
|
|
869
|
-
#if defined(USE_MAP)
|
|
870
|
-
uniform sampler2D map;
|
|
871
|
-
varying float vAngle;
|
|
872
|
-
#endif
|
|
873
|
-
|
|
874
|
-
void main() {
|
|
875
|
-
gl_FragColor = vColor;
|
|
876
|
-
|
|
877
|
-
#if defined(USE_MAP)
|
|
878
|
-
float c = cos(vAngle);
|
|
879
|
-
float s = sin(vAngle);
|
|
880
|
-
|
|
881
|
-
// rotate UV coordinates to rotate texture
|
|
882
|
-
vec2 rotatedUV = vec2(
|
|
883
|
-
c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,
|
|
884
|
-
c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5
|
|
885
|
-
);
|
|
886
|
-
vec4 rotatedTexture = texture2D(map, rotatedUV);
|
|
887
|
-
gl_FragColor = vColor * rotatedTexture;
|
|
888
|
-
#endif
|
|
458
|
+
`, m = new e.PlaneBufferGeometry(1, 1, 200, 200);
|
|
459
|
+
m.translate(0, -.5, 0);
|
|
460
|
+
var h = class extends e.Group {
|
|
461
|
+
constructor() {
|
|
462
|
+
super(), this.needsRender = !0;
|
|
463
|
+
let t = this.outer = new e.Mesh(m, new e.ShaderMaterial({
|
|
464
|
+
uniforms: {
|
|
465
|
+
uTime: { value: 0 },
|
|
466
|
+
uSpeed: { value: .75 },
|
|
467
|
+
uScale: { value: 2 },
|
|
468
|
+
uExpand: { value: 1.2 },
|
|
469
|
+
uColor: { value: new e.Color(.5, .5, .9) },
|
|
470
|
+
uOpacity: { value: 1 }
|
|
471
|
+
},
|
|
472
|
+
vertexShader: p,
|
|
473
|
+
fragmentShader: f,
|
|
474
|
+
transparent: !0,
|
|
475
|
+
side: e.DoubleSide,
|
|
476
|
+
depthWrite: !1
|
|
477
|
+
})), n = this.inner = new e.Mesh(m, new e.ShaderMaterial({
|
|
478
|
+
uniforms: {
|
|
479
|
+
uTime: { value: 0 },
|
|
480
|
+
uSpeed: { value: 2 },
|
|
481
|
+
uScale: { value: 20 },
|
|
482
|
+
uExpand: { value: 1.2 },
|
|
483
|
+
uColor: { value: new e.Color(1, 1, 1) },
|
|
484
|
+
uOpacity: { value: .1 }
|
|
485
|
+
},
|
|
486
|
+
vertexShader: p,
|
|
487
|
+
fragmentShader: f,
|
|
488
|
+
transparent: !0,
|
|
489
|
+
side: e.DoubleSide,
|
|
490
|
+
depthWrite: !1
|
|
491
|
+
}));
|
|
492
|
+
t.rotateX(-Math.PI / 2), n.rotateX(-Math.PI / 2), this.add(t), this.add(n);
|
|
493
|
+
}
|
|
494
|
+
setTime(e) {
|
|
495
|
+
this.startTime === void 0 && (this.startTime = e);
|
|
496
|
+
let t = (e - this.startTime) / 1e3;
|
|
497
|
+
this.inner.material.uniforms.uTime.value = t, this.outer.material.uniforms.uTime.value = t, this.needsRender = !0;
|
|
498
|
+
}
|
|
499
|
+
get expand() {
|
|
500
|
+
return this.outer.material.uniforms.uExpand.value;
|
|
501
|
+
}
|
|
502
|
+
set expand(e) {
|
|
503
|
+
this.outer.material.uniforms.uExpand.value = e, this.inner.material.uniforms.uExpand.value = e, this.needsRender = !0;
|
|
504
|
+
}
|
|
505
|
+
get speed() {
|
|
506
|
+
return this.inner.material.uniforms.speed.value;
|
|
507
|
+
}
|
|
508
|
+
set speed(e) {
|
|
509
|
+
this.inner.material.uniforms.speed.value = e, this.needsRender = !0;
|
|
510
|
+
}
|
|
511
|
+
get color() {
|
|
512
|
+
return this.outer.material.uniforms.color.value;
|
|
513
|
+
}
|
|
514
|
+
set color(e) {
|
|
515
|
+
this.outer.material.uniforms.color.value = e, this.needsRender = !0;
|
|
516
|
+
}
|
|
517
|
+
get flowColor() {
|
|
518
|
+
return this.inner.material.uniforms.color.value;
|
|
519
|
+
}
|
|
520
|
+
set flowColor(e) {
|
|
521
|
+
this.inner.material.uniforms.color.value = e, this.needsRender = !0;
|
|
522
|
+
}
|
|
523
|
+
};
|
|
524
|
+
//#endregion
|
|
525
|
+
//#region build/vfx/particle/utils.js
|
|
526
|
+
function g(e, t) {
|
|
527
|
+
return e + t * (Math.random() - .5);
|
|
889
528
|
}
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
Y(i, o);
|
|
894
|
-
function i(e) {
|
|
895
|
-
var t = this, r, u, a, s, c, f, m, h, d, y, b, S, g, _, C, B, E, F, P, T, M, z, V, D, R, N, U, O, j, G, I, X, H, k, v, p, w, x, A = new n.BufferGeometry();
|
|
896
|
-
A.setAttribute("position", new n.BufferAttribute(new Float32Array(), 3)), A.setAttribute("alive", new n.BufferAttribute(new Float32Array(), 1)), A.setAttribute("color", new n.BufferAttribute(new Float32Array(), 3)), A.setAttribute("opacity", new n.BufferAttribute(new Float32Array(), 1)), A.setAttribute("size", new n.BufferAttribute(new Float32Array(), 1)), A.setAttribute("angle", new n.BufferAttribute(new Float32Array(), 1));
|
|
897
|
-
var Z = new n.ShaderMaterial({
|
|
898
|
-
uniforms: {
|
|
899
|
-
map: { value: (r = e.texture) !== null && r !== void 0 ? r : null }
|
|
900
|
-
},
|
|
901
|
-
defines: {
|
|
902
|
-
USE_MAP: !!e.texture
|
|
903
|
-
},
|
|
904
|
-
vertexShader: Re,
|
|
905
|
-
fragmentShader: Ne,
|
|
906
|
-
transparent: !0,
|
|
907
|
-
blending: (u = e.blending) !== null && u !== void 0 ? u : n.NormalBlending,
|
|
908
|
-
depthWrite: !1
|
|
909
|
-
});
|
|
910
|
-
return t = o.call(this, A, Z) || this, t.instances = [], t.needsRender = !0, t.birthTime = Date.now() / 1e3, t.disposed = !1, t.paused = !1, t.positionBase = (s = (a = e.positionBase) === null || a === void 0 ? void 0 : a.clone()) !== null && s !== void 0 ? s : new n.Vector3(), t.positionStyle = (c = e.positionStyle) !== null && c !== void 0 ? c : "CUBE", t.positionCubeSpread = (m = (f = e.positionCubeSpread) === null || f === void 0 ? void 0 : f.clone()) !== null && m !== void 0 ? m : new n.Vector3(), t.positionSphereSpread = (h = e.positionSphereSpread) !== null && h !== void 0 ? h : 0, t.velocityStyle = (d = e.velocityStyle) !== null && d !== void 0 ? d : "CUBE", t.velocityCubeBase = (b = (y = e.velocityCubeBase) === null || y === void 0 ? void 0 : y.clone()) !== null && b !== void 0 ? b : new n.Vector3(), t.velocityCubeSpread = (g = (S = e.velocityCubeSpread) === null || S === void 0 ? void 0 : S.clone()) !== null && g !== void 0 ? g : new n.Vector3(), t.velocitySphereBase = (_ = e.velocitySphereBase) !== null && _ !== void 0 ? _ : 0, t.velocitySphereSpread = (C = e.velocitySphereSpread) !== null && C !== void 0 ? C : 0, t.accelerationBase = (E = (B = e.accelerationBase) === null || B === void 0 ? void 0 : B.clone()) !== null && E !== void 0 ? E : new n.Vector3(), t.accelerationSpread = (P = (F = e.accelerationSpread) === null || F === void 0 ? void 0 : F.clone()) !== null && P !== void 0 ? P : new n.Vector3(), t.angleBase = (T = e.angleBase) !== null && T !== void 0 ? T : 0, t.angleSpread = (M = e.angleSpread) !== null && M !== void 0 ? M : 0, t.angleVelocityBase = (z = e.angleVelocityBase) !== null && z !== void 0 ? z : 0, t.angleVelocitySpread = (V = e.angleVelocitySpread) !== null && V !== void 0 ? V : 0, t.angleAccelerationBase = (D = e.angleAccelerationBase) !== null && D !== void 0 ? D : 0, t.angleAccelerationSpread = (R = e.angleAccelerationSpread) !== null && R !== void 0 ? R : 0, t.sizeBase = (N = e.sizeBase) !== null && N !== void 0 ? N : 0.1, t.sizeSpread = (U = e.sizeSpread) !== null && U !== void 0 ? U : 0, t.sizeTween = (O = e.sizeTween) !== null && O !== void 0 ? O : null, t.colorBase = (G = (j = e.colorBase) === null || j === void 0 ? void 0 : j.clone()) !== null && G !== void 0 ? G : new n.Vector3(), t.colorSpread = (X = (I = e.colorSpread) === null || I === void 0 ? void 0 : I.clone()) !== null && X !== void 0 ? X : new n.Vector3(), t.colorTween = (H = e.colorTween) !== null && H !== void 0 ? H : null, t.opacityBase = ((k = e.opacityBase) !== null && k !== void 0 ? k : e.opacityTween) ? 0 : 1, t.opacitySpread = (v = e.opacitySpread) !== null && v !== void 0 ? v : 0, t.opacityTween = (p = e.opacityTween) !== null && p !== void 0 ? p : null, t.particlesPerSecond = (w = e.particlesPerSecond) !== null && w !== void 0 ? w : 60, t.particleDeathAge = (x = e.particleDeathAge) !== null && x !== void 0 ? x : 1, t;
|
|
911
|
-
}
|
|
912
|
-
return Object.defineProperty(i.prototype, "texture", {
|
|
913
|
-
/** 贴图素材 */
|
|
914
|
-
get: function() {
|
|
915
|
-
return this.material.uniforms.map.value;
|
|
916
|
-
},
|
|
917
|
-
set: function(e) {
|
|
918
|
-
this.material.uniforms.map.value = e, e === null ? this.material.defines.USE_MAP !== !1 && (this.material.defines.USE_MAP = !1, this.material.needsUpdate = !0) : this.material.defines.USE_MAP !== !0 && (this.material.defines.USE_MAP = !0, this.material.needsUpdate = !0);
|
|
919
|
-
},
|
|
920
|
-
enumerable: !1,
|
|
921
|
-
configurable: !0
|
|
922
|
-
}), Object.defineProperty(i.prototype, "blending", {
|
|
923
|
-
/** 材质混合方式 */
|
|
924
|
-
get: function() {
|
|
925
|
-
return this.material.blending;
|
|
926
|
-
},
|
|
927
|
-
set: function(e) {
|
|
928
|
-
this.material.blending = e;
|
|
929
|
-
},
|
|
930
|
-
enumerable: !1,
|
|
931
|
-
configurable: !0
|
|
932
|
-
}), i.prototype.createInstance = function(e) {
|
|
933
|
-
var t = this.positionBase.clone();
|
|
934
|
-
switch (this.positionStyle) {
|
|
935
|
-
case "CUBE": {
|
|
936
|
-
t = K(this.positionBase, this.positionCubeSpread);
|
|
937
|
-
break;
|
|
938
|
-
}
|
|
939
|
-
case "SPHERE": {
|
|
940
|
-
var r = 2 * Math.random() - 1, u = Math.PI * 2 * Math.random(), a = Math.sqrt(1 - r * r), s = new n.Vector3(a * Math.cos(u), a * Math.sin(u), r);
|
|
941
|
-
t = new n.Vector3().addVectors(this.positionBase, s.multiplyScalar(this.positionSphereSpread));
|
|
942
|
-
break;
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
var c = new n.Vector3();
|
|
946
|
-
switch (this.velocityStyle) {
|
|
947
|
-
case "CUBE": {
|
|
948
|
-
c = K(this.velocityCubeBase, this.velocityCubeSpread);
|
|
949
|
-
break;
|
|
950
|
-
}
|
|
951
|
-
case "SPHERE": {
|
|
952
|
-
var f = new n.Vector3().subVectors(t, this.positionBase), m = q(this.velocitySphereBase, this.velocitySphereSpread);
|
|
953
|
-
c = f.normalize().multiplyScalar(m);
|
|
954
|
-
break;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
var h = new De(e, this.particleDeathAge, t, c, K(this.accelerationBase, this.accelerationSpread), q(this.angleBase, this.angleSpread), q(this.angleVelocityBase, this.angleVelocitySpread), q(this.angleAccelerationBase, this.angleAccelerationSpread), K(this.colorBase, this.colorSpread), this.colorTween, q(this.sizeBase, this.sizeSpread), this.sizeTween, q(this.opacityBase, this.opacitySpread), this.opacityTween);
|
|
958
|
-
return h;
|
|
959
|
-
}, i.prototype.pause = function() {
|
|
960
|
-
this.paused !== !0 && (this.paused = !0, this.birthTime = Date.now() / 1e3);
|
|
961
|
-
}, i.prototype.play = function() {
|
|
962
|
-
this.paused !== !1 && (this.paused = !1, this.birthTime = Date.now() / 1e3);
|
|
963
|
-
}, i.prototype.setTime = function(e) {
|
|
964
|
-
if (!this.disposed) {
|
|
965
|
-
e /= 1e3;
|
|
966
|
-
var t = e - this.birthTime, r = Math.ceil(this.particlesPerSecond * this.particleDeathAge);
|
|
967
|
-
if (this.geometry.attributes.position.count < r) {
|
|
968
|
-
var u = new Float32Array(r * 3);
|
|
969
|
-
u.set(this.geometry.attributes.position.array, 0);
|
|
970
|
-
var a = new n.BufferAttribute(u, 3);
|
|
971
|
-
a.needsUpdate = !0, this.geometry.setAttribute("position", a);
|
|
972
|
-
}
|
|
973
|
-
if (this.geometry.attributes.alive.count < r) {
|
|
974
|
-
var s = new Float32Array(r);
|
|
975
|
-
s.set(this.geometry.attributes.alive.array, 0);
|
|
976
|
-
var a = new n.BufferAttribute(s, 1);
|
|
977
|
-
a.needsUpdate = !0, this.geometry.setAttribute("alive", a);
|
|
978
|
-
}
|
|
979
|
-
if (this.geometry.attributes.color.count < r) {
|
|
980
|
-
var c = new Float32Array(r * 3);
|
|
981
|
-
c.set(this.geometry.attributes.color.array, 0);
|
|
982
|
-
var a = new n.BufferAttribute(c, 3);
|
|
983
|
-
a.needsUpdate = !0, this.geometry.setAttribute("color", a);
|
|
984
|
-
}
|
|
985
|
-
if (this.geometry.attributes.opacity.count < r) {
|
|
986
|
-
var f = new Float32Array(r);
|
|
987
|
-
f.set(this.geometry.attributes.opacity.array, 0);
|
|
988
|
-
var a = new n.BufferAttribute(f, 1);
|
|
989
|
-
a.needsUpdate = !0, this.geometry.setAttribute("opacity", a);
|
|
990
|
-
}
|
|
991
|
-
if (this.geometry.attributes.size.count < r) {
|
|
992
|
-
var m = new Float32Array(r);
|
|
993
|
-
m.set(this.geometry.attributes.size.array, 0);
|
|
994
|
-
var a = new n.BufferAttribute(m, 1);
|
|
995
|
-
a.needsUpdate = !0, this.geometry.setAttribute("size", a);
|
|
996
|
-
}
|
|
997
|
-
if (this.geometry.attributes.angle.count < r) {
|
|
998
|
-
var h = new Float32Array(r);
|
|
999
|
-
h.set(this.geometry.attributes.angle.array, 0);
|
|
1000
|
-
var a = new n.BufferAttribute(h, 1);
|
|
1001
|
-
a.needsUpdate = !0, this.geometry.setAttribute("angle", a);
|
|
1002
|
-
}
|
|
1003
|
-
this.instances.length < r && (this.instances.length = r);
|
|
1004
|
-
for (var d = 0; d < this.instances.length; d++) {
|
|
1005
|
-
var y = this.instances[d];
|
|
1006
|
-
if (d < r && this.paused === !1 && (y === void 0 || y.getAlive(e) === !1)) {
|
|
1007
|
-
var b = this.particleDeathAge / r * d;
|
|
1008
|
-
if (t > b) {
|
|
1009
|
-
var S = e - (t - b) % this.particleDeathAge;
|
|
1010
|
-
this.instances[d] = y = this.createInstance(S);
|
|
1011
|
-
}
|
|
1012
|
-
}
|
|
1013
|
-
if (y) {
|
|
1014
|
-
var g = y.getState(e), u = g.position, s = g.alive, c = g.color, f = g.opacity, m = g.size, h = g.angle;
|
|
1015
|
-
this.geometry.attributes.position.setXYZ(d, u.x, u.y, u.z), this.geometry.attributes.position.needsUpdate = !0, this.geometry.attributes.alive.setX(d, s ? 1 : 0), this.geometry.attributes.alive.needsUpdate = !0, this.geometry.attributes.color.setXYZ(d, c.r, c.g, c.b), this.geometry.attributes.color.needsUpdate = !0, this.geometry.attributes.opacity.setX(d, f), this.geometry.attributes.opacity.needsUpdate = !0, this.geometry.attributes.size.setX(d, m), this.geometry.attributes.size.needsUpdate = !0, this.geometry.attributes.angle.setX(d, h), this.geometry.attributes.angle.needsUpdate = !0;
|
|
1016
|
-
}
|
|
1017
|
-
}
|
|
1018
|
-
this.geometry.computeBoundingBox(), this.geometry.boundingSphere || (this.geometry.boundingSphere = new n.Sphere()), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), this.needsRender = !0;
|
|
1019
|
-
}
|
|
1020
|
-
}, i.prototype.dispose = function() {
|
|
1021
|
-
var e;
|
|
1022
|
-
this.disposed = !0, this.geometry.dispose(), (e = this.texture) === null || e === void 0 || e.dispose(), this.material.dispose();
|
|
1023
|
-
}, i;
|
|
1024
|
-
})(n.Points)
|
|
1025
|
-
);
|
|
1026
|
-
function $(o, i) {
|
|
1027
|
-
return o + i * (Math.random() - 0.5);
|
|
529
|
+
function _(t, n) {
|
|
530
|
+
let r = new e.Vector3(Math.random() - .5, Math.random() - .5, Math.random() - .5);
|
|
531
|
+
return new e.Vector3().addVectors(t, new e.Vector3().multiplyVectors(n, r));
|
|
1028
532
|
}
|
|
1029
|
-
function
|
|
1030
|
-
|
|
1031
|
-
return new n.Vector3().addVectors(o, new n.Vector3().multiplyVectors(i, e));
|
|
533
|
+
function v(e, t, n) {
|
|
534
|
+
return e * n + t * n * n / 2;
|
|
1032
535
|
}
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
attribute vec3 initialVelocity;
|
|
1036
|
-
attribute vec3 acceleration;
|
|
1037
|
-
attribute float birthTime;
|
|
1038
|
-
attribute float lifeTime;
|
|
1039
|
-
attribute float initialSize;
|
|
1040
|
-
attribute float sizeGrowth;
|
|
1041
|
-
attribute vec3 initialColor;
|
|
1042
|
-
attribute float initialOpacity;
|
|
1043
|
-
attribute float initialAngle;
|
|
1044
|
-
attribute float angleVelocity;
|
|
1045
|
-
attribute float particleIndex;
|
|
1046
|
-
|
|
1047
|
-
// 全局uniform参数
|
|
1048
|
-
uniform float uTime;
|
|
1049
|
-
|
|
1050
|
-
// 传递给fragment shader的变量
|
|
1051
|
-
varying vec4 vColor;
|
|
1052
|
-
varying float vAngle;
|
|
1053
|
-
|
|
1054
|
-
// 简单噪声函数
|
|
1055
|
-
float random(vec2 st) {
|
|
1056
|
-
return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);
|
|
536
|
+
function y(t, n, r) {
|
|
537
|
+
return new e.Vector3(v(t.x, n.x, r), v(t.y, n.y, r), v(t.z, n.z, r));
|
|
1057
538
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
539
|
+
function b(e, t) {
|
|
540
|
+
let n = e.times.length, r = 0;
|
|
541
|
+
for (; r < n && t > e.times[r];) r++;
|
|
542
|
+
if (r == 0) return e.values[0];
|
|
543
|
+
if (r == n) return e.values[n - 1];
|
|
544
|
+
let i = (t - e.times[r - 1]) / (e.times[r] - e.times[r - 1]), a = e.values[r - 1], o = e.values[r];
|
|
545
|
+
return typeof e.values[0] == "number" ? a + i * (o - a) : a.clone().lerp(o, i);
|
|
1063
546
|
}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
float
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region build/vfx/particle/instance.js
|
|
549
|
+
var x = class {
|
|
550
|
+
constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
|
|
551
|
+
this.birthTime = e, this.deathAge = t, this.position = n.clone(), this.velocity = r.clone(), this.acceleration = i.clone(), this.angle = a, this.angleVelocity = o, this.angleAcceleration = s, this.color = c, this.colorTween = l, this.size = u, this.sizeTween = d, this.opacity = f, this.opacityTween = p;
|
|
552
|
+
}
|
|
553
|
+
getAlive(e) {
|
|
554
|
+
return this.deathAge > e - this.birthTime;
|
|
555
|
+
}
|
|
556
|
+
getState(t) {
|
|
557
|
+
let n = this.getAlive(t), r = Math.min(this.deathAge, t - this.birthTime), i = y(this.velocity, this.acceleration, r).add(this.position), a = v(this.angleVelocity, this.angleAcceleration, r) + this.angle, o = (this.sizeTween ? b(this.sizeTween, r) : 0) + this.size, s = (this.colorTween ? b(this.colorTween, r) : new e.Vector3()).add(this.color);
|
|
558
|
+
return {
|
|
559
|
+
alive: n,
|
|
560
|
+
age: r,
|
|
561
|
+
position: i,
|
|
562
|
+
angle: a,
|
|
563
|
+
size: o,
|
|
564
|
+
color: new e.Color().setHSL(s.x, s.y, s.z),
|
|
565
|
+
opacity: (this.opacityTween ? b(this.opacityTween, r) : 0) + this.opacity
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
}, S = "\nattribute vec3 color;\nattribute float opacity;\nattribute float size;\nattribute float alive; // float used as boolean (0 = false, 1 = true)\n\nvarying vec4 vColor;\n\n#if defined(USE_MAP)\n attribute float angle;\n varying float vAngle;\n#endif\n\nvoid main() {\n if (alive > 0.5) {\n vColor = vec4(color, opacity);\n } else {\n vColor = vec4(0.0, 0.0, 0.0, 0.0);\n }\n #if defined(USE_MAP)\n vAngle = angle;\n #endif\n vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );\n gl_PointSize = size * ( 300.0 / length( mvPosition.xyz ) );\n gl_Position = projectionMatrix * mvPosition;\n}\n", C = "\nvarying vec4 vColor;\n\n#if defined(USE_MAP)\n uniform sampler2D map;\n varying float vAngle;\n#endif\n\nvoid main() {\n gl_FragColor = vColor;\n\n #if defined(USE_MAP)\n float c = cos(vAngle);\n float s = sin(vAngle);\n\n // rotate UV coordinates to rotate texture\n vec2 rotatedUV = vec2(\n c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,\n c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5\n );\n vec4 rotatedTexture = texture2D(map, rotatedUV);\n gl_FragColor = vColor * rotatedTexture;\n #endif\n}\n", w = class extends e.Points {
|
|
569
|
+
constructor(t) {
|
|
570
|
+
var n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, w, T, E, D, O, k, A, j, M, N, P, F, I, L, R, z, B, V;
|
|
571
|
+
let H = new e.BufferGeometry();
|
|
572
|
+
H.setAttribute("position", new e.BufferAttribute(new Float32Array(), 3)), H.setAttribute("alive", new e.BufferAttribute(new Float32Array(), 1)), H.setAttribute("color", new e.BufferAttribute(new Float32Array(), 3)), H.setAttribute("opacity", new e.BufferAttribute(new Float32Array(), 1)), H.setAttribute("size", new e.BufferAttribute(new Float32Array(), 1)), H.setAttribute("angle", new e.BufferAttribute(new Float32Array(), 1));
|
|
573
|
+
let U = new e.ShaderMaterial({
|
|
574
|
+
uniforms: { map: { value: (n = t.texture) == null ? null : n } },
|
|
575
|
+
defines: { USE_MAP: !!t.texture },
|
|
576
|
+
vertexShader: S,
|
|
577
|
+
fragmentShader: C,
|
|
578
|
+
transparent: !0,
|
|
579
|
+
blending: (r = t.blending) == null ? e.NormalBlending : r,
|
|
580
|
+
depthWrite: !1
|
|
581
|
+
});
|
|
582
|
+
super(H, U), this.instances = [], this.needsRender = !0, this.birthTime = Date.now() / 1e3, this.disposed = !1, this.paused = !1, this.positionBase = (a = (i = t.positionBase) == null ? void 0 : i.clone()) == null ? new e.Vector3() : a, this.positionStyle = (o = t.positionStyle) == null ? "CUBE" : o, this.positionCubeSpread = (c = (s = t.positionCubeSpread) == null ? void 0 : s.clone()) == null ? new e.Vector3() : c, this.positionSphereSpread = (l = t.positionSphereSpread) == null ? 0 : l, this.velocityStyle = (u = t.velocityStyle) == null ? "CUBE" : u, this.velocityCubeBase = (f = (d = t.velocityCubeBase) == null ? void 0 : d.clone()) == null ? new e.Vector3() : f, this.velocityCubeSpread = (m = (p = t.velocityCubeSpread) == null ? void 0 : p.clone()) == null ? new e.Vector3() : m, this.velocitySphereBase = (h = t.velocitySphereBase) == null ? 0 : h, this.velocitySphereSpread = (g = t.velocitySphereSpread) == null ? 0 : g, this.accelerationBase = (v = (_ = t.accelerationBase) == null ? void 0 : _.clone()) == null ? new e.Vector3() : v, this.accelerationSpread = (b = (y = t.accelerationSpread) == null ? void 0 : y.clone()) == null ? new e.Vector3() : b, this.angleBase = (x = t.angleBase) == null ? 0 : x, this.angleSpread = (w = t.angleSpread) == null ? 0 : w, this.angleVelocityBase = (T = t.angleVelocityBase) == null ? 0 : T, this.angleVelocitySpread = (E = t.angleVelocitySpread) == null ? 0 : E, this.angleAccelerationBase = (D = t.angleAccelerationBase) == null ? 0 : D, this.angleAccelerationSpread = (O = t.angleAccelerationSpread) == null ? 0 : O, this.sizeBase = (k = t.sizeBase) == null ? .1 : k, this.sizeSpread = (A = t.sizeSpread) == null ? 0 : A, this.sizeTween = (j = t.sizeTween) == null ? null : j, this.colorBase = (N = (M = t.colorBase) == null ? void 0 : M.clone()) == null ? new e.Vector3() : N, this.colorSpread = (F = (P = t.colorSpread) == null ? void 0 : P.clone()) == null ? new e.Vector3() : F, this.colorTween = (I = t.colorTween) == null ? null : I, this.opacityBase = ((L = t.opacityBase) == null ? t.opacityTween : L) ? 0 : 1, this.opacitySpread = (R = t.opacitySpread) == null ? 0 : R, this.opacityTween = (z = t.opacityTween) == null ? null : z, this.particlesPerSecond = (B = t.particlesPerSecond) == null ? 60 : B, this.particleDeathAge = (V = t.particleDeathAge) == null ? 1 : V;
|
|
583
|
+
}
|
|
584
|
+
get texture() {
|
|
585
|
+
return this.material.uniforms.map.value;
|
|
586
|
+
}
|
|
587
|
+
set texture(e) {
|
|
588
|
+
this.material.uniforms.map.value = e, e === null ? this.material.defines.USE_MAP !== !1 && (this.material.defines.USE_MAP = !1, this.material.needsUpdate = !0) : this.material.defines.USE_MAP !== !0 && (this.material.defines.USE_MAP = !0, this.material.needsUpdate = !0);
|
|
589
|
+
}
|
|
590
|
+
get blending() {
|
|
591
|
+
return this.material.blending;
|
|
592
|
+
}
|
|
593
|
+
set blending(e) {
|
|
594
|
+
this.material.blending = e;
|
|
595
|
+
}
|
|
596
|
+
createInstance(t) {
|
|
597
|
+
let n = this.positionBase.clone();
|
|
598
|
+
switch (this.positionStyle) {
|
|
599
|
+
case "CUBE":
|
|
600
|
+
n = _(this.positionBase, this.positionCubeSpread);
|
|
601
|
+
break;
|
|
602
|
+
case "SPHERE": {
|
|
603
|
+
let t = 2 * Math.random() - 1, r = Math.PI * 2 * Math.random(), i = Math.sqrt(1 - t * t), a = new e.Vector3(i * Math.cos(r), i * Math.sin(r), t);
|
|
604
|
+
n = new e.Vector3().addVectors(this.positionBase, a.multiplyScalar(this.positionSphereSpread));
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
default: break;
|
|
608
|
+
}
|
|
609
|
+
let r = new e.Vector3();
|
|
610
|
+
switch (this.velocityStyle) {
|
|
611
|
+
case "CUBE":
|
|
612
|
+
r = _(this.velocityCubeBase, this.velocityCubeSpread);
|
|
613
|
+
break;
|
|
614
|
+
case "SPHERE": {
|
|
615
|
+
let t = new e.Vector3().subVectors(n, this.positionBase), i = g(this.velocitySphereBase, this.velocitySphereSpread);
|
|
616
|
+
r = t.normalize().multiplyScalar(i);
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
default: break;
|
|
620
|
+
}
|
|
621
|
+
return new x(t, this.particleDeathAge, n, r, _(this.accelerationBase, this.accelerationSpread), g(this.angleBase, this.angleSpread), g(this.angleVelocityBase, this.angleVelocitySpread), g(this.angleAccelerationBase, this.angleAccelerationSpread), _(this.colorBase, this.colorSpread), this.colorTween, g(this.sizeBase, this.sizeSpread), this.sizeTween, g(this.opacityBase, this.opacitySpread), this.opacityTween);
|
|
622
|
+
}
|
|
623
|
+
pause() {
|
|
624
|
+
this.paused !== !0 && (this.paused = !0, this.birthTime = Date.now() / 1e3);
|
|
625
|
+
}
|
|
626
|
+
play() {
|
|
627
|
+
this.paused !== !1 && (this.paused = !1, this.birthTime = Date.now() / 1e3);
|
|
628
|
+
}
|
|
629
|
+
setTime(t) {
|
|
630
|
+
if (this.disposed) return;
|
|
631
|
+
t /= 1e3;
|
|
632
|
+
let n = t - this.birthTime, r = Math.ceil(this.particlesPerSecond * this.particleDeathAge);
|
|
633
|
+
if (this.geometry.attributes.position.count < r) {
|
|
634
|
+
let t = new Float32Array(r * 3);
|
|
635
|
+
t.set(this.geometry.attributes.position.array, 0);
|
|
636
|
+
let n = new e.BufferAttribute(t, 3);
|
|
637
|
+
n.needsUpdate = !0, this.geometry.setAttribute("position", n);
|
|
638
|
+
}
|
|
639
|
+
if (this.geometry.attributes.alive.count < r) {
|
|
640
|
+
let t = new Float32Array(r);
|
|
641
|
+
t.set(this.geometry.attributes.alive.array, 0);
|
|
642
|
+
let n = new e.BufferAttribute(t, 1);
|
|
643
|
+
n.needsUpdate = !0, this.geometry.setAttribute("alive", n);
|
|
644
|
+
}
|
|
645
|
+
if (this.geometry.attributes.color.count < r) {
|
|
646
|
+
let t = new Float32Array(r * 3);
|
|
647
|
+
t.set(this.geometry.attributes.color.array, 0);
|
|
648
|
+
let n = new e.BufferAttribute(t, 3);
|
|
649
|
+
n.needsUpdate = !0, this.geometry.setAttribute("color", n);
|
|
650
|
+
}
|
|
651
|
+
if (this.geometry.attributes.opacity.count < r) {
|
|
652
|
+
let t = new Float32Array(r);
|
|
653
|
+
t.set(this.geometry.attributes.opacity.array, 0);
|
|
654
|
+
let n = new e.BufferAttribute(t, 1);
|
|
655
|
+
n.needsUpdate = !0, this.geometry.setAttribute("opacity", n);
|
|
656
|
+
}
|
|
657
|
+
if (this.geometry.attributes.size.count < r) {
|
|
658
|
+
let t = new Float32Array(r);
|
|
659
|
+
t.set(this.geometry.attributes.size.array, 0);
|
|
660
|
+
let n = new e.BufferAttribute(t, 1);
|
|
661
|
+
n.needsUpdate = !0, this.geometry.setAttribute("size", n);
|
|
662
|
+
}
|
|
663
|
+
if (this.geometry.attributes.angle.count < r) {
|
|
664
|
+
let t = new Float32Array(r);
|
|
665
|
+
t.set(this.geometry.attributes.angle.array, 0);
|
|
666
|
+
let n = new e.BufferAttribute(t, 1);
|
|
667
|
+
n.needsUpdate = !0, this.geometry.setAttribute("angle", n);
|
|
668
|
+
}
|
|
669
|
+
this.instances.length < r && (this.instances.length = r);
|
|
670
|
+
for (let e = 0; e < this.instances.length; e++) {
|
|
671
|
+
let i = this.instances[e];
|
|
672
|
+
if (e < r && this.paused === !1 && (i === void 0 || i.getAlive(t) === !1)) {
|
|
673
|
+
let a = this.particleDeathAge / r * e;
|
|
674
|
+
if (n > a) {
|
|
675
|
+
let r = t - (n - a) % this.particleDeathAge;
|
|
676
|
+
this.instances[e] = i = this.createInstance(r);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
if (i) {
|
|
680
|
+
let { position: n, alive: r, color: a, opacity: o, size: s, angle: c } = i.getState(t);
|
|
681
|
+
this.geometry.attributes.position.setXYZ(e, n.x, n.y, n.z), this.geometry.attributes.position.needsUpdate = !0, this.geometry.attributes.alive.setX(e, r ? 1 : 0), this.geometry.attributes.alive.needsUpdate = !0, this.geometry.attributes.color.setXYZ(e, a.r, a.g, a.b), this.geometry.attributes.color.needsUpdate = !0, this.geometry.attributes.opacity.setX(e, o), this.geometry.attributes.opacity.needsUpdate = !0, this.geometry.attributes.size.setX(e, s), this.geometry.attributes.size.needsUpdate = !0, this.geometry.attributes.angle.setX(e, c), this.geometry.attributes.angle.needsUpdate = !0;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
this.geometry.computeBoundingBox(), this.geometry.boundingSphere || (this.geometry.boundingSphere = new e.Sphere()), this.geometry.boundingBox.getBoundingSphere(this.geometry.boundingSphere), this.needsRender = !0;
|
|
685
|
+
}
|
|
686
|
+
dispose() {
|
|
687
|
+
var e;
|
|
688
|
+
this.disposed = !0, this.geometry.dispose(), (e = this.texture) == null || e.dispose(), this.material.dispose();
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
//#endregion
|
|
692
|
+
//#region build/vfx/particle-gpu/utils.js
|
|
693
|
+
function T(e, t) {
|
|
694
|
+
return e + t * (Math.random() - .5);
|
|
1109
695
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
#if defined(USE_MAP)
|
|
1115
|
-
uniform sampler2D map;
|
|
1116
|
-
#endif
|
|
1117
|
-
|
|
1118
|
-
void main() {
|
|
1119
|
-
// 如果粒子透明度为0,直接丢弃
|
|
1120
|
-
if (vColor.a <= 0.0) {
|
|
1121
|
-
discard;
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
gl_FragColor = vColor;
|
|
1125
|
-
|
|
1126
|
-
#if defined(USE_MAP)
|
|
1127
|
-
float c = cos(vAngle);
|
|
1128
|
-
float s = sin(vAngle);
|
|
1129
|
-
|
|
1130
|
-
// 旋转UV坐标以旋转纹理
|
|
1131
|
-
vec2 rotatedUV = vec2(
|
|
1132
|
-
c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,
|
|
1133
|
-
c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5
|
|
1134
|
-
);
|
|
1135
|
-
|
|
1136
|
-
vec4 textureColor = texture2D(map, rotatedUV);
|
|
1137
|
-
gl_FragColor = vColor * textureColor;
|
|
1138
|
-
#endif
|
|
696
|
+
function E(t, n) {
|
|
697
|
+
let r = new e.Vector3(Math.random() - .5, Math.random() - .5, Math.random() - .5);
|
|
698
|
+
return new e.Vector3().addVectors(t, new e.Vector3().multiplyVectors(n, r));
|
|
1139
699
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
(
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
this.paused !== !1 && (this.paused = !1, this.startTime = Date.now() / 1e3);
|
|
1220
|
-
}, i.prototype.setTime = function(e) {
|
|
1221
|
-
if (!(this.disposed || this.paused)) {
|
|
1222
|
-
var t = e / 1e3, r = t - this.startTime;
|
|
1223
|
-
this.material.uniforms.uTime.value = r, this.needsRender = !0;
|
|
1224
|
-
}
|
|
1225
|
-
}, i.prototype.dispose = function() {
|
|
1226
|
-
var e;
|
|
1227
|
-
this.disposed = !0, this.geometry.dispose(), (e = this.texture) === null || e === void 0 || e.dispose(), this.material.dispose();
|
|
1228
|
-
}, i;
|
|
1229
|
-
})(n.Points)
|
|
1230
|
-
);
|
|
1231
|
-
export {
|
|
1232
|
-
Ie as Airflow,
|
|
1233
|
-
je as Flame,
|
|
1234
|
-
Xe as Particle,
|
|
1235
|
-
He as ParticleGPU,
|
|
1236
|
-
Ge as SpotLight
|
|
700
|
+
//#endregion
|
|
701
|
+
//#region build/vfx/particle-gpu/vertex-shader.js
|
|
702
|
+
var D = "\n// 粒子初始属性\nattribute vec3 initialVelocity;\nattribute vec3 acceleration;\nattribute float birthTime;\nattribute float lifeTime;\nattribute float initialSize;\nattribute float sizeGrowth;\nattribute vec3 initialColor;\nattribute float initialOpacity;\nattribute float initialAngle;\nattribute float angleVelocity;\nattribute float particleIndex;\n\n// 全局uniform参数\nuniform float uTime;\n\n// 传递给fragment shader的变量\nvarying vec4 vColor;\nvarying float vAngle;\n\n// 简单噪声函数\nfloat random(vec2 st) {\n return fract(sin(dot(st.xy, vec2(12.9898,78.233))) * 43758.5453123);\n}\n\n// HSL转RGB函数\nvec3 hsl2rgb(vec3 c) {\n vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0), 6.0)-3.0)-1.0, 0.0, 1.0);\n return c.z + c.y * (rgb-0.5)*(1.0-abs(2.0*c.z-1.0));\n}\n\nvoid main() {\n // 计算粒子的实际年龄,考虑循环重生\n float totalCycleTime = lifeTime;\n float adjustedTime = uTime + birthTime;\n float cycleTime = mod(adjustedTime, totalCycleTime);\n float age = cycleTime;\n float normalizedAge = clamp(age / lifeTime, 0.0, 1.0);\n \n // 如果粒子年龄超过生命周期,让它重新开始\n if (age > lifeTime) {\n age = 0.0;\n normalizedAge = 0.0;\n }\n \n // 计算当前位置(物理模拟)\n vec3 currentVelocity = initialVelocity + acceleration * age;\n \n vec3 currentPosition = position + currentVelocity * age;\n \n // 计算当前大小(随时间变化)\n float currentSize = initialSize + sizeGrowth * normalizedAge;\n \n // 计算当前角度\n vAngle = initialAngle + angleVelocity * age;\n \n // 计算当前颜色和透明度(生命周期渐变)\n vec3 currentColor = initialColor;\n float currentOpacity = initialOpacity;\n \n // 生命周期透明度渐变(出生和死亡时渐变)\n if (normalizedAge < 0.1) {\n currentOpacity *= normalizedAge / 0.1; // 淡入\n } else if (normalizedAge > 0.8) {\n currentOpacity *= (1.0 - normalizedAge) / 0.2; // 淡出\n }\n \n // 将HSL颜色转换为RGB\n vec3 rgbColor = hsl2rgb(currentColor);\n vColor = vec4(rgbColor, currentOpacity);\n \n // 计算最终位置和大小\n vec4 mvPosition = modelViewMatrix * vec4(currentPosition, 1.0);\n gl_PointSize = currentSize * (300.0 / length(mvPosition.xyz));\n gl_Position = projectionMatrix * mvPosition;\n}\n", O = "\nvarying vec4 vColor;\nvarying float vAngle;\n\n#if defined(USE_MAP)\n uniform sampler2D map;\n#endif\n\nvoid main() {\n // 如果粒子透明度为0,直接丢弃\n if (vColor.a <= 0.0) {\n discard;\n }\n \n gl_FragColor = vColor;\n\n #if defined(USE_MAP)\n float c = cos(vAngle);\n float s = sin(vAngle);\n\n // 旋转UV坐标以旋转纹理\n vec2 rotatedUV = vec2(\n c * (gl_PointCoord.x - 0.5) + s * (gl_PointCoord.y - 0.5) + 0.5,\n c * (gl_PointCoord.y - 0.5) - s * (gl_PointCoord.x - 0.5) + 0.5\n );\n \n vec4 textureColor = texture2D(map, rotatedUV);\n gl_FragColor = vColor * textureColor;\n #endif\n}\n", k = class extends e.Points {
|
|
703
|
+
constructor(t) {
|
|
704
|
+
var n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, k, A, j, M, N, P, F, I, L, R, z;
|
|
705
|
+
let B = Math.ceil(((n = t.particlesPerSecond) == null ? 60 : n) * ((r = t.particleDeathAge) == null ? 1 : r)), V = new e.BufferGeometry(), H = new Float32Array(B * 3), U = new Float32Array(B * 3), W = new Float32Array(B * 3), G = new Float32Array(B), K = new Float32Array(B), q = new Float32Array(B), J = new Float32Array(B), Y = new Float32Array(B * 3), X = new Float32Array(B), Z = new Float32Array(B), Q = new Float32Array(B), $ = new Float32Array(B);
|
|
706
|
+
for (let n = 0; n < B; n++) {
|
|
707
|
+
G[n] = ((i = t.particleDeathAge) == null ? 1 : i) / B * n, K[n] = (a = t.particleDeathAge) == null ? 1 : a, $[n] = n;
|
|
708
|
+
let r = (s = (o = t.positionBase) == null ? void 0 : o.clone()) == null ? new e.Vector3() : s;
|
|
709
|
+
switch ((c = t.positionStyle) == null ? "CUBE" : c) {
|
|
710
|
+
case "CUBE":
|
|
711
|
+
r = E((l = t.positionBase) == null ? new e.Vector3() : l, (u = t.positionCubeSpread) == null ? new e.Vector3() : u);
|
|
712
|
+
break;
|
|
713
|
+
case "SPHERE": {
|
|
714
|
+
let n = 2 * Math.random() - 1, i = Math.PI * 2 * Math.random(), a = Math.sqrt(1 - n * n), o = new e.Vector3(a * Math.cos(i), a * Math.sin(i), n);
|
|
715
|
+
r = new e.Vector3().addVectors((d = t.positionBase) == null ? new e.Vector3() : d, o.multiplyScalar((f = t.positionSphereSpread) == null ? 0 : f));
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
H[n * 3] = r.x, H[n * 3 + 1] = r.y, H[n * 3 + 2] = r.z;
|
|
720
|
+
let D = new e.Vector3();
|
|
721
|
+
switch ((p = t.velocityStyle) == null ? "CUBE" : p) {
|
|
722
|
+
case "CUBE":
|
|
723
|
+
D = E((m = t.velocityCubeBase) == null ? new e.Vector3() : m, (h = t.velocityCubeSpread) == null ? new e.Vector3() : h);
|
|
724
|
+
break;
|
|
725
|
+
case "SPHERE": {
|
|
726
|
+
let n = new e.Vector3().subVectors(r, (g = t.positionBase) == null ? new e.Vector3() : g), i = T((_ = t.velocitySphereBase) == null ? 0 : _, (v = t.velocitySphereSpread) == null ? 0 : v);
|
|
727
|
+
D = n.normalize().multiplyScalar(i);
|
|
728
|
+
break;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
U[n * 3] = D.x, U[n * 3 + 1] = D.y, U[n * 3 + 2] = D.z;
|
|
732
|
+
let O = E((y = t.accelerationBase) == null ? new e.Vector3() : y, (b = t.accelerationSpread) == null ? new e.Vector3() : b);
|
|
733
|
+
W[n * 3] = O.x, W[n * 3 + 1] = O.y, W[n * 3 + 2] = O.z, q[n] = T((x = t.sizeBase) == null ? .1 : x, (S = t.sizeSpread) == null ? 0 : S), J[n] = (C = t.sizeGrowth) == null ? 0 : C;
|
|
734
|
+
let I = E((w = t.colorBase) == null ? new e.Vector3() : w, (k = t.colorSpread) == null ? new e.Vector3() : k);
|
|
735
|
+
Y[n * 3] = I.x, Y[n * 3 + 1] = I.y, Y[n * 3 + 2] = I.z, X[n] = T((A = t.opacityBase) == null ? 1 : A, (j = t.opacitySpread) == null ? 0 : j), Z[n] = T((M = t.angleBase) == null ? 0 : M, (N = t.angleSpread) == null ? 0 : N), Q[n] = T((P = t.angleVelocityBase) == null ? 0 : P, (F = t.angleVelocitySpread) == null ? 0 : F);
|
|
736
|
+
}
|
|
737
|
+
V.setAttribute("position", new e.BufferAttribute(H, 3)), V.setAttribute("initialVelocity", new e.BufferAttribute(U, 3)), V.setAttribute("acceleration", new e.BufferAttribute(W, 3)), V.setAttribute("birthTime", new e.BufferAttribute(G, 1)), V.setAttribute("lifeTime", new e.BufferAttribute(K, 1)), V.setAttribute("initialSize", new e.BufferAttribute(q, 1)), V.setAttribute("sizeGrowth", new e.BufferAttribute(J, 1)), V.setAttribute("initialColor", new e.BufferAttribute(Y, 3)), V.setAttribute("initialOpacity", new e.BufferAttribute(X, 1)), V.setAttribute("initialAngle", new e.BufferAttribute(Z, 1)), V.setAttribute("angleVelocity", new e.BufferAttribute(Q, 1)), V.setAttribute("particleIndex", new e.BufferAttribute($, 1));
|
|
738
|
+
let ee = new e.ShaderMaterial({
|
|
739
|
+
uniforms: {
|
|
740
|
+
map: { value: (I = t.texture) == null ? null : I },
|
|
741
|
+
uTime: { value: 0 }
|
|
742
|
+
},
|
|
743
|
+
defines: { USE_MAP: !!t.texture },
|
|
744
|
+
vertexShader: D,
|
|
745
|
+
fragmentShader: O,
|
|
746
|
+
transparent: !0,
|
|
747
|
+
blending: (L = t.blending) == null ? e.NormalBlending : L,
|
|
748
|
+
depthWrite: !1
|
|
749
|
+
});
|
|
750
|
+
super(V, ee), this.needsRender = !0, this.startTime = Date.now() / 1e3, this.disposed = !1, this.paused = !1, this.particleCount = B, this.particlesPerSecond = (R = t.particlesPerSecond) == null ? 60 : R, this.particleDeathAge = (z = t.particleDeathAge) == null ? 1 : z;
|
|
751
|
+
}
|
|
752
|
+
get texture() {
|
|
753
|
+
return this.material.uniforms.map.value;
|
|
754
|
+
}
|
|
755
|
+
set texture(e) {
|
|
756
|
+
this.material.uniforms.map.value = e, e === null ? this.material.defines.USE_MAP !== !1 && (this.material.defines.USE_MAP = !1, this.material.needsUpdate = !0) : this.material.defines.USE_MAP !== !0 && (this.material.defines.USE_MAP = !0, this.material.needsUpdate = !0);
|
|
757
|
+
}
|
|
758
|
+
get blending() {
|
|
759
|
+
return this.material.blending;
|
|
760
|
+
}
|
|
761
|
+
set blending(e) {
|
|
762
|
+
this.material.blending = e;
|
|
763
|
+
}
|
|
764
|
+
pause() {
|
|
765
|
+
this.paused !== !0 && (this.paused = !0, this.startTime = Date.now() / 1e3);
|
|
766
|
+
}
|
|
767
|
+
play() {
|
|
768
|
+
this.paused !== !1 && (this.paused = !1, this.startTime = Date.now() / 1e3);
|
|
769
|
+
}
|
|
770
|
+
setTime(e) {
|
|
771
|
+
if (this.disposed || this.paused) return;
|
|
772
|
+
let t = e / 1e3 - this.startTime;
|
|
773
|
+
this.material.uniforms.uTime.value = t, this.needsRender = !0;
|
|
774
|
+
}
|
|
775
|
+
dispose() {
|
|
776
|
+
var e;
|
|
777
|
+
this.disposed = !0, this.geometry.dispose(), (e = this.texture) == null || e.dispose(), this.material.dispose();
|
|
778
|
+
}
|
|
1237
779
|
};
|
|
780
|
+
//#endregion
|
|
781
|
+
export { h as Airflow, c as Flame, w as Particle, k as ParticleGPU, d as SpotLight };
|