Skip to content

Commit 88a3745

Browse files
committed
deprecate cabs_squared in favour of length, remove deprecated functions from readme
1 parent aad4b89 commit 88a3745

File tree

5 files changed

+7
-8
lines changed

5 files changed

+7
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fractal_viewer"
3-
version = "0.5.0"
3+
version = "0.5.1"
44
edition = "2021"
55
description = "Cross-platform GPU-accelerated viewer for the Mandelbrot set and related fractals"
66
repository = "https://github.com/arthomnix/fractal_viewer"

README.MD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ A cross-platform, GPU-accelerated viewer for the Mandelbrot Set and related frac
66
Scroll wheel to zoom, click and drag to pan. Change the initial value of z or c by right-clicking.
77

88
Custom functions should be valid WGSL expressions, with the following extra functions available:
9-
* `cabs(vec2<f32>) -> f32`: absolute value of a complex number (deprecated: use builtin length(z) instead)
10-
* `cabs_squared(vec2<f32>) -> f32`: square of the absolute value of a complex number, (marginally) faster as it avoids a square root
119
* `csquare(vec2<f32>) -> vec2<f32>`: square of a complex number
1210
* `cpow(vec2<f32>, f32) -> vec2<f32>`: real power of a complex number (can cause precision issues)
1311
* `ccpow(vec2<f32>, vec2<f32>) -> vec2<f32>`: complex power of a complex number

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ impl State {
702702
ui.add(
703703
egui::Slider::new(
704704
&mut self.settings.escape_threshold,
705-
1.0..=13043817825300000000.0,
706-
) // approximate square root of maximum f32
705+
1.0..=f32::MAX,
706+
)
707707
.logarithmic(true),
708708
);
709709
});

src/shader.wgsl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ fn vs_main(@builtin(vertex_index) in_vertex_index: u32) -> @builtin(position) ve
2727
return vertex_positions[in_vertex_index];
2828
}
2929

30+
// deprecated: use length(z)^2 instead
3031
fn cabs_squared(z: vec2<f32>) -> f32 {
3132
return (z.x * z.x + z.y * z.y);
3233
}
@@ -113,7 +114,7 @@ fn get_fragment_colour(c: vec2<f32>) -> vec4<f32> {
113114

114115
for (
115116
z += uniforms.initial_value;
116-
cabs_squared(z) < uniforms.escape_threshold * uniforms.escape_threshold;
117+
length(z) < uniforms.escape_threshold;
117118
z = REPLACE_FRACTAL_EQN // gets replaced by user-defined expression
118119
) {
119120
i++;
@@ -129,7 +130,7 @@ fn get_fragment_colour(c: vec2<f32>) -> vec4<f32> {
129130
z = c;
130131
var c: vec2<f32> = uniforms.initial_value;
131132
for (;
132-
cabs_squared(z) < uniforms.escape_threshold * uniforms.escape_threshold;
133+
length(z) < uniforms.escape_threshold;
133134
z = REPLACE_FRACTAL_EQN // gets replaced by user-defined expression
134135
) {
135136
i++;

0 commit comments

Comments
 (0)