yawfc 0.1.0

Yet another wave function collapse implementation
Documentation
  • Coverage
  • 75%
    12 out of 16 items documented0 out of 1 items with examples
  • Size
  • Source code size: 61.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.41 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • 10maurycy10/wfc
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • 10maurycy10

Yet Another Wave Function Collapse implementation

This is an unfinished pure rust implantation of the Wave Function Collapse Algorithm.

Example usage:

use image::io::Reader as ImageReader;
use image::RgbImage;
use yawfc::overlapping::overlapping;

let generated_size = 30;

// Read the example image
let img = ImageReader::open("in.png").unwrap().decode().unwrap().to_rgb8();
let img:Vec<Vec<_>> = img.rows().map(|x| x.map(|x| x.clone()).collect()).collect();

// Create the wave function from example image.
let mut wave = overlapping(img, generated_size, generated_size, true, false, since_the_epoch.as_millis() as u64);

// Collapse the wave function.
wave.colapse();

// Extract image data from solver and save with image crate.
let mut tiles: Vec<_> = wave.get_collapsed_data().unwrap().iter().flatten().flat_map(|x| x.0).collect();
let generated = RgbImage::from_raw(generated_size as u32, generated_size as u32, tiles).unwrap();
generated.save("out.png").unwrap();