diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 9 | ||||
-rw-r--r-- | src/sdf.rs | 8 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 2594fdd..60e2499 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,9 +7,11 @@ - mouse sensitivity - AA quality - # iterations, distance cutoff +- documentation */ extern crate nalgebra; +extern crate gen_random; pub mod sdf; mod sdl; @@ -17,6 +19,8 @@ pub mod win; use nalgebra::{Matrix3, Matrix4, Rotation3, Vector3}; use std::time::Instant; +use gen_random::GenRandom; + type Vec3 = Vector3<f32>; type Mat3 = Matrix3<f32>; @@ -62,6 +66,9 @@ impl View { fn try_main() -> Result<(), String> { use sdf::{Constant, R3ToR, R3ToR3, RToR}; + let _test = Constant::gen_thread_random(); + println!("{_test:?}"); + let funciton = R3ToR::compose( R3ToR3::InfiniteMirrors(Constant::from(2.0)), R3ToR::sphere_f32(0.2), @@ -150,7 +157,7 @@ void main() { }", ); - println!("{fshader_source}"); + //println!("{fshader_source}"); let program = window .create_program( @@ -1,6 +1,10 @@ #![allow(dead_code)] // @TODO @TEMPORARY +extern crate rand; +extern crate gen_random_proc_macro; use std::fmt::{self, Display, Formatter, Write}; +use gen_random_proc_macro::GenRandom; +use gen_random::GenRandom; // we're only writing numbers and strings so write! should never fail. macro_rules! write_str { @@ -8,10 +12,12 @@ macro_rules! write_str { } /// these are constant across 3D space, not across time/user input/etc. +#[derive(GenRandom, Debug)] pub enum Constant { + #[prob = 0.5] F32(f32), + #[prob = 0.5] Time(f32, f32), - // @TODO: sin, sqrt, mod } impl From<f32> for Constant { |