#voxel #magica-voxel #game #bevy

bevy_vox

Load MagicaVoxel Vox file for bevy engine

9 releases (breaking)

0.8.1 Nov 16, 2023
0.8.0 Oct 9, 2022
0.7.0 Mar 17, 2023
0.6.0 Nov 14, 2022
0.2.0 Nov 4, 2020

#434 in Game dev

Download history 15/week @ 2023-10-31 2/week @ 2023-11-07 41/week @ 2023-11-14 13/week @ 2023-11-21 34/week @ 2023-11-28 13/week @ 2023-12-05 4/week @ 2023-12-12 11/week @ 2023-12-19 23/week @ 2023-12-26 3/week @ 2024-01-02 11/week @ 2024-01-09 8/week @ 2024-01-23 40/week @ 2024-01-30 3/week @ 2024-02-06 51/week @ 2024-02-13

102 downloads per month

MIT license

27KB
149 lines

Load MagicaVoxel Vox file for bevy engine.

bevy_vox bevy
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 { samples: 4 })
        .add_plugins(DefaultPlugins)
        .insert_resource(AmbientLight {
            color: Color::WHITE,
            brightness: 0.5,
        })
        .add_plugin(VoxPlugin::default())
        .add_startup_system(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 {
        transform: Transform::from_xyz(3.0, 1.2, 2.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

~43–84MB
~1.5M SLoC