Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/game4all/bevy_vox_mesh

A bevy engine plugin for loading magica voxel files directly in bevy as usable meshes.
https://github.com/game4all/bevy_vox_mesh

asset-loader bevy bevy-engine magicavoxel voxel

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        


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 |
| 0.11 | 0.7, 0.7.1 |
| 0.12 | 0.8 |

## Usage

![demo screenshot](https://raw.githubusercontent.com/Game4all/bevy_vox_mesh/master/assets/screenshot.PNG)

```rust

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>,
mut stdmats: ResMut>,
assets: Res,
) {
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`](https://github.com/bonsairobo/block-mesh-rs) crate.

Ported to bevy 0.12.0 thanks to @baranyildirim.