|
|
While playing with functions came upon this:
you can create a macro that outputs a function with other #local functions
supporting that function and you call that macro several times for different
outputs.
Like this example:
#macro Gf_waves(r,c,d,V)
#local g=radians(r);
#local h=V*<1,1,1>+<.5,0,.5>;
#local q=<c,1,d>;
#local PigFa= function {pigment {waves color_map{[0,rgb 0][1,rgb 1]} scale q
rotate y*r translate h}};
#local PigF0= function {1-PigFa(x,0,z).hf}
function(x,z){PigF0(x,0,z)}
#end
Used like this:
#declare Small_Waves=Gf_waves(0,1,1,0)
#declare Mid_Waves=Gf_waves(0,2,2,0)
#declare Big_Waves=Gf_waves(0,9,9,0)
The neat part is that you can used the #local function names in another macros
without conflict.
and you can combine functions like this
#declare Ground=function(x,z){Mat(x,z)*Dirt(x,z)}
I use version 3.7 haven't try it on any of the other versions.
Post a reply to this message
|
|