Releases: splashdust/bevy_voxel_world
Releases · splashdust/bevy_voxel_world
0.5.0
Adds support for multiple parallell world instances
Breaking changes:
Configuration is now supplied when adding the plugin
// First declare a config struct. It needs to derive `Resource`, `Clone` and `Default`
#[derive(Resource, Clone, Default)]
struct MyWorld;
// Then implement the `VoxelWorldConfig` trait for it:
impl VoxelWorldConfig for MyWorld {
// All the trait methods have defaults, so you only need to add the ones you want to alter
fn spawning_distance(&self) -> u32 {
15
}
}
Then when adding the plugin:
.add_plugins(VoxelWorldPlugin::with_config(MyWorld))
If you don't want to change any default config, you can simply do this:
.add_plugins(VoxelWorldPlugin::default())
Adding multiple worlds follows the same pattern. Just create different configuration structs and add a VoxelWorldPlugin
for each.
.add_plugins(VoxelWorldPlugin::with_config(MyOtherWorld))
Each world instance can have it's own configuration and will keep track of it's own set of voxel data and chunks.
The VoxelWorld
system param now needs a type parameter to specify which world instance you want to select
The configuration struct adds the config values and its type also acts as a marker for the world instance.
fn my_system(
my_voxel_world: VoxelWorld<MyWorld>,
my_other_voxel_world: VoxelWorld<MyOtherWorld>
) {
// Set a voxel in `my_voxel_world`
my_voxel_world.set_voxel(pos, WorldVoxel::Solid(voxel_type))
// Set a voxel in `my_other_voxel_world`
my_other_voxel_world.set_voxel(pos, WorldVoxel::Solid(voxel_type))
}
If you initialized the plugin with ::default()
, you still need to explicitly specify the instance as DefaultWorld
:
fn my_system(voxel_world: VoxelWorld<DefaultWorld>) { ... }
The VoxelWorldRaycast
system param now also requires the same config type paramter as described above.
0.4.0
- Update to Bevy 0.13
0.3.6
- Fix some issues with ray casting
0.3.5
- Add support for using custom Bevy materials. This makes it easy to use custom shaders with
bevy_voxel_world
. - Add a built-in method for ray casting into the world. Usefull if you want to know which voxe is under the mouse cursor for instance.
0.3.4
0.3.3
0.3.2
- Performance improvements:
- More granular resources for more parallelization opportunities.
- Pre-calculate hash for voxels array for faster mesh cache lookups
- Buffered iserts/updates and removes for ChunkMap, to reduce time spent waiting to aquire RwLock.
0.3.1
- Add lookup map for mesh handles. This allows
bevy_voxel_world
to re-use mesh handles for identical chunks and thereby utilising Bevy's automatic instancing while also avoiding redundant meshing. - Change the default chunk discovery algorith to only use ray casting. This uses less CPU than the previous flood fill method, and also works with larger spawn distances. The flood fill method can still be used by setting
ChunkSpawnStrategy::Close
- Add various config options for tuning spawning behaviour for different needs.
0.3.0
- Update to Bevy 0.12
0.2.2
- Fix an issue where filled underground chunks would never get meshed, even if they were modified
ChunkWillSpawn
event now only fire when actually meshed chunks spawn, preventing massive spam of this event.