Variation #3
Generated
+20
-20
@@ -354,7 +354,7 @@ dependencies = [
|
|||||||
"glam",
|
"glam",
|
||||||
"image",
|
"image",
|
||||||
"libm",
|
"libm",
|
||||||
"rand 0.8.6",
|
"rand 0.10.1",
|
||||||
"rand_xoshiro",
|
"rand_xoshiro",
|
||||||
"spirv-std",
|
"spirv-std",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
@@ -1038,15 +1038,6 @@ version = "5.3.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand"
|
|
||||||
version = "0.8.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5ca0ecfa931c29007047d1bc58e623ab12e5590e8c7cc53200d5202b69266d8a"
|
|
||||||
dependencies = [
|
|
||||||
"rand_core 0.6.4",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand"
|
name = "rand"
|
||||||
version = "0.9.4"
|
version = "0.9.4"
|
||||||
@@ -1057,6 +1048,15 @@ dependencies = [
|
|||||||
"rand_core 0.9.5",
|
"rand_core 0.9.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d2e8e8bcc7961af1fdac401278c6a831614941f6164ee3bf4ce61b7edb162207"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.10.1",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_chacha"
|
name = "rand_chacha"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@@ -1067,12 +1067,6 @@ dependencies = [
|
|||||||
"rand_core 0.9.5",
|
"rand_core 0.9.5",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rand_core"
|
|
||||||
version = "0.6.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_core"
|
name = "rand_core"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
@@ -1083,12 +1077,18 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rand_xoshiro"
|
name = "rand_core"
|
||||||
version = "0.6.0"
|
version = "0.10.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f97cdb2a36ed4183de61b2f824cc45c9f1037f28afe0a322e9fff4c108b5aaa"
|
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_xoshiro"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "662effc7698e08ea324d3acccf8d9d7f7bf79b9785e270a174ea36e56900c91d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rand_core 0.6.4",
|
"rand_core 0.10.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|||||||
+2
-3
@@ -24,8 +24,7 @@ bytemuck = { version = "1.25.0", features = ["derive"] }
|
|||||||
glam = { version = "0.33.1", default-features = false, features = ["bytemuck", "scalar-math"] }
|
glam = { version = "0.33.1", default-features = false, features = ["bytemuck", "scalar-math"] }
|
||||||
image = { version = "0.25.10", default-features = false, features = ["default-formats"]}
|
image = { version = "0.25.10", default-features = false, features = ["default-formats"]}
|
||||||
libm = "0.2.16"
|
libm = "0.2.16"
|
||||||
|
rand = { version = "0.10.1", default-features = false }
|
||||||
|
rand_xoshiro = "0.8.1"
|
||||||
rspirv = "0.13.0"
|
rspirv = "0.13.0"
|
||||||
tempfile = "3.27.0"
|
tempfile = "3.27.0"
|
||||||
|
|
||||||
rand = { version = "0.8.6", default-features = false }
|
|
||||||
rand_xoshiro = "0.6.0"
|
|
||||||
|
|||||||
@@ -15,14 +15,14 @@
|
|||||||
|
|
||||||
use crate::transform::Transform;
|
use crate::transform::Transform;
|
||||||
use crate::variation::Variation;
|
use crate::variation::Variation;
|
||||||
use rand::Rng;
|
use rand::distr::{Distribution, StandardUniform};
|
||||||
use rand::distributions::{Distribution, Standard};
|
use rand::{Rng, RngExt};
|
||||||
use spirv_std::glam::{Vec2, vec2};
|
use spirv_std::glam::{Vec2, vec2};
|
||||||
|
|
||||||
struct BiUnit;
|
struct BiUnit;
|
||||||
impl Distribution<f32> for BiUnit {
|
impl Distribution<f32> for BiUnit {
|
||||||
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f32 {
|
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> f32 {
|
||||||
rng.sample::<f32, _>(Standard) * 2.0 - 1.0
|
rng.sample::<f32, _>(StandardUniform) * 2.0 - 1.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@ pub fn step_chaos_game<R: Rng>(
|
|||||||
weights: &[f32],
|
weights: &[f32],
|
||||||
variations: &[Variation],
|
variations: &[Variation],
|
||||||
) -> (Vec2, u32) {
|
) -> (Vec2, u32) {
|
||||||
let mut choice_weight = rng.sample::<f32, _>(Standard);
|
let mut choice_weight = rng.sample::<f32, _>(StandardUniform);
|
||||||
let mut transform_index: u32 = 0;
|
let mut transform_index: u32 = 0;
|
||||||
|
|
||||||
for i in 0..weights.len() {
|
for i in 0..weights.len() {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ use bytemuck::{Pod, Zeroable};
|
|||||||
use core::f32::consts::PI;
|
use core::f32::consts::PI;
|
||||||
use glam::{Affine2, Vec2, vec2};
|
use glam::{Affine2, Vec2, vec2};
|
||||||
use libm::{atan2f, cosf, powf, sinf, sqrtf, tanf};
|
use libm::{atan2f, cosf, powf, sinf, sqrtf, tanf};
|
||||||
use rand::Rng;
|
use rand::distr::StandardUniform;
|
||||||
use rand::distributions::Standard;
|
use rand::{Rng, RngExt};
|
||||||
|
|
||||||
#[derive(Copy, Clone, Pod, Zeroable)]
|
#[derive(Copy, Clone, Pod, Zeroable)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
@@ -73,7 +73,7 @@ fn transform_point_julia<R: Rng>(point: Vec2, rng: &mut R) -> Vec2 {
|
|||||||
let r = sqrtf(x2 + y2);
|
let r = sqrtf(x2 + y2);
|
||||||
|
|
||||||
let theta = atan2f(point.x, point.y);
|
let theta = atan2f(point.x, point.y);
|
||||||
let omega = if rng.sample::<f32, _>(Standard) > 0.5 {
|
let omega = if rng.sample::<f32, _>(StandardUniform) > 0.5 {
|
||||||
PI
|
PI
|
||||||
} else {
|
} else {
|
||||||
0.0
|
0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user