import static de.grogra.qsm.utils.Library.*; import static de.grogra.qsm.utils.Descriptors.*; module MyShoot(super.length, super.diameter) extends F{{setShader(EGA_6);}} module MyBud(int order, float length) extends Sphere(0.002){{setShader(EGA_3);}} module Leaf ==> M(0.001) Parallelogram(0.012,0.01).(setShader(GREEN)); public void update()[ { jumpAllAxis(); } f:F,(f[RTREND]==0) ==> MyShoot(f.length,f.diameter).($[transform]=f[transform]) [ M(-0.3*f.length) [ RL(65)MyBud(f[BO]+1,f.length*0.5) ] [ RL(-65)MyBud(f[BO]+1,f.length*0.5) ] ] [ M(-0.25*f.length) [ RL(80)Leaf() ] [ RL(-80)Leaf() ] ] [ M(-0.75*f.length)RH(90) [ RL(80)Leaf() ] [ RL(-80)Leaf() ] ] MyBud(f[BO],f.length*0.7); f:F ==> MyShoot(f.length,f.diameter).($[transform]=f[transform]); ] public void grow()[ MyBud(o,l),(o<3) ==> MyShoot(l,l/20) [ M(-0.3*l) [ RL(65)MyBud(o+1,l*0.5) ] [ RL(-65)MyBud(o+1,l*0.5) ] ] [ M(-0.25*l) [ RL(80)Leaf() ] [ RL(-80)Leaf() ] ] [ M(-0.75*l)RH(90) [ RL(80)Leaf() ] [ RL(-80)Leaf() ] ] MyBud(o,l*0.7); ]