Compare commits

..

No commits in common. "1125d79ca5005fbff2f4a20fdbf679cb3c9682a0" and "d7dafc3fe6acb777f05a24c50b41a18e56566de3" have entirely different histories.

5 changed files with 16 additions and 20 deletions

View File

@ -1,8 +0,0 @@
{
"recommendations": [
"vadimcn.vscode-lldb",
"serayuzgur.crates",
"tamasfe.even-better-toml",
"matklad.rust-analyzer"
]
}

View File

@ -2,11 +2,11 @@
name = "mandelbrot"
version = "0.1.0"
authors = ["Rekai Musuka <rekai@musuka.dev>"]
edition = "2021"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
bevy = "0.5"
num-complex = "0.4"
rayon = "1.5"
bevy = "^0.5"
num-complex = "^0.4"
rayon = "^1.5"

Binary file not shown.

View File

@ -2,6 +2,7 @@ use bevy::diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin};
use bevy::prelude::*;
use bevy::render::texture::{Extent3d, TextureDimension, TextureFormat};
use mandelbrot::{Bounds, Mandelbrot, TEXTURE_HEIGHT, TEXTURE_WIDTH};
use std::time::Instant;
const MAX_ITERATION_COUNT: u32 = 1024;
@ -128,13 +129,13 @@ fn mandelbrot_render_system(
if let Some(material) = materials.get(handle) {
if let Some(texture_handle) = &material.texture {
if let Some(texture) = textures.get_mut(texture_handle) {
let zoom = scale.zoom;
let horiz = scale.horizontal;
let vert = scale.vertical;
let z = scale.zoom;
let h = scale.horizontal;
let v = scale.vertical;
let limit = scale.iteration_limit;
let x = ((-2.5 * zoom) + horiz, (1.0 * zoom) + horiz);
let y = ((-1.0 * zoom) - vert, (1.0 * zoom) - vert);
let x = ((-2.5 * z) + h, (1.0 * z) + h);
let y = ((-1.0 * z) - v, (1.0 * z) - v);
let bounds = Bounds::new(x, y);
texture
@ -187,6 +188,7 @@ fn setup(
font_size: 40.0,
color: white,
},
..Default::default()
},
TextSection {
value: "".to_string(),
@ -195,6 +197,7 @@ fn setup(
font_size: 40.0,
color: white,
},
..Default::default()
},
TextSection {
value: "\nFrametime: ".to_string(),
@ -203,6 +206,7 @@ fn setup(
font_size: 40.0,
color: white,
},
..Default::default()
},
TextSection {
value: "".to_string(),
@ -211,14 +215,16 @@ fn setup(
font_size: 40.0,
color: white,
},
..Default::default()
},
TextSection {
value: "ms".to_string(),
style: TextStyle {
font: ui_font,
font: ui_font.clone(),
font_size: 40.0,
color: white,
},
..Default::default()
},
],
..Default::default()

View File

@ -92,7 +92,6 @@ impl Mandelbrot {
self.frame_buffer.as_ref()
}
#[allow(dead_code)]
fn olc_colours(iters: f64) -> [u8; 4] {
let a = 0.1;
@ -123,7 +122,6 @@ impl Mandelbrot {
Self::count_iterations(c, limit)
}
#[allow(clippy::many_single_char_names)]
fn hsv_to_rgb(h: f64, s: f64, v: f64) -> [u8; 4] {
let c = v * s;
let x = c * (1.0 - (((h / 60.0) % 2.0) - 1.0).abs());