1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
//! Plain content policies available without optional text or particle preparation.
/// Paragraph alignment, with start/end resolved by the paragraph direction.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum TextAlignment {
/// Follow paragraph start.
#[default]
Start,
/// Follow paragraph end.
End,
/// Center each line within the requested width.
Center,
/// Justify nonfinal lines.
Justified,
}
/// Units used for visibility and per-part animation.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum TextSplit {
/// Extended Unicode grapheme clusters, not scalar chars.
#[default]
Characters,
/// Unicode words, with separators attached to the preceding word.
Words,
/// Wrapped visual lines.
Lines,
}
/// Curated, independently configurable particle recipes.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum Preset {
/// Tapered HDR ballistic burst.
Sparks,
/// Cooling, upward-moving glowing embers.
Embers,
/// Slow depth-aware dust.
Dust,
/// Soft floating motes.
Motes,
/// Three parallax depth layers of wind-driven snow.
Snow,
/// Stretched rain with collision-triggered splashes.
Rain,
/// Expanding procedural smoke sprites.
Smoke,
/// Buoyant procedural fire cores.
Fire,
/// Flipping, colored falling quads.
Confetti,
/// Rocket death, spark burst, then secondary spark deaths.
Fireworks,
/// Drifting and breathing light points.
Fireflies,
/// Color-preserving vector surface dispersal.
LogoDissolve,
/// Color-preserving vector surface convergence.
LogoAssemble,
}
/// Scalar coordinate used by a particle color field.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum FieldCoordinate {
/// Horizontal position.
X,
/// Vertical position.
Y,
/// Velocity magnitude.
Speed,
}
/// Bounded normal restitution and tangential friction.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(deny_unknown_fields))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct CollisionResponse {
/// Normal velocity restitution in 0..=1.
pub restitution: f32,
/// Fraction of tangential velocity removed in 0..=1.
pub friction: f32,
/// Remove the particle at its first contact.
pub kill_on_hit: bool,
}
impl Default for CollisionResponse {
fn default() -> Self {
Self {
restitution: 1.0,
friction: 0.0,
kill_on_hit: false,
}
}
}
/// Fixed-boundary particle event.
#[derive(Clone, Copy, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum ParticleEventKind {
/// First admission of a live particle.
Birth,
/// Half-open lifetime expiry, including kill-on-hit.
Death,
/// Geometric or population contact.
Collision,
/// Age threshold in seconds, reported at its first simulation boundary.
AgeReached(f32),
}
/// Parent properties added to an emitter's local child record.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum Inherit {
/// Keep emitter-authored values.
None,
/// Translate local emission to the event location.
#[default]
Position,
/// Translate and add parent velocity.
Velocity,
/// Translate and multiply parent premultiplied color.
Color,
/// Translate, add velocity and inherit color.
All,
}