Expand description
A shader-based marching cubes implementation for Bevy.
To get started, add the [MarchingCubesPlugin] to your app.
The plugin takes a type argument similar to a Bevy material, [ChunkComputeShader].
The [ShaderRef] provided by this type is a wgsl compute shader that takes a coordinate and returns the density of the chunk’s mass at that point,
generally with positive values representing being inside the mass and negative values being in air,
although the threshold can be configured with ChunkGeneratorSettings.
See this example asset for more details.
The plugin also takes a type argument implementing [GpuExtraBufferCache], defining additional buffers to be used in the density sampler.
This example
uses this to determine the final position of a Point Of Interest based on terrain generation.
ChunkGeneratorSettings must be inserted.
ChunkMaterial must be inserted.
An entity must also be given ChunkLoader to start generating any chunks.
Modules§
Structs§
- Chunk
- Marker component for each chunk.
- Chunk
GenSystems SystemSetfor chunk generation systems.- Chunk
Generated - Chunk
Generator Cache - Holds the loading states of all the chunks.
- Chunk
Generator Settings - Settings for a chunk generator. Also controls whether said generator is running.
- Chunk
Loader - Loads nearby chunks.
- Chunk
Material - Holds the actual material chunks should be spawned with.
Enums§
- Chunk
Generator Running - Controls for whether the generator should be running.
- Load
State - Whether a chunk is loading or has finished loading.
Functions§
- is_
generator_ running - Run condition for whether a chunk generator is running and listening to
ChunkLoaders, regardless of whether it’s actually generating anything.