bevy_heightmap

Crates.iobevy_heightmap
lib.rsbevy_heightmap
version
sourcesrc
created_at2024-07-15 06:19:17.945409
updated_at2024-12-01 01:47:28.68003
descriptionCreate meshes from heightmap PNGs in the Bevy game engine.
homepagehttps://github.com/Katsutoshii/bevy_heightmap
repositoryhttps://github.com/Katsutoshii/bevy_heightmap
max_upload_size
id1303528
Cargo.toml error:TOML parse error at line 19, column 1 | 19 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
Josiah Putman (Katsutoshii)

documentation

https://docs.rs/bevy_heightmap/latest/bevy_heightmap

README

bevy_heightmap

License Crates.io Docs

Load height map PNGs as meshes in bevy.

Height map Generated
example_image example_image

Usage

Create a height map from a value function:

use bevy::prelude::*;
use bevy_heightmap::*;
let heightmap = HeightMap {
  size: UVec2::new(10, 10),
  h: |p: Vec2| ((20. * p.x).sin() + (20. * p.y).sin()) / 2.
};
let mesh: Mesh = heightmap.into();
assert_eq!(mesh.count_vertices(), 4 * 10 * 10);

Load a height map as a mesh from an image (requires .hmp.png extension):

use bevy::prelude::*;
use bevy_heightmap::*;
fn setup(asset_server: Res<AssetServer>) {
    let mesh: Handle<Mesh> = asset_server.load("textures/terrain.hmp.png");
}

Examples

cargo run --example image

Bevy support table

bevy bevy_heightmap
0.15 0.3.0
0.14 0.2.0
0.13 0.1.0
Commit count: 13

cargo fmt