#bevy #mesh #voxel #magicavoxel #bevy-engine #magica-voxel #vox #asset-loader

bevy_vox_mesh

A bevy engine plugin for loading magica voxel files directly in bevy as usable meshes

6 releases (breaking)

0.6.0 Mar 7, 2023
0.5.0 Dec 6, 2022
0.4.0 Jul 31, 2022
0.3.0 Jun 13, 2021
0.1.0 Apr 8, 2021

#496 in Game dev

Download history 9/week @ 2023-01-27 14/week @ 2023-02-03 20/week @ 2023-02-10 19/week @ 2023-02-17 4/week @ 2023-02-24 24/week @ 2023-03-03 17/week @ 2023-03-10 5/week @ 2023-03-17 13/week @ 2023-03-24 9/week @ 2023-03-31 36/week @ 2023-04-07 6/week @ 2023-04-14 7/week @ 2023-04-21 8/week @ 2023-04-28 20/week @ 2023-05-05 16/week @ 2023-05-12

53 downloads per month

MIT license

26KB
190 lines

bevy_vox_mesh

A plugin for the bevy engine which allows loading magica voxel .vox files directly into usable meshes. This uses mesh vertex coloring.

Bevy compatibility

Bevy version Plugin version
0.5 0.1, 0.2
0.8 0.4
0.9 0.5
0.10 0.6

Usage

demo screenshot


use bevy::prelude::*;
use bevy_vox_mesh::VoxMeshPlugin;
use std::f32::consts::PI;

fn main() {
    App::default()
        .add_plugins(DefaultPlugins)
        .add_plugin(VoxMeshPlugin::default())
        .add_startup_system(setup)
        .run();
}

fn setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut stdmats: ResMut<Assets<StandardMaterial>>,
    assets: Res<AssetServer>,
) {
    commands.spawn(Camera3dBundle {
        transform: Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
        ..Default::default()
    });

    commands.spawn(PbrBundle {
        transform: Transform::from_scale((0.01, 0.01, 0.01).into())
            * Transform::from_rotation(Quat::from_axis_angle(Vec3::Y, PI)),
        mesh: assets.load("chicken.vox"),
        material: stdmats.add(Color::rgb(1., 1., 1.).into()),
        ..Default::default()
    });
}



Take a look in the examples/ directory for a complete working example.

Acknowledgements

This asset loader is powered by the awesome block-mesh-rs crate.

Dependencies

~22–59MB
~1M SLoC