1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
//! Volumetric snow on [`bevy_isomesh`] voxel volumes (feature `isomesh`). The snow maps of the
//! ground cover run on a heightfield, so a voxel volume gets one of its own: [`VoxelGround`]
//! scans the top of every column of a `VoxelVolume` and spawns a crate-internal
//! [`Terrain`](crate::Terrain) with [`TerrainRender::External`](crate::TerrainRender::External)
//! over the volume's XZ extent whose heights are those tops. Hydrology, snow, wetness, wind and
//! rain then run on it unchanged, and [`SnowyField`] puts the snow depth back into the volume
//! as a slab over the column tops, so the mesh grows a snow cap and a tunnel under the hill
//! stays dark. See `docs/research/voxel-snow.md`.
//!
//! [`VoxelSnow`] puts the same slab on any number of volumes without a terrain, from the cover
//! map of a terrain under them or the point snowpack (`docs/research/voxel-volumes.md`).
//!
//! The frame: the user's edit systems, then [`VoxelGroundSystems`] (the first scan, the edit
//! pass, the snow swap), then bevy_isomesh's `IsomeshSystems`: anything the ground marks
//! `NeedsRemesh` is meshed in the same frame, once, against the new field.
pub
use *;
use IsomeshSystems;
pub use SnowyField;
use ;
use crateGroundCoverPlugin;
use crateHydrologyPlugin;
use crateElementsSystems;
use crateTerrainPlugin;
/// Snow, wetness and hydrology for a `VoxelVolume`: put it on the volume's entity.
///
/// The volume keeps its own `field`; this crate wraps it in a [`SnowyField`] and swaps that in
/// as the snow changes, so every edit to the base field made through
/// [`VoxelVolume::replace_field`](bevy_isomesh::VoxelVolume::replace_field) is seen (it must be
/// ordered `.before(`[`VoxelGroundSystems`]`)` together with the `NeedsRemesh` marks of the
/// chunks it changed).
///
/// A volume with a `VoxelGround` owns the crate's [`Terrain`](crate::Terrain): spawn no other
/// (one terrain exists at a time) and no second `VoxelGround`. Its grid covers the volume's
/// chunk entities as they are at the first scan; chunks that appear later outside that box get
/// no snow. The chunk entities need identity transforms and no parent offset (field space is
/// world space), and the voxel cell size must be a power of two, as isomesh requires. The field is
/// in world units ([`ElementsUnits`](crate::ElementsUnits)): the terrain the crate spawns under
/// it has its extent and heights in metres (the field's divided by the units), and the snow is
/// laid on the slab in world units.
///
/// [`ErosionSettings::enabled`](crate::ErosionSettings) is ignored for voxel ground (one
/// warning is logged when it is on): the volume's field is the truth and erosion would rewrite
/// only the heightfield under it. Water still flows, and snow, wetness and rain run as on any
/// terrain.
///
/// A ground material on the volume's meshes must gate its snow and wetness by depth below the
/// column top, or a tunnel's walls are shaded white wherever the map above them has snow: see
/// [`GroundExtension::with_column_gate_m`](crate::GroundExtension::with_column_gate_m).
/// A snow slab on a `VoxelVolume` that is not the ground: put it on any number of volumes (walls,
/// rocks, ruins over a game's own ground). It spawns no terrain and runs no hydrology.
///
/// Each column's depth is the ground-cover map's at the column's world position where a
/// [`Terrain`](crate::Terrain) with [`GroundCoverPlugin`] covers it (so a wall under a
/// [`PrecipitationBlocker`](crate::PrecipitationBlocker) roof stays bare, and the walls melt
/// with the ground), and elsewhere the point snowpack of
/// [`SurfaceWeathering`](crate::SurfaceWeathering) (exposed flat ground), times the shed-slope
/// exposure of the column's top ([`SnowSettings::shed_slope_deg`](crate::SnowSettings)). The
/// slab, the per-column hold, the edit rescans and the field swaps are [`VoxelGround`]'s; the
/// columns are one per voxel over the volume's chunk entities at the first scan (wider, by
/// doubling, past [`ElementsQuality::terrain_max_resolution`](crate::ElementsQuality) a side).
///
/// The chunk entities are children of the volume (as bevy_isomesh documents), so the volume's
/// transform places them; it may translate, turn about the vertical and scale uniformly. A
/// tilted or unevenly scaled volume gets no snow (one warning). A volume with a `VoxelGround`
/// too is a voxel ground. See `docs/research/voxel-volumes.md`.
;
/// The systems that scan, edit and swap the snow of [`VoxelGround`] and [`VoxelSnow`] volumes.
/// Ordered after [`ElementsSystems::Readback`] (they read the snow map's readback) and before
/// bevy_isomesh's `IsomeshSystems`.
///
/// A system that edits a volume's field or marks its chunks `NeedsRemesh` orders itself
/// `.before(VoxelGroundSystems)`: the ground sees the edit in the frame it is made and rescans
/// the column tops under the marked chunks before they are meshed.
;
/// Snow on voxel volumes: see [`VoxelGround`] and [`VoxelSnow`]. Added by
/// [`ElementsPlugins`](crate::ElementsPlugins) with the feature `isomesh`; it does not add
/// bevy_isomesh's `IsomeshPlugin` (the consumer does). `VoxelGround` needs [`TerrainPlugin`],
/// [`HydrologyPlugin`] and [`GroundCoverPlugin`] to have been added before it, and idles with a
/// warning otherwise; `VoxelSnow` runs without them.
;
/// The set's place in the frame.
/// The systems, apart from the plugins they need (the unit tests add them to a bare app).
/// The `VoxelSnow` systems alone, for an app without the terrain, hydrology and cover plugins.