chore: remove image as a dependency
This commit is contained in:
parent
de56024039
commit
c96bf45bff
|
@ -1751,16 +1751,6 @@ dependencies = [
|
|||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gif"
|
||||
version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02efba560f227847cb41463a7395c514d127d4f74fff12ef0137fff1b84b96c4"
|
||||
dependencies = [
|
||||
"color_quant",
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gilrs"
|
||||
version = "0.8.0"
|
||||
|
@ -1922,14 +1912,11 @@ dependencies = [
|
|||
"bytemuck",
|
||||
"byteorder",
|
||||
"color_quant",
|
||||
"gif",
|
||||
"jpeg-decoder",
|
||||
"num-iter",
|
||||
"num-rational",
|
||||
"num-traits",
|
||||
"png",
|
||||
"scoped_threadpool",
|
||||
"tiff",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2044,16 +2031,6 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jpeg-decoder"
|
||||
version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"rayon",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.45"
|
||||
|
@ -2192,7 +2169,6 @@ name = "mandelbrot"
|
|||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bevy",
|
||||
"image",
|
||||
"num-complex",
|
||||
"rayon",
|
||||
]
|
||||
|
@ -3293,17 +3269,6 @@ version = "0.3.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7572415bd688d401c52f6e36f4c8e805b9ae1622619303b9fa835d531db0acae"
|
||||
|
||||
[[package]]
|
||||
name = "tiff"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abeb4e3f32a8973722c0254189e6890358e72b1bf11becb287ee0b23c595a41d"
|
||||
dependencies = [
|
||||
"jpeg-decoder",
|
||||
"miniz_oxide 0.4.3",
|
||||
"weezl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.1.44"
|
||||
|
@ -3608,12 +3573,6 @@ dependencies = [
|
|||
"webpki",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "weezl"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3e2bb9fc8309084dd7cd651336673844c1d47f8ef6d2091ec160b27f5c4aa277"
|
||||
|
||||
[[package]]
|
||||
name = "wgpu"
|
||||
version = "0.6.0"
|
||||
|
|
|
@ -8,6 +8,5 @@ edition = "2018"
|
|||
|
||||
[dependencies]
|
||||
bevy = "0.3"
|
||||
image = "0.23"
|
||||
num-complex = "0.3"
|
||||
rayon = "1.5"
|
||||
|
|
|
@ -49,6 +49,9 @@ fn transform_mandelbrot_system(
|
|||
if scale.zoom < 0.0 {
|
||||
// We can't go below 0
|
||||
scale.zoom -= scale.step * zoom as f64;
|
||||
|
||||
// slow down our step function
|
||||
scale.step /= 10.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
use image::{ImageBuffer, Rgb, RgbImage};
|
||||
use num_complex::Complex;
|
||||
use rayon::prelude::*;
|
||||
|
||||
const MAX_ITERATIONS: u16 = 256;
|
||||
const MAX_ITERATIONS: u16 = 1024;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Mandelbrot {
|
||||
|
@ -126,36 +125,6 @@ impl Mandelbrot {
|
|||
});
|
||||
}
|
||||
|
||||
pub fn escape_time_image() {
|
||||
let mut img: RgbImage = ImageBuffer::new(Self::IMG_WIDTH as u32, Self::IMG_HEIGHT as u32);
|
||||
let mut mandelbrot: Vec<u16> = vec![0; Self::IMG_HEIGHT * Self::IMG_WIDTH];
|
||||
|
||||
mandelbrot
|
||||
.par_iter_mut()
|
||||
.enumerate()
|
||||
.for_each(|(i, value)| {
|
||||
let px = i % Self::IMG_WIDTH;
|
||||
let py = i / Self::IMG_WIDTH;
|
||||
|
||||
let c = Self::coords_to_complex(px, py, (-2.5, 1.0), (-1.0, 1.0));
|
||||
|
||||
*value = Self::calc_num_iterations(c);
|
||||
});
|
||||
|
||||
for (px, py, pixel) in img.enumerate_pixels_mut() {
|
||||
let i = px as usize + Self::IMG_WIDTH * py as usize;
|
||||
let num_iterations = mandelbrot[i];
|
||||
|
||||
match Self::find_colour(num_iterations) {
|
||||
Colour::White => *pixel = Rgb([0x00, 0x00, 0x00]),
|
||||
Colour::Black => *pixel = Rgb([0xFF, 0xFF, 0xFF]),
|
||||
Colour::Gray => *pixel = Rgb([0xAA, 0xAA, 0xAA]),
|
||||
}
|
||||
}
|
||||
|
||||
img.save("assets/test.png").unwrap();
|
||||
}
|
||||
|
||||
fn find_colour(iteration: u16) -> Colour {
|
||||
match iteration {
|
||||
MAX_ITERATIONS => Colour::Black,
|
||||
|
|
Loading…
Reference in New Issue