#bevy #magica-voxel #voxel #game

bevy_vox

Load MagicaVoxel Vox file for bevy engine

8 breaking releases

0.9.0 Mar 16, 2024
0.8.1 Nov 16, 2023
0.8.0 Oct 9, 2022
0.7.0 Mar 17, 2023
0.2.0 Nov 4, 2020

#308 in Game dev

Download history 28/week @ 2024-02-16 12/week @ 2024-02-23 2/week @ 2024-03-08 167/week @ 2024-03-15 10/week @ 2024-03-22 63/week @ 2024-03-29 14/week @ 2024-04-05

254 downloads per month

MIT license

29KB
149 lines

Load MagicaVoxel Vox file for bevy engine.

bevy_vox bevy
0.9 0.13
0.8 0.12
0.7 0.10
0.6 0.9
0.5 0.8
0.4 0.6
0.3 0.5
0.2 0.4

Example

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

fn main() {
    App::new()
        .insert_resource(Msaa::Sample4)
        .add_plugins(DefaultPlugins)
        .add_plugins(VoxPlugin::default())
        .insert_resource(AmbientLight {
            color: Color::WHITE,
            brightness: 0.5,
        })
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    // add entities to the world
    commands.spawn(SceneBundle {
        scene: asset_server.load("2x2x2.vox"),
        transform: Transform::from_xyz(0.0, 0.0, 0.0),
        ..default()
    });

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

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

Dependencies

~40–81MB
~1M SLoC