An open API service indexing awesome lists of open source software.

https://github.com/erasin/bevy_vox

Load MagicaVoxel Vox file for bevy engine.
https://github.com/erasin/bevy_vox

bevy bevy-plugin

Last synced: 9 months ago
JSON representation

Load MagicaVoxel Vox file for bevy engine.

Awesome Lists containing this project

README

          

Load MagicaVoxel Vox file for [bevy](https://github.com/bevyengine/bevy/) engine.

| bevy_vox | bevy |
| -------- | ----- |
| follow | >=0.15|
| 0.10 | 0.14 |

**Example**

```rust
use bevy::prelude::*;
use bevy_vox::VoxPlugin;

fn main() {
App::new()
.add_plugins(DefaultPlugins)
.add_plugins(VoxPlugin { swap_yz: true })
.insert_resource(AmbientLight {
color: Color::WHITE,
brightness: 0.5,
})
.add_systems(Startup, setup)
.add_systems(Update, rotate_model)
.run();
}

#[derive(Component)]
struct VoxModel;

fn setup(mut commands: Commands, asset_server: Res) {
// add entities to the world
commands.spawn((
SceneRoot(asset_server.load("2x2x2.vox")),
Transform::from_xyz(-1.0, 0.0, 0.0),
VoxModel,
));

// light
commands.spawn((
PointLight {
intensity: 3_000_000.0,
..Default::default()
},
Transform::from_xyz(3.0, -3.5, 4.5),
));

// camera
commands.spawn((
Camera3d::default(),
Transform::from_xyz(6.0, -6.0, 6.0).looking_at(Vec3::ZERO, Vec3::Y),
));
}

fn rotate_model(mut query: Query<&mut Transform, With>, time: Res