babylon.quarks 0.19.0 → 0.20.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 +57 -0
- package/README.md +22 -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 +324 -13
- package/package.json +1 -1
- package/src/BatchedRenderer.ts +16 -2
- package/src/MeshSurfaceEmitter.ts +10 -4
- package/src/ParticleSystem.ts +124 -1
- package/src/QuarksLoader.ts +150 -4
- package/src/SpriteBatch.ts +75 -4
- package/src/TrailBatch.ts +24 -13
- package/src/VFXBatch.ts +4 -1
- package/src/shaders/particle_vert.glsl.ts +20 -0
- package/src/shaders/particle_vert.wgsl.ts +21 -1
- package/src/shaders/stretched_bb_particle_vert.glsl.ts +18 -5
- package/src/shaders/stretched_bb_particle_vert.wgsl.ts +19 -6
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,63 @@ All notable changes to the `babylon.quarks` package are documented here.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
5
5
|
and the project follows the `quarks.core` 0.x version line.
|
|
6
6
|
|
|
7
|
+
## [0.20.0] — 2026-10-16
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `ParticleSystem.maxParticles` (optional, no limit when unset) caps how many particles a system
|
|
12
|
+
keeps alive, like Unity's Max Particles: emission past the cap is dropped rather than queued.
|
|
13
|
+
Saved in the effect JSON only when set.
|
|
14
|
+
- quarks.core `BoxEmitter` (`box`) emits from the volume, faces or edges of a box, with an
|
|
15
|
+
optional per-axis thickness, moving particles along +Z; a box with no depth is a flat rectangle.
|
|
16
|
+
`EdgeEmitter` (`edge`) emits from a line along X, moving particles along +Y. Both match the
|
|
17
|
+
Unity shapes of the same name.
|
|
18
|
+
|
|
19
|
+
- Trail settings `uvFromHead`, `colorFromParticle`, `dieWithParticle` and `recordWorldSpace`
|
|
20
|
+
(all optional, off by default) for trails that behave like Unity's: the texture runs from the
|
|
21
|
+
particle back to the tail, the whole trail takes the particle's current color, the trail
|
|
22
|
+
disappears the moment its particle dies, and a local-space system lays its trail points down in
|
|
23
|
+
world space so they streak behind a moving emitter. Saved in the effect JSON only when switched
|
|
24
|
+
on.
|
|
25
|
+
- Emitter shapes take an optional local `transform` (`ShapeTransform`: position, rotation
|
|
26
|
+
quaternion, scale) like the Position / Rotation / Scale of Unity's Shape module. The spawn point
|
|
27
|
+
goes through scale, rotation and offset, and the start direction through scale and rotation
|
|
28
|
+
without changing the start speed. Every `quarks.core` shape and `MeshSurfaceEmitter` support
|
|
29
|
+
it; the shape JSON gets a `transform` entry only when one is set.
|
|
30
|
+
- `ParticleSystem.pivot` (Unity's renderer Pivot): offsets billboard and stretched billboard quads
|
|
31
|
+
from their particle, in particle-size units. Billboards turn the offset with the particle and
|
|
32
|
+
move it toward the camera by z (up, for horizontal billboards); stretched billboards measure x
|
|
33
|
+
from head to tail and y across. Systems with different pivots batch separately; the shaders
|
|
34
|
+
only compile it in (`PIVOT`) when a pivot is set.
|
|
35
|
+
- `ParticleSystem.flip` (Unity's renderer Flip): the fraction of billboard and stretched billboard
|
|
36
|
+
particles whose texture is mirrored along U and V, picked per particle at birth.
|
|
37
|
+
- Both are saved in the effect JSON (`pivot: [x, y, z]`, `flip: [u, v]`) only when non-zero, and
|
|
38
|
+
carried by `clone()`.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- `QuarksLoader` shares one `Texture` per scene between every effect that uses the same image with
|
|
43
|
+
the same sampling, and one copy of identical mesh geometry. The renderer only batches systems
|
|
44
|
+
that share these objects, so each loaded effect used to get batches of its own: 661 Epic Toon
|
|
45
|
+
FX combat effects loaded together drew 2,577 batches, and draw 180 now. Turn it off per loader
|
|
46
|
+
with `shareResources: false`; `QuarksLoader.clearSharedResources(scene)` forgets the shared set.
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- `PiecewiseBezier` and `Gradient` (`quarks.core`) resampled their 257-point lookup tables on
|
|
51
|
+
every refresh, which runs every simulation step for every behavior using them. The "unchanged"
|
|
52
|
+
check compared the control points against a `Float32Array` copy, and any value float32 can't
|
|
53
|
+
hold exactly (0.2, 0.3, …) never compared equal. With such curves, 1,000 systems took 22.9 ms
|
|
54
|
+
per frame and now take 12.7 ms.
|
|
55
|
+
- An idle sprite batch uploaded its cleared instance (five or six vertex buffer updates) on every
|
|
56
|
+
frame; it now does so once each time it goes empty. Systems with no particles are skipped when
|
|
57
|
+
the batch is filled, and the emitter's matrix is only fully decomposed for local-space mesh
|
|
58
|
+
particles.
|
|
59
|
+
- A trail texture now reaches the end of the ribbon on frames that draw no live tip (with
|
|
60
|
+
`followLocalOrigin`, while paused, or exactly on a simulation step). The newest recorded sample
|
|
61
|
+
stopped one segment short of the texture's end, which cut the end of the texture off and made
|
|
62
|
+
it pop in and out as the tip came and went.
|
|
63
|
+
|
|
7
64
|
## [0.17.9] — 2026-07-14
|
|
8
65
|
|
|
9
66
|
### Fixed
|
package/README.md
CHANGED
|
@@ -134,6 +134,28 @@ await engine.initAsync();
|
|
|
134
134
|
|
|
135
135
|
All render modes (billboard, stretched billboard, mesh, trail) are validated to create WebGPU pipelines with zero validation errors. The [live demos](https://soullnik.github.io/babylon.quarks-standalone/) and the [benchmark page](https://soullnik.github.io/babylon.quarks-standalone/benchmark.html) accept `?engine=webgpu` in the URL to switch engines.
|
|
136
136
|
|
|
137
|
+
## Unity-style emitter options
|
|
138
|
+
|
|
139
|
+
A few optional settings mirror Shuriken so Unity exports look the same; all are off by default and
|
|
140
|
+
only written to the effect JSON when set.
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import {ConeEmitter, Quaternion, ShapeTransform, Vector2, Vector3} from 'quarks.core';
|
|
144
|
+
|
|
145
|
+
const system = new ParticleSystem({
|
|
146
|
+
// Shape module Position / Rotation / Scale: spawn points and start directions go through it.
|
|
147
|
+
shape: new ConeEmitter({
|
|
148
|
+
radius: 0.5,
|
|
149
|
+
transform: new ShapeTransform(new Vector3(0, 1, 0), new Quaternion(), new Vector3(2, 1, 1)),
|
|
150
|
+
}),
|
|
151
|
+
// Renderer Pivot, in particle-size units (billboards and stretched billboards).
|
|
152
|
+
pivot: new Vector3(0, 0.5, 0),
|
|
153
|
+
// Renderer Flip: mirror the texture of 50% of particles along U.
|
|
154
|
+
flip: new Vector2(0.5, 0),
|
|
155
|
+
// ...
|
|
156
|
+
});
|
|
157
|
+
```
|
|
158
|
+
|
|
137
159
|
## Author & load effects
|
|
138
160
|
|
|
139
161
|
Design an effect with one of these tools, then load the exported JSON with `QuarksLoader`:
|