Skip to content

Commit

Permalink
Go back to a more detailed fire
Browse files Browse the repository at this point in the history
  • Loading branch information
walles committed Aug 17, 2023
1 parent d50b675 commit 0e323e6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Binary file modified libloadviz/screenshot.webp
Binary file not shown.
13 changes: 8 additions & 5 deletions libloadviz/src/renderer/flame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,26 @@ use super::{get_load, interpolate, pixel_to_fraction, Renderer, BG_COLOR_RGB};
static USER_LOAD_COLOR_RGB_WARMER: &[u8; 3] = &[0xff, 0xb4, 0x6b]; // 3000K
static USER_LOAD_COLOR_RGB_COOLER: &[u8; 3] = &[0xff, 0x38, 0x00]; // 1000K

/// Higher numbers => more detail
static SCALE: f32 = 2.0;

/// What fraction of the inside of the fire fades towards transparent?
static TRANSPARENT_INTERNAL_0_TO_1: f32 = 0.3;

/// How warped is the internal base image? Try setting `DISTORTION_DETAIL` to
/// zero to see the effect of changing this number.
static INTERNAL_DETAIL: f32 = 2.0;
static INTERNAL_DETAIL: f32 = 2.0 * SCALE;

/// How uneven are the fire's edges? Also, how much warping happens to the
/// internal base image?
///
/// Note that even if this is set to zero, the internal base image will still
/// move around, since time is one basis for the noise.
static DISTORTION_DETAIL: f32 = 2.0;
static DISTORTION_DETAIL: f32 = 3.0 * SCALE;

/// How many pixels wide is the distortion effect? This is in percent of the
/// shortest image dimension.
static DISTORTION_PIXEL_PERCENT: f32 = 10.0;
static DISTORTION_PIXEL_PERCENT: f32 = 10.0 / SCALE;

/// Higher values make the fire's edges softer
static ANTIALIAS_HEIGHT_0_TO_1: f32 = 0.1;
Expand Down Expand Up @@ -68,7 +71,7 @@ impl Renderer {
let noise1_m1_to_1 = self.noise.get_noise3d(
distortion_detail * pixel_x as f32,
distortion_detail * pixel_y_from_bottom as f32,
dt_seconds,
dt_seconds / SCALE,
);

// Pick the load to show
Expand All @@ -91,7 +94,7 @@ impl Renderer {
let noise2_m1_to_1 = self.noise.get_noise3d(
distortion_detail * pixel_x as f32,
distortion_detail * pixel_y_from_bottom as f32,
-dt_seconds - 1.0,
-dt_seconds / SCALE - 1.0,
);

// Figure out how to color the current pixel
Expand Down
Binary file modified macos/loadviz.icns
Binary file not shown.

0 comments on commit 0e323e6

Please sign in to comment.