Skip to main content

Crate bevy_cube_marcher

Crate bevy_cube_marcher 

Source
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§

cpu
gpu

Structs§

Chunk
Marker component for each chunk.
ChunkGenSystems
SystemSet for chunk generation systems.
ChunkGenerated
ChunkGeneratorCache
Holds the loading states of all the chunks.
ChunkGeneratorSettings
Settings for a chunk generator. Also controls whether said generator is running.
ChunkLoader
Loads nearby chunks.
ChunkMaterial
Holds the actual material chunks should be spawned with.

Enums§

ChunkGeneratorRunning
Controls for whether the generator should be running.
LoadState
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.