diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 2 | ||||
-rw-r--r-- | src/sdf.rs | 21 |
2 files changed, 21 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 4403252..5f94c12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,7 @@ /* @TODO: -- let user go back&forth through past sdfs using scenes.txt file - RnToRn functions (& add back in RToR) - also add PerComponent(Box<RToR>,Box<RToR>,Box<RToR>) in R3ToR3 -- ProjectX, ProjectY, ProjectZ in R3ToR? - documentation - GenRandom integers (just use 0..u32::MAX and add a modulus) - blender-style rendering the picture in multiple frames @@ -261,6 +261,12 @@ pub enum R3ToR { #[prob(2)] #[only_if(params.max_depth >= 0)] Min(Box<R3ToR>, Box<R3ToR>), + #[prob(0.1)] + ProjectX, + #[prob(0.1)] + ProjectY, + #[prob(0.1)] + ProjectZ, } impl R3ToR3 { @@ -685,6 +691,21 @@ impl Function for R3ToR { let f_output = f.to_glsl(pre_output, code, var); post.to_glsl(f_output, code, var) } + ProjectX => { + let output = var.next(); + write_str!(code, "float {output} = {input}.x;\n"); + output + } + ProjectY => { + let output = var.next(); + write_str!(code, "float {output} = {input}.y;\n"); + output + } + ProjectZ => { + let output = var.next(); + write_str!(code, "float {output} = {input}.z;\n"); + output + } } } } |