babylon.quarks 0.24.1 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +124 -0
- package/dist/babylon.quarks.cjs +1 -1
- package/dist/babylon.quarks.cjs.map +1 -1
- package/dist/babylon.quarks.esm.js +1 -1
- package/dist/babylon.quarks.esm.js.map +1 -1
- package/dist/babylon.quarks.umd.min.js +1 -1
- package/dist/babylon.quarks.umd.min.js.map +1 -1
- package/dist/types/index.d.ts +501 -9
- package/package.json +1 -1
- package/src/BatchedRenderer.ts +34 -1
- package/src/ParticleSystem.ts +465 -13
- package/src/QuarksLoader.ts +50 -2
- package/src/QuarksUtil.ts +97 -1
- package/src/SpriteBatch.ts +101 -10
- package/src/TrailBatch.ts +132 -20
- package/src/VFXBatch.ts +465 -4
- package/src/index.ts +38 -2
- package/src/shaders/chunks/surface.ts +268 -0
- package/src/shaders/local_particle_physics_vert.glsl.ts +15 -0
- package/src/shaders/local_particle_physics_vert.wgsl.ts +15 -0
- package/src/shaders/particle_frag.glsl.ts +6 -11
- package/src/shaders/particle_frag.wgsl.ts +6 -11
- package/src/shaders/particle_physics_frag.glsl.ts +13 -15
- package/src/shaders/particle_physics_frag.wgsl.ts +13 -15
- package/src/shaders/particle_vert.glsl.ts +7 -0
- package/src/shaders/particle_vert.wgsl.ts +7 -0
- package/src/shaders/stretched_bb_particle_vert.glsl.ts +27 -7
- package/src/shaders/stretched_bb_particle_vert.wgsl.ts +32 -9
- package/src/shaders/trail_frag.glsl.ts +6 -7
- package/src/shaders/trail_frag.wgsl.ts +6 -7
- package/src/shaders/trail_vert.glsl.ts +8 -0
- package/src/shaders/trail_vert.wgsl.ts +8 -0
package/dist/types/index.d.ts
CHANGED
|
@@ -1121,6 +1121,18 @@ interface TrailSettings {
|
|
|
1121
1121
|
* @type {boolean}
|
|
1122
1122
|
*/
|
|
1123
1123
|
recordWorldSpace?: boolean;
|
|
1124
|
+
/**
|
|
1125
|
+
* Sweep the ribbon along this axis of the emitter instead of turning it to
|
|
1126
|
+
* face the camera: every sample records the axis as the emitter held it,
|
|
1127
|
+
* and the ribbon spans the particle's width along it, centred on the
|
|
1128
|
+
* particle. With the emitter on a blade, the axis along the blade and the
|
|
1129
|
+
* width the blade's length, the trail is the surface the blade swept, as a
|
|
1130
|
+
* weapon trail (Unreal's AnimTrail) is. The emitter's scale applies to the
|
|
1131
|
+
* width, and so does the axis's length: give a unit vector for the width
|
|
1132
|
+
* as set. Unset (the default): a camera-facing ribbon.
|
|
1133
|
+
* @type {Vector3}
|
|
1134
|
+
*/
|
|
1135
|
+
sideAxis?: Vector3;
|
|
1124
1136
|
}
|
|
1125
1137
|
interface MeshSettings {
|
|
1126
1138
|
/**
|
|
@@ -1182,6 +1194,14 @@ interface IParticleSystem {
|
|
|
1182
1194
|
* @type {number}
|
|
1183
1195
|
*/
|
|
1184
1196
|
simulationStep?: number;
|
|
1197
|
+
/**
|
|
1198
|
+
* What world-space forces and speed limits are multiplied by: the
|
|
1199
|
+
* emitter's world scale when the system scales its motion with it (a
|
|
1200
|
+
* world-space system in `'hierarchy'` scaling mode), 1 or undefined
|
|
1201
|
+
* otherwise.
|
|
1202
|
+
* @type {number}
|
|
1203
|
+
*/
|
|
1204
|
+
motionScale?: number;
|
|
1185
1205
|
/**
|
|
1186
1206
|
* Whether this system only emits through another system, which is when its
|
|
1187
1207
|
* particles carry their own parent transform.
|
|
@@ -1752,6 +1772,12 @@ declare class TrailParticle implements Particle {
|
|
|
1752
1772
|
headWidthScale: number;
|
|
1753
1773
|
/** Ring buffer of recorded colors, 4 floats per sample. */
|
|
1754
1774
|
historyColors: Float32Array;
|
|
1775
|
+
/**
|
|
1776
|
+
* Ring buffer of recorded side vectors, 3 floats per sample, in the space
|
|
1777
|
+
* the positions are recorded in. Empty unless the trail is swept along an
|
|
1778
|
+
* axis (`TrailSettings.sideAxis`); see {@link ensureSideHistory}.
|
|
1779
|
+
*/
|
|
1780
|
+
historySides: Float32Array;
|
|
1755
1781
|
/** Number of samples the ring buffers can hold. */
|
|
1756
1782
|
historyCapacity: number;
|
|
1757
1783
|
/** Slot the next sample is written to. */
|
|
@@ -1776,6 +1802,8 @@ declare class TrailParticle implements Particle {
|
|
|
1776
1802
|
* @param {number} capacity - Number of samples to hold.
|
|
1777
1803
|
*/
|
|
1778
1804
|
ensureHistoryCapacity(capacity: number): void;
|
|
1805
|
+
/** Allocates {@link historySides} for the current capacity, once a trail is swept. */
|
|
1806
|
+
ensureSideHistory(): void;
|
|
1779
1807
|
/** Drops every recorded sample without releasing the buffers. */
|
|
1780
1808
|
resetHistory(): void;
|
|
1781
1809
|
/**
|
|
@@ -2114,17 +2142,82 @@ declare class ForceOverLife implements Behavior {
|
|
|
2114
2142
|
}
|
|
2115
2143
|
|
|
2116
2144
|
/**
|
|
2117
|
-
*
|
|
2145
|
+
* How {@link FrameOverLife} plays the sheet, beyond sampling `frame` over the
|
|
2146
|
+
* particle's life. Every field is optional, and leaving them all out keeps the
|
|
2147
|
+
* plain life-fraction behaviour.
|
|
2148
|
+
*/
|
|
2149
|
+
interface FrameOverLifeOptions {
|
|
2150
|
+
/**
|
|
2151
|
+
* Frames per second. Above zero the sheet plays by the particle's age in
|
|
2152
|
+
* seconds instead of its life fraction, Unity's "FPS" time mode: `frame`
|
|
2153
|
+
* then gives the first frame of the segment, and the frame advances by one
|
|
2154
|
+
* every `1 / fps` seconds. Needs {@link frameCount}.
|
|
2155
|
+
*/
|
|
2156
|
+
fps?: number;
|
|
2157
|
+
/**
|
|
2158
|
+
* Life mode only: how many times `frame` plays over the particle's life
|
|
2159
|
+
* (Unity's "Cycles"). Default 1.
|
|
2160
|
+
*/
|
|
2161
|
+
cycles?: number;
|
|
2162
|
+
/**
|
|
2163
|
+
* Frames in the segment that plays, from the first frame. In FPS mode the
|
|
2164
|
+
* frame wraps (or holds, see {@link loop}) at it, counted from `frame`;
|
|
2165
|
+
* in life mode the curve plus a {@link startFrame} offset wraps into
|
|
2166
|
+
* `[0, frameCount)`, so the curve should start at frame 0. 0, the default,
|
|
2167
|
+
* means no segment.
|
|
2168
|
+
*/
|
|
2169
|
+
frameCount?: number;
|
|
2170
|
+
/** FPS mode: wrap back to the first frame of the segment (default) or hold its last. */
|
|
2171
|
+
loop?: boolean;
|
|
2172
|
+
/**
|
|
2173
|
+
* FPS mode: every `1 / fps` seconds show a random frame of the segment
|
|
2174
|
+
* instead of the next one, each particle its own sequence: the flicker of
|
|
2175
|
+
* lightning, sparks or a neon sign. Needs {@link frameCount}; `loop` does
|
|
2176
|
+
* not apply. Default false.
|
|
2177
|
+
*/
|
|
2178
|
+
random?: boolean;
|
|
2179
|
+
/**
|
|
2180
|
+
* Per-particle frame offset, sampled once at birth: an `IntervalValue(0, n)`
|
|
2181
|
+
* starts each particle on a random frame (Unity's "Start Frame"). Default none.
|
|
2182
|
+
*/
|
|
2183
|
+
startFrame?: ValueGenerator;
|
|
2184
|
+
}
|
|
2185
|
+
/**
|
|
2186
|
+
* Sets the particle's texture tile (`uvTile`) over its life.
|
|
2187
|
+
*
|
|
2188
|
+
* By default `frame` is sampled at the particle's life fraction. The
|
|
2189
|
+
* {@link FrameOverLifeOptions} add the rest of Unity's texture sheet
|
|
2190
|
+
* animation: playing at a fixed frame rate, several cycles per life, a frame
|
|
2191
|
+
* segment that loops or holds, a random start frame, and a random frame on
|
|
2192
|
+
* every tick.
|
|
2118
2193
|
*/
|
|
2119
2194
|
declare class FrameOverLife implements Behavior {
|
|
2120
2195
|
type: string;
|
|
2121
2196
|
private _frame;
|
|
2122
|
-
|
|
2197
|
+
fps: number;
|
|
2198
|
+
cycles: number;
|
|
2199
|
+
frameCount: number;
|
|
2200
|
+
loop: boolean;
|
|
2201
|
+
random: boolean;
|
|
2202
|
+
startFrame?: ValueGenerator;
|
|
2203
|
+
/** A per-particle sample that sets each particle's random sequence apart. */
|
|
2204
|
+
private readonly salt;
|
|
2205
|
+
constructor(frame: FunctionValueGenerator | ValueGenerator, options?: FrameOverLifeOptions);
|
|
2123
2206
|
get frame(): FunctionValueGenerator | ValueGenerator;
|
|
2124
2207
|
set frame(frame: FunctionValueGenerator | ValueGenerator);
|
|
2208
|
+
/** True when no option is in play and the frame is just `frame` at the life fraction. */
|
|
2209
|
+
isPlain(): boolean;
|
|
2125
2210
|
initialize(particle: Particle): void;
|
|
2126
2211
|
update(particle: Particle, delta: number): void;
|
|
2127
2212
|
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
2213
|
+
/** The tile for `particle` at `age` seconds, `t` being that age over its life. */
|
|
2214
|
+
frameAt(particle: Particle, age: number, t: number): number;
|
|
2215
|
+
private offset;
|
|
2216
|
+
/** The particle's salt; 0 for a particle born before this behaviour was added. */
|
|
2217
|
+
private saltOf;
|
|
2218
|
+
/** A stable pseudo-random number in [0, 1) for a tick of a particle's sequence. */
|
|
2219
|
+
private static hash;
|
|
2220
|
+
private static wrap;
|
|
2128
2221
|
private sampleFrame;
|
|
2129
2222
|
frameUpdate(delta: number): void;
|
|
2130
2223
|
toJSON(): any;
|
|
@@ -2188,7 +2281,11 @@ declare class LimitSpeedOverLife implements Behavior {
|
|
|
2188
2281
|
speed: FunctionValueGenerator;
|
|
2189
2282
|
dampen: number;
|
|
2190
2283
|
type: string;
|
|
2191
|
-
initialize
|
|
2284
|
+
/** Learned in {@link initialize}; its motion scale multiplies the limit of a world-space system. */
|
|
2285
|
+
ps?: IParticleSystem;
|
|
2286
|
+
initialize(particle: Particle, particleSystem?: IParticleSystem): void;
|
|
2287
|
+
/** What the limit is multiplied by: the system's motion scale in world space, else 1. */
|
|
2288
|
+
motionScale(): number;
|
|
2192
2289
|
constructor(speed: FunctionValueGenerator, dampen: number);
|
|
2193
2290
|
update(particle: Particle, delta: number): void;
|
|
2194
2291
|
updateAll(particles: Array<Particle>, count: number, delta: number): void;
|
|
@@ -3262,7 +3359,14 @@ declare enum RenderMode {
|
|
|
3262
3359
|
Mesh = 2,
|
|
3263
3360
|
Trail = 3,
|
|
3264
3361
|
HorizontalBillBoard = 4,
|
|
3265
|
-
VerticalBillBoard = 5
|
|
3362
|
+
VerticalBillBoard = 5,
|
|
3363
|
+
/**
|
|
3364
|
+
* A quad laid from each particle to the system's {@link ParticleSystem.beamEnd}
|
|
3365
|
+
* and turned about its length to face the camera (a line renderer): U runs
|
|
3366
|
+
* from the particle (0) to the end (1), V across, the particle's size is
|
|
3367
|
+
* the width. Lightning, tethers, lasers.
|
|
3368
|
+
*/
|
|
3369
|
+
Beam = 6
|
|
3266
3370
|
}
|
|
3267
3371
|
/**
|
|
3268
3372
|
* How mesh particles are lit.
|
|
@@ -3303,9 +3407,12 @@ interface MeshRim {
|
|
|
3303
3407
|
strength: number;
|
|
3304
3408
|
/**
|
|
3305
3409
|
* `'add'` (default) adds the colour, for a glowing edge; `'mix'` blends the
|
|
3306
|
-
* surface toward it, for an outline (a dark ink line with a dark colour)
|
|
3410
|
+
* surface toward it, for an outline (a dark ink line with a dark colour);
|
|
3411
|
+
* `'fade'` leaves the colour and fades the faces turned to the camera by
|
|
3412
|
+
* `strength` instead, alpha times `1 - strength * (1 - edge)`: a wall of
|
|
3413
|
+
* light that reads thick along its silhouette and thin across its face.
|
|
3307
3414
|
*/
|
|
3308
|
-
mode: 'add' | 'mix';
|
|
3415
|
+
mode: 'add' | 'mix' | 'fade';
|
|
3309
3416
|
}
|
|
3310
3417
|
/**
|
|
3311
3418
|
* A complete rim from a partial one, every field defaulted and kept in range,
|
|
@@ -3314,10 +3421,165 @@ interface MeshRim {
|
|
|
3314
3421
|
declare function normalizeMeshRim(rim: Partial<MeshRim> | null | undefined): MeshRim | undefined;
|
|
3315
3422
|
/** True when both describe the same rim (or both none). */
|
|
3316
3423
|
declare function meshRimEqual(a: MeshRim | undefined, b: MeshRim | undefined): boolean;
|
|
3424
|
+
/**
|
|
3425
|
+
* Which texture coordinates a texture is sampled with, as Unity's UV channels
|
|
3426
|
+
* and Niagara's ribbon UV0 / UV1:
|
|
3427
|
+
*
|
|
3428
|
+
* - `0`: the particle's first UV, with the sprite sheet's cell applied: on a
|
|
3429
|
+
* sheet the current frame's cell, on a trail the cell's stretch along it, on
|
|
3430
|
+
* a mesh its first UV set. Read before the map's own layout and distortion,
|
|
3431
|
+
* so a texture on it does not move with them.
|
|
3432
|
+
* - `1`: the particle's own UV, never moved by the sheet. The whole quad on a
|
|
3433
|
+
* billboard, a stretched billboard or a beam (mirrored with the quad when it
|
|
3434
|
+
* flips); on a trail U along it the way the map's runs (from the tail, or
|
|
3435
|
+
* from the head with `uvFromHead`) and V across it; on a mesh its second UV
|
|
3436
|
+
* set (`instancingUVs2`), or its first when it has none.
|
|
3437
|
+
*
|
|
3438
|
+
* A mesh can then repeat its picture along UV0 while a mask on UV1 runs once
|
|
3439
|
+
* across its whole length, as a lightmap UV does in a game engine.
|
|
3440
|
+
*/
|
|
3441
|
+
type UVChannel = 0 | 1;
|
|
3442
|
+
/**
|
|
3443
|
+
* How a texture is laid over the particle: its UV channel, then tiling and
|
|
3444
|
+
* offset as in Unity's material Tiling / Offset, then a scroll on the
|
|
3445
|
+
* renderer's clock as Unreal's Panner. Sampled at
|
|
3446
|
+
* `uv(channel) * tiling + offset + scroll * time`; the offset is used as
|
|
3447
|
+
* given, so a clamped texture can be moved off its edge, and only the
|
|
3448
|
+
* scroll's share is wrapped (over two repeats, so a mirrored texture stays
|
|
3449
|
+
* seamless). A texture that scrolls or tiles should repeat.
|
|
3450
|
+
*/
|
|
3451
|
+
interface TextureUV {
|
|
3452
|
+
/** See {@link UVChannel}. Default 0. */
|
|
3453
|
+
channel: UVChannel;
|
|
3454
|
+
/** Repeats across the channel's 0…1, `[u, v]`. Default `[1, 1]`. */
|
|
3455
|
+
tiling: [number, number];
|
|
3456
|
+
/** Added after tiling, in texture UV units. Default `[0, 0]`. */
|
|
3457
|
+
offset: [number, number];
|
|
3458
|
+
/** UV units per second on the renderer's clock. Default `[0, 0]`. */
|
|
3459
|
+
scroll: [number, number];
|
|
3460
|
+
}
|
|
3461
|
+
/** A complete {@link TextureUV} from a partial one, with `defaults` under the fields left out. */
|
|
3462
|
+
declare function normalizeTextureUV(uv: Partial<TextureUV> | null | undefined, defaults?: Partial<TextureUV>): TextureUV;
|
|
3463
|
+
/** True when both lay a texture the same way. */
|
|
3464
|
+
declare function textureUVEqual(a: TextureUV, b: TextureUV): boolean;
|
|
3465
|
+
/** The fields of `uv` that differ from `defaults`, for JSON written only when set. */
|
|
3466
|
+
declare function textureUVToJSON(uv: TextureUV, defaults?: Partial<TextureUV>): Partial<TextureUV> | undefined;
|
|
3467
|
+
/**
|
|
3468
|
+
* Which value of the map's texel picks the colour along a gradient map's
|
|
3469
|
+
* ramp: one channel, so a texture can pack several masks (Unreal's and
|
|
3470
|
+
* Unity's channel-packed textures), or the Rec. 709 luminance of its colour.
|
|
3471
|
+
*/
|
|
3472
|
+
type GradientMapChannel = 'r' | 'g' | 'b' | 'a' | 'luminance';
|
|
3473
|
+
/**
|
|
3474
|
+
* A gradient map (colour ramp): the map is recoloured by looking its
|
|
3475
|
+
* {@link channel} up along U of {@link ramp}. See
|
|
3476
|
+
* {@link VFXBatchSettings.gradientMap}.
|
|
3477
|
+
*/
|
|
3478
|
+
interface ParticleGradientMap {
|
|
3479
|
+
/**
|
|
3480
|
+
* The ramp, read along U at mid V: low values on the left. Make it without
|
|
3481
|
+
* mipmaps and clamped. Required: without one there is no gradient map.
|
|
3482
|
+
*/
|
|
3483
|
+
ramp: BaseTexture | null;
|
|
3484
|
+
/**
|
|
3485
|
+
* The texel value the ramp is looked up by. Default `'r'`. With `'a'` the
|
|
3486
|
+
* ramp's alpha becomes the texel's alpha, so a soft shape can glow at its
|
|
3487
|
+
* fringe and stay solid at its heart; with any other channel the ramp's
|
|
3488
|
+
* alpha multiplies the map's.
|
|
3489
|
+
*/
|
|
3490
|
+
channel: GradientMapChannel;
|
|
3491
|
+
}
|
|
3492
|
+
/** The weights a texel is dotted with to look up the ramp, per {@link GradientMapChannel}. */
|
|
3493
|
+
declare const GRADIENT_MAP_WEIGHTS: Readonly<Record<GradientMapChannel, readonly [number, number, number, number]>>;
|
|
3494
|
+
/** A complete gradient map, or undefined when unset or without a ramp. */
|
|
3495
|
+
declare function normalizeGradientMap(gradientMap: Partial<ParticleGradientMap> | null | undefined): ParticleGradientMap | undefined;
|
|
3496
|
+
/** True when both recolour the same way (or both not at all). */
|
|
3497
|
+
declare function gradientMapEqual(a: ParticleGradientMap | undefined, b: ParticleGradientMap | undefined): boolean;
|
|
3498
|
+
/**
|
|
3499
|
+
* Alpha erosion: the particle's alpha decides how much of its shape is left
|
|
3500
|
+
* instead of how transparent it is, so `ColorOverLife` fading alpha out
|
|
3501
|
+
* dissolves (noise mask) or wipes (gradient mask) the shape away. See
|
|
3502
|
+
* {@link VFXBatchSettings.erosion}.
|
|
3503
|
+
*/
|
|
3504
|
+
interface ParticleErosion {
|
|
3505
|
+
/**
|
|
3506
|
+
* Mask whose red channel orders what goes first, laid by {@link maskUV}.
|
|
3507
|
+
* Null: the map's own alpha, so a soft shape shrinks from its edges.
|
|
3508
|
+
*/
|
|
3509
|
+
mask: BaseTexture | null;
|
|
3510
|
+
/**
|
|
3511
|
+
* How the mask is laid over the particle, see {@link TextureUV}. On UV
|
|
3512
|
+
* channel 1 a gradient mask wipes a whole trail or mesh however its map
|
|
3513
|
+
* repeats. Default channel 0, untiled, still.
|
|
3514
|
+
*/
|
|
3515
|
+
maskUV: TextureUV;
|
|
3516
|
+
/** Width of the soft transition at the cut, in mask units. Default 0.05. */
|
|
3517
|
+
softness: number;
|
|
3518
|
+
/** Width of the glowing band above the cut, in mask units; 0 (default) draws none. */
|
|
3519
|
+
edgeWidth: number;
|
|
3520
|
+
/** Colour added in the edge band, linear RGB, may exceed 1. Default `[1, 1, 1]`. */
|
|
3521
|
+
edgeColor: [number, number, number];
|
|
3522
|
+
}
|
|
3523
|
+
/** {@link ParticleErosion} as given: any field may be left out, the mask's layout too. */
|
|
3524
|
+
type ParticleErosionOptions = Partial<Omit<ParticleErosion, 'maskUV'>> & {
|
|
3525
|
+
maskUV?: Partial<TextureUV>;
|
|
3526
|
+
};
|
|
3527
|
+
/** A complete erosion from a partial one, every field defaulted, or undefined when `erosion` is unset. */
|
|
3528
|
+
declare function normalizeErosion(erosion: ParticleErosionOptions | null | undefined): ParticleErosion | undefined;
|
|
3529
|
+
/** True when both describe the same erosion (or both none). */
|
|
3530
|
+
declare function erosionEqual(a: ParticleErosion | undefined, b: ParticleErosion | undefined): boolean;
|
|
3531
|
+
/** The distortion noise's default layout: drifting up half a repeat a second. */
|
|
3532
|
+
declare const UV_DISTORTION_DEFAULT_UV: Partial<TextureUV>;
|
|
3533
|
+
/**
|
|
3534
|
+
* UV distortion: the map's UV pushed about by a noise texture, for heat
|
|
3535
|
+
* shimmer, licking flames and breathing auras. See
|
|
3536
|
+
* {@link VFXBatchSettings.uvDistortion}.
|
|
3537
|
+
*/
|
|
3538
|
+
interface ParticleUVDistortion {
|
|
3539
|
+
/**
|
|
3540
|
+
* Noise whose red and green channels, around 0.5, push U and V. It should
|
|
3541
|
+
* wrap (repeat). Required: without one there is no distortion.
|
|
3542
|
+
*/
|
|
3543
|
+
map: BaseTexture | null;
|
|
3544
|
+
/**
|
|
3545
|
+
* How the noise is laid over the particle, see {@link TextureUV}. Default
|
|
3546
|
+
* channel 0, untiled, scrolling `[0, 0.5]`.
|
|
3547
|
+
*/
|
|
3548
|
+
mapUV: TextureUV;
|
|
3549
|
+
/** How far the map's UV is pushed at most, in UV units. Default 0.05. */
|
|
3550
|
+
strength: number;
|
|
3551
|
+
}
|
|
3552
|
+
/** {@link ParticleUVDistortion} as given: any field may be left out, the noise's layout too. */
|
|
3553
|
+
type ParticleUVDistortionOptions = Partial<Omit<ParticleUVDistortion, 'mapUV'>> & {
|
|
3554
|
+
mapUV?: Partial<TextureUV>;
|
|
3555
|
+
};
|
|
3556
|
+
/** A complete distortion from a partial one, or undefined when unset or without a map. */
|
|
3557
|
+
declare function normalizeUVDistortion(distortion: ParticleUVDistortionOptions | null | undefined): ParticleUVDistortion | undefined;
|
|
3558
|
+
/** True when both describe the same distortion (or both none). */
|
|
3559
|
+
declare function uvDistortionEqual(a: ParticleUVDistortion | undefined, b: ParticleUVDistortion | undefined): boolean;
|
|
3560
|
+
/**
|
|
3561
|
+
* The main map's layout, or undefined when it is the identity (channel 0,
|
|
3562
|
+
* untiled, unmoved, still), which costs nothing in the shader.
|
|
3563
|
+
*/
|
|
3564
|
+
declare function normalizeMapUV(uv: Partial<TextureUV> | null | undefined): TextureUV | undefined;
|
|
3565
|
+
/** True when both lay the map the same way (or both as drawn). */
|
|
3566
|
+
declare function mapUVEqual(a: TextureUV | undefined, b: TextureUV | undefined): boolean;
|
|
3567
|
+
/**
|
|
3568
|
+
* True when a texture effect of `settings` samples UV channel 1, see
|
|
3569
|
+
* {@link UVChannel}: the map, the distortion noise or an erosion mask laid
|
|
3570
|
+
* on it.
|
|
3571
|
+
*/
|
|
3572
|
+
declare function readsUV1(settings: {
|
|
3573
|
+
mapUV?: TextureUV;
|
|
3574
|
+
uvDistortion?: ParticleUVDistortion;
|
|
3575
|
+
erosion?: ParticleErosion;
|
|
3576
|
+
}): boolean;
|
|
3317
3577
|
interface StoredBatchSettings {
|
|
3318
3578
|
instancingGeometry: Float32Array;
|
|
3319
3579
|
instancingIndices: Uint32Array | Uint16Array;
|
|
3320
3580
|
instancingUVs?: Float32Array;
|
|
3581
|
+
/** The mesh's second UV set, see {@link UVChannel}. */
|
|
3582
|
+
instancingUVs2?: Float32Array;
|
|
3321
3583
|
instancingNormals?: Float32Array;
|
|
3322
3584
|
renderMode: RenderMode;
|
|
3323
3585
|
renderOrder: number;
|
|
@@ -3354,6 +3616,14 @@ interface StoredBatchSettings {
|
|
|
3354
3616
|
lighting?: MeshLighting;
|
|
3355
3617
|
/** Mesh particle rim, see {@link VFXBatchSettings.rim}. */
|
|
3356
3618
|
rim?: MeshRim;
|
|
3619
|
+
/** The main map's layout, see {@link VFXBatchSettings.mapUV}. */
|
|
3620
|
+
mapUV?: TextureUV;
|
|
3621
|
+
/** Map UV distortion, see {@link VFXBatchSettings.uvDistortion}. */
|
|
3622
|
+
uvDistortion?: ParticleUVDistortion;
|
|
3623
|
+
/** Colour ramp for the map, see {@link VFXBatchSettings.gradientMap}. */
|
|
3624
|
+
gradientMap?: ParticleGradientMap;
|
|
3625
|
+
/** Alpha erosion, see {@link VFXBatchSettings.erosion}. */
|
|
3626
|
+
erosion?: ParticleErosion;
|
|
3357
3627
|
}
|
|
3358
3628
|
declare abstract class VFXBatch {
|
|
3359
3629
|
mesh: Mesh;
|
|
@@ -3391,6 +3661,19 @@ declare abstract class VFXBatch {
|
|
|
3391
3661
|
protected static readonly FOG_UNIFORMS: string[];
|
|
3392
3662
|
protected fogDefines(): string[];
|
|
3393
3663
|
protected bindFog(material: ShaderMaterial): void;
|
|
3664
|
+
/**
|
|
3665
|
+
* Seconds of renderer time, set by the renderer before each fill; what UV
|
|
3666
|
+
* and erosion mask scrolling advance by.
|
|
3667
|
+
*/
|
|
3668
|
+
time: number;
|
|
3669
|
+
/** True when a texture effect of this batch samples UV channel 1, see {@link UVChannel}. */
|
|
3670
|
+
protected usesUV1(): boolean;
|
|
3671
|
+
/** Defines of the texture effects (see `shaders/chunks/surface.ts`) this batch uses. */
|
|
3672
|
+
protected surfaceDefines(): string[];
|
|
3673
|
+
/** Adds the uniforms and samplers of the texture effects this batch uses. */
|
|
3674
|
+
protected surfaceUniforms(uniforms: string[], samplers: string[]): void;
|
|
3675
|
+
/** Sets the texture effects' textures and constants, and advances their scrolling on every bind. */
|
|
3676
|
+
protected bindSurface(material: ShaderMaterial): void;
|
|
3394
3677
|
addSystem(system: IParticleSystem): void;
|
|
3395
3678
|
removeSystem(system: IParticleSystem): void;
|
|
3396
3679
|
/**
|
|
@@ -3413,6 +3696,8 @@ interface VFXBatchSettings {
|
|
|
3413
3696
|
instancingGeometry: Float32Array;
|
|
3414
3697
|
instancingIndices: Uint32Array | Uint16Array;
|
|
3415
3698
|
instancingUVs?: Float32Array;
|
|
3699
|
+
/** The mesh's second UV set, see {@link UVChannel}. */
|
|
3700
|
+
instancingUVs2?: Float32Array;
|
|
3416
3701
|
instancingNormals?: Float32Array;
|
|
3417
3702
|
renderMode: RenderMode;
|
|
3418
3703
|
renderOrder: number;
|
|
@@ -3488,6 +3773,14 @@ interface VFXBatchSettings {
|
|
|
3488
3773
|
lighting?: MeshLighting;
|
|
3489
3774
|
/** Rim (Fresnel) term on mesh particles; unset draws none. See {@link MeshRim}. */
|
|
3490
3775
|
rim?: MeshRim;
|
|
3776
|
+
/** How the main map is laid over the particle, see {@link TextureUV}. Unset: as drawn. Systems that differ are batched apart. */
|
|
3777
|
+
mapUV?: TextureUV;
|
|
3778
|
+
/** Colour ramp the map is recoloured through, see {@link ParticleGradientMap}. Unset: none. Systems that differ are batched apart. */
|
|
3779
|
+
gradientMap?: ParticleGradientMap;
|
|
3780
|
+
/** Map UV distortion by a noise texture, see {@link ParticleUVDistortion}. Unset: none. Systems that differ are batched apart. */
|
|
3781
|
+
uvDistortion?: ParticleUVDistortion;
|
|
3782
|
+
/** Alpha erosion (dissolve / wipe), see {@link ParticleErosion}. Unset: none. Systems that differ are batched apart. */
|
|
3783
|
+
erosion?: ParticleErosion;
|
|
3491
3784
|
}
|
|
3492
3785
|
interface AdaptivePerformanceOptions {
|
|
3493
3786
|
targetFrameMs: number;
|
|
@@ -3503,6 +3796,8 @@ interface AdaptivePerformanceState extends AdaptivePerformanceOptions {
|
|
|
3503
3796
|
}
|
|
3504
3797
|
declare class BatchedRenderer extends TransformNode {
|
|
3505
3798
|
batches: Array<VFXBatch>;
|
|
3799
|
+
/** Seconds this renderer has been updated for; the clock UV and erosion scrolling run on. */
|
|
3800
|
+
private elapsed;
|
|
3506
3801
|
systemToBatchIndex: Map<IParticleSystem, number>;
|
|
3507
3802
|
depthTexture: BaseTexture | null;
|
|
3508
3803
|
/** Systems in insertion order — iterated every frame, unlike the map. */
|
|
@@ -3778,6 +4073,35 @@ interface BurstParameters {
|
|
|
3778
4073
|
* culled either; its parent decides.
|
|
3779
4074
|
*/
|
|
3780
4075
|
type CullingMode = 'always' | 'pause' | 'pauseAndCatchUp';
|
|
4076
|
+
/**
|
|
4077
|
+
* What the emitter's world scale does to a world-space system (Unity's
|
|
4078
|
+
* Scaling Mode, as far as it differs here). A local-space system lives in its
|
|
4079
|
+
* emitter's space, so its scale reaches everything either way.
|
|
4080
|
+
*
|
|
4081
|
+
* - `'shape'` (default): the scale sizes the emission shape and the
|
|
4082
|
+
* particles; speeds, forces and speed limits stay in world units, so a
|
|
4083
|
+
* scaled-down effect moves as far as the full-size one.
|
|
4084
|
+
* - `'hierarchy'`: the scale also multiplies start speeds (per axis),
|
|
4085
|
+
* `ForceOverLife` and `LimitSpeedOverLife` (by the mean of the axes), so the
|
|
4086
|
+
* whole effect, motion included, scales like a model would.
|
|
4087
|
+
*/
|
|
4088
|
+
type ScalingMode = 'shape' | 'hierarchy';
|
|
4089
|
+
/**
|
|
4090
|
+
* Where a {@link RenderMode.Beam} system's quads end: a point in world space,
|
|
4091
|
+
* or anything with a world position, such as a Babylon `TransformNode`, read
|
|
4092
|
+
* every frame.
|
|
4093
|
+
*/
|
|
4094
|
+
type BeamEnd = {
|
|
4095
|
+
x: number;
|
|
4096
|
+
y: number;
|
|
4097
|
+
z: number;
|
|
4098
|
+
} | {
|
|
4099
|
+
getAbsolutePosition(): {
|
|
4100
|
+
x: number;
|
|
4101
|
+
y: number;
|
|
4102
|
+
z: number;
|
|
4103
|
+
};
|
|
4104
|
+
};
|
|
3781
4105
|
interface ParticleSystemParameters {
|
|
3782
4106
|
autoDestroy?: boolean;
|
|
3783
4107
|
looping?: boolean;
|
|
@@ -3801,6 +4125,12 @@ interface ParticleSystemParameters {
|
|
|
3801
4125
|
instancingGeometry?: Float32Array;
|
|
3802
4126
|
instancingIndices?: Uint32Array | Uint16Array;
|
|
3803
4127
|
instancingUVs?: Float32Array;
|
|
4128
|
+
/**
|
|
4129
|
+
* A second UV set for the mesh (glTF `TEXCOORD_1`, Unity's `uv2`), what
|
|
4130
|
+
* textures on UV channel 1 read on a mesh particle; see `UVChannel`.
|
|
4131
|
+
* Default none: channel 1 reads the first set.
|
|
4132
|
+
*/
|
|
4133
|
+
instancingUVs2?: Float32Array;
|
|
3804
4134
|
instancingNormals?: Float32Array;
|
|
3805
4135
|
renderMode?: RenderMode;
|
|
3806
4136
|
rendererEmitterSettings?: RendererEmitterSettings;
|
|
@@ -3830,10 +4160,20 @@ interface ParticleSystemParameters {
|
|
|
3830
4160
|
lighting?: MeshLighting;
|
|
3831
4161
|
/** Rim (Fresnel) term on mesh particles, see {@link ParticleSystem.rim}. Default none. */
|
|
3832
4162
|
rim?: Partial<MeshRim>;
|
|
4163
|
+
/** The main map's layout, see {@link ParticleSystem.mapUV}. Default as drawn. */
|
|
4164
|
+
mapUV?: Partial<TextureUV>;
|
|
4165
|
+
/** Colour ramp for the map, see {@link ParticleSystem.gradientMap}. Default none. */
|
|
4166
|
+
gradientMap?: Partial<ParticleGradientMap>;
|
|
4167
|
+
/** Alpha erosion, see {@link ParticleSystem.erosion}. Default none. */
|
|
4168
|
+
erosion?: ParticleErosionOptions;
|
|
4169
|
+
/** Map UV distortion, see {@link ParticleSystem.uvDistortion}. Default none. */
|
|
4170
|
+
uvDistortion?: ParticleUVDistortionOptions;
|
|
3833
4171
|
/** Multiplier on the time the system is advanced by, see {@link ParticleSystem.playbackSpeed}. Default 1. */
|
|
3834
4172
|
playbackSpeed?: number;
|
|
3835
4173
|
/** What the system does while off screen, see {@link CullingMode}. Default `'always'`. */
|
|
3836
4174
|
cullingMode?: CullingMode;
|
|
4175
|
+
/** What the emitter's scale does to a world-space system, see {@link ScalingMode}. Default `'shape'`. */
|
|
4176
|
+
scalingMode?: ScalingMode;
|
|
3837
4177
|
/** Seed for this system's own random generator, see {@link ParticleSystem.seed}. Default none. */
|
|
3838
4178
|
seed?: number;
|
|
3839
4179
|
/** Draw order within the batch, see {@link ParticleSystem.sortMode}. Default `'none'`. */
|
|
@@ -3887,6 +4227,8 @@ interface ParticleSystemJSONParameters {
|
|
|
3887
4227
|
playbackSpeed?: number;
|
|
3888
4228
|
/** Written only when not `'always'`. */
|
|
3889
4229
|
cullingMode?: CullingMode;
|
|
4230
|
+
/** Written only when not `'shape'`. */
|
|
4231
|
+
scalingMode?: ScalingMode;
|
|
3890
4232
|
/** Written only when set. */
|
|
3891
4233
|
seed?: number;
|
|
3892
4234
|
/** Written only when not `'none'`. */
|
|
@@ -4090,6 +4432,58 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
4090
4432
|
*/
|
|
4091
4433
|
get rim(): MeshRim | undefined;
|
|
4092
4434
|
set rim(rim: Partial<MeshRim> | undefined);
|
|
4435
|
+
/**
|
|
4436
|
+
* How the main map is laid over the particle, see {@link TextureUV}: its
|
|
4437
|
+
* UV channel, tiling and offset (Unity's Tiling / Offset) and a scroll on
|
|
4438
|
+
* the renderer's clock (Unreal's Panner), for flowing energy, lava or a
|
|
4439
|
+
* smear running along a mesh. A scrolled or tiled map should repeat. On a
|
|
4440
|
+
* sprite sheet (UV channel 0) the layout applies to the sheet's UV, so a
|
|
4441
|
+
* scroll or tiling there runs into the neighbouring cells. Undefined (the
|
|
4442
|
+
* default), or the identity: the map as drawn. Fields left out take their
|
|
4443
|
+
* defaults; assign a new object to change it. Saved with the material in
|
|
4444
|
+
* the effect JSON.
|
|
4445
|
+
*/
|
|
4446
|
+
get mapUV(): TextureUV | undefined;
|
|
4447
|
+
set mapUV(uv: Partial<TextureUV> | undefined);
|
|
4448
|
+
/**
|
|
4449
|
+
* Colour ramp the map is recoloured through (a gradient map), see
|
|
4450
|
+
* {@link ParticleGradientMap}: a channel of the map, or its luminance,
|
|
4451
|
+
* picks a colour along U of the ramp; the particle colour still tints the
|
|
4452
|
+
* result. One greyscale or channel-packed texture then serves every
|
|
4453
|
+
* palette. Undefined (the default), or without a ramp: none. Assign a new
|
|
4454
|
+
* object to change it. Saved with the material in the effect JSON.
|
|
4455
|
+
*/
|
|
4456
|
+
get gradientMap(): ParticleGradientMap | undefined;
|
|
4457
|
+
set gradientMap(gradientMap: Partial<ParticleGradientMap> | undefined);
|
|
4458
|
+
/**
|
|
4459
|
+
* Alpha erosion, see {@link ParticleErosion}: the particle's alpha decides
|
|
4460
|
+
* how much of the shape is left rather than how transparent it is, so a
|
|
4461
|
+
* `ColorOverLife` alpha curve dissolves the shape through a noise mask or
|
|
4462
|
+
* wipes it through a gradient one — and an effect told to stop can fade
|
|
4463
|
+
* out that way. Undefined (the default): alpha is plain transparency.
|
|
4464
|
+
* Fields left out take their defaults; assign a new object to change it.
|
|
4465
|
+
* Saved with the material in the effect JSON.
|
|
4466
|
+
*/
|
|
4467
|
+
get erosion(): ParticleErosion | undefined;
|
|
4468
|
+
set erosion(erosion: ParticleErosionOptions | undefined);
|
|
4469
|
+
/**
|
|
4470
|
+
* Map UV distortion, see {@link ParticleUVDistortion}: a scrolling noise
|
|
4471
|
+
* texture pushes the map's UV about, for heat shimmer and licking,
|
|
4472
|
+
* breathing shapes. Undefined (the default), or without a map: none.
|
|
4473
|
+
* Fields left out take their defaults; assign a new object to change it.
|
|
4474
|
+
* Saved with the material in the effect JSON.
|
|
4475
|
+
*/
|
|
4476
|
+
get uvDistortion(): ParticleUVDistortion | undefined;
|
|
4477
|
+
set uvDistortion(distortion: ParticleUVDistortionOptions | undefined);
|
|
4478
|
+
/**
|
|
4479
|
+
* The emitter's world scale per axis, measured with {@link motionScale}
|
|
4480
|
+
* before every step; what `'hierarchy'` multiplies start speeds by. Taken
|
|
4481
|
+
* from the system's own emitter rather than the emission matrix, whose
|
|
4482
|
+
* columns carry a parent particle's velocity for a sub emitter.
|
|
4483
|
+
*/
|
|
4484
|
+
private readonly hierarchyScale;
|
|
4485
|
+
/** The mean world scale of the emitter for a world-space `'hierarchy'` system, else 1. */
|
|
4486
|
+
private measureMotionScale;
|
|
4093
4487
|
/** `lighting` if it is one of the modes, else the default. */
|
|
4094
4488
|
private static validLighting;
|
|
4095
4489
|
private static validSortMode;
|
|
@@ -4101,7 +4495,19 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
4101
4495
|
get softFarFade(): number;
|
|
4102
4496
|
set softFarFade(v: number);
|
|
4103
4497
|
get instancingGeometry(): Float32Array;
|
|
4498
|
+
/**
|
|
4499
|
+
* The mesh particles' positions. A new geometry with a different vertex
|
|
4500
|
+
* count drops UV sets and normals that no longer fit it: the first UV set
|
|
4501
|
+
* falls back to zeros, the second to none, the normals to +Z. Assign {@link instancingUVs} and
|
|
4502
|
+
* {@link instancingUVs2} after it.
|
|
4503
|
+
*/
|
|
4104
4504
|
set instancingGeometry(geometry: Float32Array);
|
|
4505
|
+
/** The mesh particles' first UV set, two values per vertex. */
|
|
4506
|
+
get instancingUVs(): Float32Array;
|
|
4507
|
+
set instancingUVs(uvs: Float32Array);
|
|
4508
|
+
/** The mesh particles' second UV set, read by textures on UV channel 1; see `UVChannel`. */
|
|
4509
|
+
get instancingUVs2(): Float32Array | undefined;
|
|
4510
|
+
set instancingUVs2(uvs: Float32Array | undefined);
|
|
4105
4511
|
get blending(): number;
|
|
4106
4512
|
set blending(blending: number);
|
|
4107
4513
|
get renderMode(): RenderMode;
|
|
@@ -4128,8 +4534,24 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
4128
4534
|
* renderer. 1 by default; saved in the effect JSON only when it differs.
|
|
4129
4535
|
*/
|
|
4130
4536
|
playbackSpeed: number;
|
|
4537
|
+
/**
|
|
4538
|
+
* Runtime multiplier on how many particles the system emits: bursts,
|
|
4539
|
+
* emission over time and over distance alike. Unlike
|
|
4540
|
+
* {@link setQualityFactor}, which only ever thins an effect, it may go
|
|
4541
|
+
* above 1 to make a stronger version of the same effect. The two multiply.
|
|
4542
|
+
* 1 by default; not saved in the effect JSON.
|
|
4543
|
+
*/
|
|
4544
|
+
emissionMultiplier: number;
|
|
4131
4545
|
/** What this system does while off screen, see {@link CullingMode}. `'always'` by default. */
|
|
4132
4546
|
cullingMode: CullingMode;
|
|
4547
|
+
/** What the emitter's world scale does to a world-space system, see {@link ScalingMode}. `'shape'` by default. */
|
|
4548
|
+
scalingMode: ScalingMode;
|
|
4549
|
+
/**
|
|
4550
|
+
* What world-space forces and speed limits are multiplied by this step:
|
|
4551
|
+
* the mean of the emitter's world scale axes in `'hierarchy'` mode, 1
|
|
4552
|
+
* otherwise. Updated before every simulation step.
|
|
4553
|
+
*/
|
|
4554
|
+
motionScale: number;
|
|
4133
4555
|
/**
|
|
4134
4556
|
* Whether each particle starts turned along the direction its shape sends
|
|
4135
4557
|
* it (Unity's Align To Direction): a mesh particle's +Z is pointed along
|
|
@@ -4195,6 +4617,8 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
4195
4617
|
play(): void;
|
|
4196
4618
|
stop(): void;
|
|
4197
4619
|
setQualityFactor(qualityFactor: number): void;
|
|
4620
|
+
/** Quality factor times {@link emissionMultiplier}: what emission counts are scaled by. */
|
|
4621
|
+
private emissionFactor;
|
|
4198
4622
|
/**
|
|
4199
4623
|
* Appends one particle to the pool, giving it the next row of the store.
|
|
4200
4624
|
*
|
|
@@ -4245,6 +4669,30 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
4245
4669
|
* frame behind the display.
|
|
4246
4670
|
*/
|
|
4247
4671
|
getWorldBounds(min: Vector3, max: Vector3): boolean;
|
|
4672
|
+
/**
|
|
4673
|
+
* Where a {@link RenderMode.Beam} system's quads end, see {@link BeamEnd}.
|
|
4674
|
+
* Unset (the default), a beam has no length and draws nothing. Not saved
|
|
4675
|
+
* in the effect JSON: it is where this instance is aimed at runtime.
|
|
4676
|
+
*/
|
|
4677
|
+
beamEnd?: BeamEnd;
|
|
4678
|
+
/**
|
|
4679
|
+
* Multiplies every particle's colour, alpha included, as it is drawn:
|
|
4680
|
+
* a colour or a fade driven from code for this instance (Unity's custom
|
|
4681
|
+
* per-instance data, Unreal's user parameters). With {@link erosion},
|
|
4682
|
+
* alpha is the erosion level, so this wipes the shape in and out. The
|
|
4683
|
+
* particles' own colours are untouched, so clearing it restores them, and
|
|
4684
|
+
* systems with different tints still batch together. Under additive
|
|
4685
|
+
* (`ALPHA_ONEONE`) or premultiplied blending, which ignore alpha, fade
|
|
4686
|
+
* with the colour instead, or with erosion on. Unset (the default): none.
|
|
4687
|
+
* Not saved in the effect JSON; copied by {@link clone}.
|
|
4688
|
+
*/
|
|
4689
|
+
tint?: Vector4;
|
|
4690
|
+
private readonly beamEndScratch;
|
|
4691
|
+
/** The world position of {@link beamEnd} into `out`; false when it is unset. */
|
|
4692
|
+
getBeamEnd(out: Vector3): boolean;
|
|
4693
|
+
/** The largest axis of the emitter's world scale. */
|
|
4694
|
+
private emitterMaxScale;
|
|
4695
|
+
private measureWorldBounds;
|
|
4248
4696
|
/**
|
|
4249
4697
|
* Records bounds a renderer measured in world space, for systems whose
|
|
4250
4698
|
* drawn extent the store does not hold (trail ribbons).
|
|
@@ -4337,6 +4785,7 @@ declare class ParticleSystem implements IParticleSystem {
|
|
|
4337
4785
|
[uuid: string]: Behavior;
|
|
4338
4786
|
}, scene?: Scene): ParticleSystem;
|
|
4339
4787
|
private static nextSerializationId;
|
|
4788
|
+
/** Normals facing +Z, one array per geometry so systems sharing it still batch together. */
|
|
4340
4789
|
private static createFallbackNormals;
|
|
4341
4790
|
private toRendererSettingsJSON;
|
|
4342
4791
|
private ensureGeometryMeta;
|
|
@@ -4587,6 +5036,22 @@ declare class QuarksUtil {
|
|
|
4587
5036
|
* Nodes that are neither transform nodes nor emitters are skipped.
|
|
4588
5037
|
*/
|
|
4589
5038
|
static instantiate(root: TransformNode, name?: string): TransformNode;
|
|
5039
|
+
/**
|
|
5040
|
+
* Seconds until the effect under `root` is over when it plays from the
|
|
5041
|
+
* start: for each system its start delay, its duration and its longest
|
|
5042
|
+
* particle life, divided by its playback speed; a sub emitter target goes
|
|
5043
|
+
* on emitting for its own duration after the last of its parents' particles
|
|
5044
|
+
* and ends a particle life after that, wherever it sits in the scene.
|
|
5045
|
+
* Infinity when a system loops, since such an effect only ends on
|
|
5046
|
+
* {@link endEmit}, or when one is frozen at playback speed 0.
|
|
5047
|
+
*
|
|
5048
|
+
* Random values count at their maximum, so this is an upper bound; curves
|
|
5049
|
+
* are sampled. Particles cut short by collisions or culling only make the
|
|
5050
|
+
* real effect shorter.
|
|
5051
|
+
*/
|
|
5052
|
+
static getDuration(root: Node): number;
|
|
5053
|
+
/** The largest value `generator` gives: exact for constants and intervals, sampled otherwise. */
|
|
5054
|
+
private static maxOf;
|
|
4590
5055
|
private static traverseNode;
|
|
4591
5056
|
}
|
|
4592
5057
|
|
|
@@ -4634,6 +5099,13 @@ declare class SpriteBatch extends VFXBatch {
|
|
|
4634
5099
|
private velocityVB?;
|
|
4635
5100
|
constructor(settings: VFXBatchSettings, scene: Scene);
|
|
4636
5101
|
setupBuffers(): void;
|
|
5102
|
+
/**
|
|
5103
|
+
* True when a mesh batch reads UV channel 1 and has a second UV set to
|
|
5104
|
+
* read it from, two values per vertex. A set of any other length is left
|
|
5105
|
+
* out with a warning, and channel 1 then reads the first set.
|
|
5106
|
+
*/
|
|
5107
|
+
private warnedUV2;
|
|
5108
|
+
private meshUV2;
|
|
4637
5109
|
/** Releases the instance vertex buffers so a resize does not leak GPU memory. */
|
|
4638
5110
|
private disposeExpandableBuffers;
|
|
4639
5111
|
private buildExpandableBuffers;
|
|
@@ -4688,8 +5160,20 @@ declare class SpriteBatch extends VFXBatch {
|
|
|
4688
5160
|
* optimised code on every frame.
|
|
4689
5161
|
*/
|
|
4690
5162
|
private syncStretchedSpeedFactor;
|
|
4691
|
-
/**
|
|
5163
|
+
/** Stretched billboards and beams: drawn along a per-instance vector, by the stretched shader. */
|
|
5164
|
+
private static drawsAlongVelocity;
|
|
5165
|
+
private readonly beamEnd_;
|
|
5166
|
+
/**
|
|
5167
|
+
* Writes, for the `count` instances from `first`, the world vector from
|
|
5168
|
+
* each one's drawn position to the system's beam end into the velocity
|
|
5169
|
+
* buffer, which the stretched shader under `BEAM` lays the quad along. A
|
|
5170
|
+
* beam without an end gets no length.
|
|
5171
|
+
*/
|
|
5172
|
+
private writeBeams;
|
|
5173
|
+
/** The quads that take a pivot and flip: every billboard kind, stretched included, but not meshes or beams. */
|
|
4692
5174
|
private static takesPivotAndFlip;
|
|
5175
|
+
/** Multiplies `count` RGBA colours starting at `base` by a system's {@link ParticleSystem.tint}. */
|
|
5176
|
+
private static applyTint;
|
|
4693
5177
|
/**
|
|
4694
5178
|
* Negates the size of each flipped particle along the axes it flips on,
|
|
4695
5179
|
* starting at `base` in `sizes`. The billboard shader scales the quad by
|
|
@@ -4759,6 +5243,8 @@ declare class TrailBatch extends VFXBatch {
|
|
|
4759
5243
|
private previousBuffer;
|
|
4760
5244
|
private nextBuffer;
|
|
4761
5245
|
private uvBuffer;
|
|
5246
|
+
/** UV channel 1: along the trail and across it, without the sheet's cell; only when a texture reads it. */
|
|
5247
|
+
private uv1Buffer;
|
|
4762
5248
|
private sideBuffer;
|
|
4763
5249
|
private widthBuffer;
|
|
4764
5250
|
private colorBuffer;
|
|
@@ -4787,6 +5273,12 @@ declare class TrailBatch extends VFXBatch {
|
|
|
4787
5273
|
* frame costs a matrix compose per system; checking the transform cache
|
|
4788
5274
|
* first makes a still emitter free.
|
|
4789
5275
|
*/
|
|
5276
|
+
/**
|
|
5277
|
+
* Writes a swept ribbon's vertex pair at `pi`: the sample at (x, y, z)
|
|
5278
|
+
* pushed `half` widths along its side (sx, sy, sz) one way for the first
|
|
5279
|
+
* vertex and the other way for the second.
|
|
5280
|
+
*/
|
|
5281
|
+
private writeSweptPair;
|
|
4790
5282
|
private static ensureWorldMatrix;
|
|
4791
5283
|
update(): void;
|
|
4792
5284
|
/**
|
|
@@ -4816,5 +5308,5 @@ declare class TrailBatch extends VFXBatch {
|
|
|
4816
5308
|
dispose(): void;
|
|
4817
5309
|
}
|
|
4818
5310
|
|
|
4819
|
-
export { ApplyCollision, ApplyForce, ApplySequences, AxisAngleGenerator, BatchedParticleRenderer, BatchedRenderer, BehaviorFromJSON, BehaviorTypes, Bezier, BoxEmitFrom, BoxEmitter, ChangeEmitDirection, CircleEmitter, ColorBySpeed, ColorGeneratorFromJSON, ColorOverLife, ColorRange, ConeEmitter, ConstantColor, ConstantValue, DEG2RAD, DonutEmitter, EdgeEmitter, EffectPool, EmitSubParticleSystem, EmitterFromJSON, EmitterMode, EmitterShapes, Euler, EulerGenerator, ForceOverLife, FrameOverLife, GeneratorFromJSON, Gradient, GravityForce, GridEmitter, HemisphereEmitter, InheritVelocity, IntervalValue, LimitSpeedOverLife, MathUtils, Matrix3, Matrix4, MeshSurfaceEmitter, MeshSurfaceEmitterPlugin, NodeParticle, Noise, OrbitOverLife, ParticleEmitter, ParticleMeshPhysicsMaterial, ParticleMeshStandardMaterial, ParticleStore, ParticleSystem, PiecewiseBezier, PiecewiseFunction, Plugins, PointEmitter, QuarksLoader, QuarksPrefab, QuarksUtil, Quaternion, QuaternionView, RAD2DEG, RandomColor, RandomColorBetweenGradient, RandomQuatGenerator, RecordState, RectangleEmitter, RenderMode, Rotation3DOverLife, RotationBySpeed, RotationGeneratorFromJSON, RotationOverLife, SequencerFromJSON, ShapeTransform, SizeBySpeed, SizeOverLife, SpeedOverLife, SphereEmitter, SpriteBatch, SpriteParticle, SubEmitterInheritMask, SubParticleEmitMode, TextureSequencer, TrailBatch, TrailParticle, TurbulenceField, VFXBatch, ValueGeneratorFromJSON, Vector2, Vector3, Vector3Function, Vector3GeneratorFromJSON, Vector3View, Vector4, Vector4View, VelocityOverLife, WebGLCoordinateSystem, WebGPUCoordinateSystem, WidthOverLength, cacheEnvAtlas, ceilPowerOfTwo, clamp, createEnvAtlasFromFaceUrls, createSeededRandom, cubeFaceUrls, damp, defaultMeshLighting, degToRad, denormalize, ensureEnvAtlasFromCube, euclideanModulo, floorPowerOfTwo, generateUUID, getCachedEnvAtlas, getPhysicsResolver, getRandomSource, getRegisteredShaderChunks, getShaderChunk, getValueFromEmitterMode, inverseLerp, isPowerOfTwo, lerp, loadPlugin, _default$7 as localParticlePhysicsVertShader, _default$6 as localParticleVertShader, mapLinear, meshRimEqual, normalize, normalizeMeshRim, _default$5 as particleFragShader, _default$4 as particlePhysicsFragShader, _default$3 as particleVertShader, pingpong, planBehaviorFusion, radToDeg, randFloat, randFloatSpread, randInt, random, registerShaderChunks, seededRandom, setPhysicsResolver, setQuaternionFromProperEuler, setRandomSource, smootherstep, smoothstep, _default$2 as stretchedBillboardVertShader, subEmitterInheritMask, _default$1 as trailFragShader, _default as trailVertShader, unloadPlugin, withRandomSource };
|
|
4820
|
-
export type { AdaptivePerformanceOptions, AdaptivePerformanceState, AnimationData, BabylonMetaData, BabylonParticleMaterialParameters, Behavior, BehaviorPlugin, BillBoardSettings, BoxEmitterParameters, BurstParameters, BurstParametersJSON, CircleEmitterParameters, ColorGenerator, ConeEmitterParameters, Constructable, CullingMode, DonutEmitterParameters, EdgeEmitterParameters, EffectPoolOptions, EmissionState, EmitterShape, EmitterShapePlugin, EulerOrder, FieldType, FunctionColorGenerator, FunctionJSON, FunctionValueGenerator, FusedPass, FusionStep, GeneratorMemory, GridEmitterParameters, HemisphereEmitterParameters, IAnimationData, IEmitter, IParticle, IParticleSystem, IPrefab, InheritVelocityMode, JsonMetaData, MeshLighting, MeshLightingSettings, MeshRim, MeshSettings, ParameterPair, ParameterType, Particle, ParticleSystemEvent, ParticleSystemEventType, ParticleSystemJSONParameters, ParticleSystemParameters, Plugin, QuarksBatchLoadOptions, QuarksJSONLoadEntry, QuarksLoaderOptions, QuarksResourceKind, QuarksResourceResolver, QuarksTimelineClip, RandomSource, RectangleEmitterParameters, RendererEmitterSettings, Resource, RotationGenerator, Sequencer, SerializationOptions, ShapeJSON, ShapeTransformJSON, SortMode, SphereEmitterParameters, StoredBatchSettings, StretchedBillBoardSettings, SubEmitterInheritance, TrailSettings, VFXBatchSettings, ValueGenerator, Vector3Generator, VelocityOverLifeSpace };
|
|
5311
|
+
export { ApplyCollision, ApplyForce, ApplySequences, AxisAngleGenerator, BatchedParticleRenderer, BatchedRenderer, BehaviorFromJSON, BehaviorTypes, Bezier, BoxEmitFrom, BoxEmitter, ChangeEmitDirection, CircleEmitter, ColorBySpeed, ColorGeneratorFromJSON, ColorOverLife, ColorRange, ConeEmitter, ConstantColor, ConstantValue, DEG2RAD, DonutEmitter, EdgeEmitter, EffectPool, EmitSubParticleSystem, EmitterFromJSON, EmitterMode, EmitterShapes, Euler, EulerGenerator, ForceOverLife, FrameOverLife, GRADIENT_MAP_WEIGHTS, GeneratorFromJSON, Gradient, GravityForce, GridEmitter, HemisphereEmitter, InheritVelocity, IntervalValue, LimitSpeedOverLife, MathUtils, Matrix3, Matrix4, MeshSurfaceEmitter, MeshSurfaceEmitterPlugin, NodeParticle, Noise, OrbitOverLife, ParticleEmitter, ParticleMeshPhysicsMaterial, ParticleMeshStandardMaterial, ParticleStore, ParticleSystem, PiecewiseBezier, PiecewiseFunction, Plugins, PointEmitter, QuarksLoader, QuarksPrefab, QuarksUtil, Quaternion, QuaternionView, RAD2DEG, RandomColor, RandomColorBetweenGradient, RandomQuatGenerator, RecordState, RectangleEmitter, RenderMode, Rotation3DOverLife, RotationBySpeed, RotationGeneratorFromJSON, RotationOverLife, SequencerFromJSON, ShapeTransform, SizeBySpeed, SizeOverLife, SpeedOverLife, SphereEmitter, SpriteBatch, SpriteParticle, SubEmitterInheritMask, SubParticleEmitMode, TextureSequencer, TrailBatch, TrailParticle, TurbulenceField, UV_DISTORTION_DEFAULT_UV, VFXBatch, ValueGeneratorFromJSON, Vector2, Vector3, Vector3Function, Vector3GeneratorFromJSON, Vector3View, Vector4, Vector4View, VelocityOverLife, WebGLCoordinateSystem, WebGPUCoordinateSystem, WidthOverLength, cacheEnvAtlas, ceilPowerOfTwo, clamp, createEnvAtlasFromFaceUrls, createSeededRandom, cubeFaceUrls, damp, defaultMeshLighting, degToRad, denormalize, ensureEnvAtlasFromCube, erosionEqual, euclideanModulo, floorPowerOfTwo, generateUUID, getCachedEnvAtlas, getPhysicsResolver, getRandomSource, getRegisteredShaderChunks, getShaderChunk, getValueFromEmitterMode, gradientMapEqual, inverseLerp, isPowerOfTwo, lerp, loadPlugin, _default$7 as localParticlePhysicsVertShader, _default$6 as localParticleVertShader, mapLinear, mapUVEqual, meshRimEqual, normalize, normalizeErosion, normalizeGradientMap, normalizeMapUV, normalizeMeshRim, normalizeTextureUV, normalizeUVDistortion, _default$5 as particleFragShader, _default$4 as particlePhysicsFragShader, _default$3 as particleVertShader, pingpong, planBehaviorFusion, radToDeg, randFloat, randFloatSpread, randInt, random, readsUV1, registerShaderChunks, seededRandom, setPhysicsResolver, setQuaternionFromProperEuler, setRandomSource, smootherstep, smoothstep, _default$2 as stretchedBillboardVertShader, subEmitterInheritMask, textureUVEqual, textureUVToJSON, _default$1 as trailFragShader, _default as trailVertShader, unloadPlugin, uvDistortionEqual, withRandomSource };
|
|
5312
|
+
export type { AdaptivePerformanceOptions, AdaptivePerformanceState, AnimationData, BabylonMetaData, BabylonParticleMaterialParameters, BeamEnd, Behavior, BehaviorPlugin, BillBoardSettings, BoxEmitterParameters, BurstParameters, BurstParametersJSON, CircleEmitterParameters, ColorGenerator, ConeEmitterParameters, Constructable, CullingMode, DonutEmitterParameters, EdgeEmitterParameters, EffectPoolOptions, EmissionState, EmitterShape, EmitterShapePlugin, EulerOrder, FieldType, FrameOverLifeOptions, FunctionColorGenerator, FunctionJSON, FunctionValueGenerator, FusedPass, FusionStep, GeneratorMemory, GradientMapChannel, GridEmitterParameters, HemisphereEmitterParameters, IAnimationData, IEmitter, IParticle, IParticleSystem, IPrefab, InheritVelocityMode, JsonMetaData, MeshLighting, MeshLightingSettings, MeshRim, MeshSettings, ParameterPair, ParameterType, Particle, ParticleErosion, ParticleErosionOptions, ParticleGradientMap, ParticleSystemEvent, ParticleSystemEventType, ParticleSystemJSONParameters, ParticleSystemParameters, ParticleUVDistortion, ParticleUVDistortionOptions, Plugin, QuarksBatchLoadOptions, QuarksJSONLoadEntry, QuarksLoaderOptions, QuarksResourceKind, QuarksResourceResolver, QuarksTimelineClip, RandomSource, RectangleEmitterParameters, RendererEmitterSettings, Resource, RotationGenerator, ScalingMode, Sequencer, SerializationOptions, ShapeJSON, ShapeTransformJSON, SortMode, SphereEmitterParameters, StoredBatchSettings, StretchedBillBoardSettings, SubEmitterInheritance, TextureUV, TrailSettings, UVChannel, VFXBatchSettings, ValueGenerator, Vector3Generator, VelocityOverLifeSpace };
|