|
|
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> 1) changing both SineEdge and LandHeight to functions rather than macros
> adds speed. Parse time dropped from about 90secs to 60secs for me:
>
> #declare SineEdge2 = function
> (xp){select(xp,select(xp+pi,0,0.5*cos(xp)+0.5),1)}
> #declare LandHeight2=function
> (xp,yp){SineEdge2(xp+6)*(0.5*land1((xp+hilloff)/sc1, 0, yp/sc1).x +
> 0.5*land2((xp+hilloff)/sc2, 0, yp/sc2).x)}
Well, crikey. I never even knew the select() function existed. Very useful!
> height_field {
> #local m=(2*xs/dx+2);
> #local n=(2*ys/dx+2);
> function m,n {pattern{function{LandHeight2( (x)*2*xs-xs
> , -((y-1/n)*2*ys-ys) )}}}
> //smooth
> translate <-1/2,0,-1/2>
> scale <2*xs,maxh,2*ys>
> texture { t1 scale maxh }
> texture { t2 scale maxh }
> }
That's *very* interesting. Is that feature in 3.6.1? I can't find it
anywhere in the documentation. As you say, it completely does away with the
intermediate image generation / import step which used to be so
time-consuming when I've tried using heightfields in the past.
Anyway, at least I have a nice modifiable rectangular mesh2 generator now.
Cheers for the pointers!
Bill
Post a reply to this message
|
|