|
|
Hi
> Can you please give an example on how to call your macro or/and
> explain the parameters. Then it will be easier to debug your code.
OK here's the full version. I was trying to save space. Pic in p.b.a.
Mick
// ----------------------------------------
camera
{
location <0.0, 5, -50.0>
direction 1.5*z
right 4/3*x
look_at <0.0, 5.0, 0.0>
}
sky_sphere
{
pigment
{
gradient y
color_map { [0.0 color blue 0.6] [1.0 color rgb 1] }
}
}
light_source
{
0*x // light's position (translated below)
color red 1.0 green 1.0 blue 1.0 // light's color
translate <-30, 30, -30>
}
// -----------------------------------------------------------------
#declare GrassTex = texture {
pigment{Green}
finish{specular 1 roughness .01}
normal{bozo .01 scale <.1,5,.1> scallop_wave}
}
file://-------------------------Make Blade------------------------------
#macro
akeBlade( RotX,RotY,segLength,NoSegs,XPos,ZPos,SF,Dim,bladeW,foldDepth)
#local P1=vaxis_rotate(<bladeW+XPos,0,0>*SF,y,RotY);
#local PM=vaxis_rotate(<0+XPos,0,foldDepth>*SF,y,RotY); file://make z A
variable - foldDepth
#local P2=vaxis_rotate(<-bladeW+XPos,0,0>*SF,y,RotY);
#local RVec = vnormalize(P1-P2);
#local Ct = 0;
#while(Ct<NoSegs)
#local N1 =
vaxis_rotate(<P1.x,P1.y+(segLength*SF),P1.z>*Dim,RVec,RotX);
#local NM =
vaxis_rotate(<PM.x,PM.y+(segLength*SF),PM.z>*Dim,RVec,RotX);
#local N2 =
vaxis_rotate(<P2.x,P2.y+(segLength*SF),P2.z>*Dim,RVec,RotX);
file://Left side
#write(filehandle,"triangle{",P1,",",PM,",",N1,"texture{GrassTex}}\n")
#write(filehandle,"triangle{",PM,",",N1,",",NM,"texture{GrassTex}}\n")
file://Right side
#write(filehandle,"triangle{",PM,",",P2,",",N2,"texture{GrassTex}}\n")
#write(filehandle,"triangle{",PM,",",NM,",",N2,"texture{GrassTex}}\n")
file://Points
#local Ct=Ct+1;
#local P1 = N1;
#local PM = NM;
#local P2 = N2;
#if(Ct=NoSegs)
#local EPt =
vaxis_rotate(<NM.x,NM.y+(segLength*SF)*Dim,NM.z>,RVec,RotX);
#write(filehandle,"triangle{",P1,",",PM,",",EPt,"texture{GrassTex}}\n")
#write(filehandle,"triangle{",PM,",",EPt,",",P2,"texture{GrassTex}}\n")
#end
#end//while loop
#end//macro
file://-------------------------------------------------------------------
#macro
MakePatch(XnBlades,ZnBlades,Spacing,NoSegs,segLength,RotX,Dim,bladeW,foldDep
th)
#declare fname = "GMF.inc"
#fopen filehandle fname write
#write(filehandle,"#declare Grass = mesh{\n")
#declare RdN = seed(1549);
#local ZPos =-(XnBlades)*Spacing;
#local XPos =-(ZnBlades)*Spacing;
#while(XPos<(XnBlades)*Spacing)
#local ZPos = -(XnBlades)*Spacing;//reset ZLoop
#while(ZPos<(ZnBlades)*Spacing)
#declare RotX = RotX+(rand(RdN)/10);
#declare RotY=rand(RdN)*360;
#declare SF = rand(RdN);
MakeBlade(RotX,RotY,segLength,NoSegs,XPos,ZPos,SF,Dim,bladeW,foldDepth)
#local ZPos = ZPos+Spacing;
#end//ZLoop
#local XPos=XPos+Spacing;
#end file://XLoop
#write(filehandle,"}")
#fclose filehandle
#end file://macro
file://-------------------------------------------------------------------
MakePatch( 3, file://Horizontal(X) number of blades in Patch
5, file://Horizontal(Z) number of blades in Patch
3, file://spacing between blades,default 3
10, file://Number of segments in blade
3, // Length of blade segment
5, file://Rotation of Blade in degrees, default 2
0.9125// amount by which blade gets thinner towards end between
.9 and 1 file://.9125
.7, file://blade start width
.75 file://depth of fold
)
#include"GMF.inc"
object{Grass
scale 1
}
file://plane{y,0 pigment{Tan}}
Post a reply to this message
|
|