2个不稳定版本
1.0.0 |
|
---|---|
0.2.0 | 2022年9月2日 |
0.1.0 | 2022年9月2日 |
#1047 在 游戏开发
2MB
446 代码行
Billow
Rust实现的波函数坍缩算法。基于Oskar Stålberg和Martin Donald的详细解释。
🚧 这是一个进行中的作品。
用法
这是一个通用库,我提供了对image::DynamicImage
和bevy::prelude::Image
类型的实现。
use billow::Wave;
use image::DynamicImage;
fn main() {
let input: Vec<DynamicImage> = load_assets("assets/basic");
let (width, height) = (20usize, 20usize);
// New wave with a 20x20 grid
let mut wave = Wave::new(input, width, height);
// Populate the grid and choose a random starting point
wave.initialize()
// Run the algorithm.
// This will try to collapse the grid to a single state.
// `100` is the number of iterations.
// each iteration will collapse one cell and try to propagate the changes.
wave.collapse(100).expect("Failed to collapse");
}
更多内容请参阅示例。
依赖项
~13–30MB
~282K SLoC