Implement the IFS camera
CI / cargo fmt (push) Successful in 22s
CI / cargo test (push) Failing after 13m52s
CI / cargo test (GPU) (push) Successful in 13m45s

This commit is contained in:
2026-06-20 15:10:25 -04:00
parent 1709336062
commit 90f886f971
5 changed files with 173 additions and 4 deletions
+14 -4
View File
@@ -2,11 +2,13 @@
#![no_std]
#![warn(missing_docs)]
pub mod camera;
use bytemuck::{Pod, Zeroable};
use core::f32::consts::PI;
use glam::{Affine2, Vec3, Vec4, vec2, vec3, Vec2};
use rand::{Rng, RngExt};
use glam::{Affine2, Vec2, Vec3, Vec4, vec2, vec3};
use rand::distr::StandardUniform;
use rand::{Rng, RngExt};
#[cfg(target_arch = "spirv")]
use spirv_std::num_traits::Float;
use spirv_std::spirv;
@@ -97,7 +99,12 @@ impl Transform {
/// # Arguments
///
/// * `weights` - Weights are assumed to be normalized; adding all elements together should return the value 1
pub fn step_chaos_game<R: Rng>(rng: &mut R, point: Vec2, weights: &[f32], transforms: &[Transform]) -> (Vec2, u32) {
pub fn step_chaos_game<R: Rng>(
rng: &mut R,
point: Vec2,
weights: &[f32],
transforms: &[Transform],
) -> (Vec2, u32) {
let mut choice_weight = rng.sample::<f32, _>(StandardUniform);
let mut transform_index: u32 = 0;
@@ -110,7 +117,10 @@ pub fn step_chaos_game<R: Rng>(rng: &mut R, point: Vec2, weights: &[f32], transf
transform_index += 1;
}
(transforms[transform_index as usize].transform_point(point), transform_index)
(
transforms[transform_index as usize].transform_point(point),
transform_index,
)
}
#[derive(Copy, Clone, Pod, Zeroable)]