#version unofficial MegaPov 0.6; /************************************* * Blitz-Generator ... * Version 1.0 19.11.00 * Author: Jan walzer * * calling: * * blitz(org,start,dir,lowpt,turb,branch_prob,branch_try,maxiter,dpth,lastpt) * // Sorry, but I'm german (*g*) * * * Parameters: * org : Original Startpoint of the Flash * start : Internal Parameter; Should be equal to org * dir : Direction of growing ... greater vlength gives * less turbulence (increases segmentlength) * lowpt : where would the flash (approx.) hit the "earth" * float turb : How much should the direction of each segment change ? * float branch_prob : Probability of branching 0<=x<=1 * int branch_try : How often should I try to create branches ? N>=0 * int maxiter : Maximum Iterationcounter (to define a sure end) * int depth : internal counter (Should be 0 when calling 1st time) * lastpt : Internal vector (Should be when calling 1st time=) * **/ #macro glow_obj(pos,sz) // what should happen when changing direction ??? glow { location pos type 1 radius sz*10 size sz*0.01 color rgb <0.04,0.035,0.05>*0.5 fade_power 0.9 } #end #macro blitz(org,start,dir,lowpt,turb,branch_prob,branch_try,maxiter,dpth,lastpt) glow_obj(start,1) #if (maxiter>0) #local maxlen=vlength(org-lowpt); #local aktlen=vlength(org-start); #if (vlength(start-lastpt)>0.01) cylinder { start lastpt 0.06 hollow no_shadow pigment {color rgbf <0.4,0.4,0.5,0.9>} finish {ambient 2} interior{ media { emission color rgb <0.4,0.4,0.5> } } } #end #if (maxlen>aktlen) #if (dpth*rand(sd)0) #local i=i-1; #if (rand(sd)-1)*turb; #local newpt=start+newdir; blitz(org,newpt,newdir,lowpt,turb,branch_prob,branch_try,maxiter-1,dpth+1,start) #end #end #local newdir=dir+(2*-1)*turb; #local newpt=start+dir+(2*-1)*turb; blitz(org,newpt,newdir,lowpt,turb,branch_prob,branch_try,maxiter-1,dpth+1,start) #end #end #end #end /* $i=5; #while (i>0) $i=i-1; $sp=<(i-3)*20,50,10>; //blitz(org, start, dir,lowpt,turb,branch_prob,branch_try,maxiter,dpth,lastpt) blitz(sp,sp,1*-y,0 ,0.6 ,0.1 ,1 ,50 ,0 ,sp) #end */