DEF out=scene
WHERE
cyl (h::IsReal)(r::IsReal)(n::IsInt) = circle:r:<n,1> * Q:h,
MyTrunCone (r1,r2,h::IsReal)(n::IsInt) =
MAP:[x*cos~S2,x*sin~S2,z]:(Q:1 * (Q~#:n):(2*PI/n))
WHERE
x= K:r1 + s1 * (K:r2 - k:r1),
y= k:0,
z= s1 * K:h
END,
%-- Color definition ------------------------------------%
grass = RGBCOLOR:<0.55,0.92,0.14>,
water = RGBCOLOR:<0.19,0.84,0.79>,
terrain = RGBCOLOR:<0.70,0.50,0.20>,
%-- Details modelling -----------------------------------%
pathpoints = <<0,0>,<0.5,0>,<0.1,0.8>,<0.6,0.7>,<0.9,0.4>>,
pathstripe = BezierStripe:<pathpoints,0.025,22>,
mapping= T:<1,2,3>~(CONS:sup_c1_c2),
mytree = STRUCT:<
t:3:5:(COLOR:< myTrunCone:<8,0,12>:5, green >),
COLOR:< cylinder:<2,8>:5, brown >>,
controlTrees = (STRUCT~CONS:(AA:mapping:pathpoints)):mytree,
hutPlan = MKPOL:<<<5,-2>,<-5,-2>,<-5,2>,<5,2>,<2,-2>,
<-2,-2>,<-2,5>,<2,5>>,<1..4,5..8>,<1..2>>,
hutSection= MKPOL:<<<5,2>,<-2,3>,<-2,-1>,<5,-1>,<0,5>>,<1..4,<2,4,5>>,<1..2>>,
mountain_hut = COLOR:<hutPlan (<1,2,0> XX <0,1,2>) hutSection,brown>,
hutmapped =(mapping:<0.90,0.30>):(S:<1,2,3>:<3,3,3>:(mountain_hut)),
%-- Bezier Definition -----------------------------------%
c1 = BezierCurve:<c1a,<460,250,50>,<470,100,0>,<480,0,280>,<490,-200,200>>,
m1 = BezierCurve:<m1a,<325,200,80>,<330,150,80>,<335,50,170>,<340,-160,150>>,
m2 = BezierCurve:<m2a,<162,250,100>,<164,150,120>,<166,50,120>,<168,-130,200>>,
c2 = BezierCurve:<c2a,<0,300,100>,<0,150,150>,<0,50,150>,c2Last %<0,-100,400>%>,
c1a = <450,400,0>, m1a = <320,300,0>,
m2a = <160,450,0>, c2a = <0,400,0>,
c2Last = <0,-100,400>,
c0 = BezierCurve:<c0a,<630,800,50>,<760,700,100>,<900,600,0>>,
c3 = BezierCurve:<c3a,<-400,250,200>,<-400,100,300>,<-400,0,150>>,
m0 = BezierCurve:<m0a,<800,200,0>,<900,0,0>,<1000,-200,0>>,
m3 = BezierCurve:<m3a,<-200,150,50>,<-200,50,150>,<-200,-50,150>>,
c0a = <500,900,0>, m0a = <600,400,0>,
c3a = <-400,400,0>, m3a = <-200,300,0>,
sup_c1_c2 = Bezier:S2:<c1,m1,m2,c2>,
sup_c0_c1 = Bezier:S2:<c0,m0,c1>,
sup_c2_c3 = Bezier:S2:<c2,m3,c3>,
b12 = BezierCurve:<c1a,m1a,m2a,c2a>,
b56 = BezierCurve:<c0a, b56a>,
sup_b12_b56 = Bezier:S2:<b12,m0a,b56>,
sup_lake = Bezier:S2:<bLake1,bLakem,bLake2>,
b56a = <200, 1000, 0>,
l2 = <-400,1200,0>,
l1 = <-100,1200,0>,
bLake1 = BezierCurve:<c2a,m0a,b56a>,
bLakem = BezierCurve:<m3a,l1>,
bLake2 = BezierCurve:<c3a,l2>,
%-- High level assembly ---------------------------------%
dom2d = Intervals:1:8 * Intervals:1:8,
mountains=STRUCT:<MAP:(CONS:sup_c1_c2):(dom2d),
MAP:(CONS:sup_c0_c1):(dom2d),MAP:(CONS:sup_c2_c3):(dom2d)>,
road = MAP:sup_c1_c2:pathstripe,
beach = MAP:(CONS:sup_b12_b56):(dom2d),
lake = MAP:(CONS:sup_lake):(dom2d),
surfaces=
STRUCT:<mountains,MAP:sup_b12_b56:dom2d,MAP:sup_lake:dom2d>,
mk_curves=cons~AA:(map~cons),
dom1d=Intervals:1:8,
curves2=struct:(mk_curves:<c0,m0,m1,m2,m3,c3,b56,bLakem,bLake2>:dom1d),
curves=struct:(mk_curves:<c1,c2,bLake1,b12>:dom1d),
draw_points(dim::IsReal)(pts::IsSeq) =
STRUCT:(CONS:(AA:(T:<1,2,3>):pts):(cylinder:<dim,dim>:4)),
points=(draw_points:12:<c1a,m1a,m2a,c2a,c2Last,c0a,m0a,c3a,m3a,b56a,l2,l1>),
points2=(draw_points:8:<
<460,250,50>,<470,100,0>,<480,0,280>,<490,-200,200>,
<325,200,80>,<330,150,80>,<335,50,170>,<340,-160,150>,
<162,250,100>,<164,150,120>,<166,50,120>,<168,-130,200>,
<0,300,100>,<0,150,150>,<0,50,150>,
<630,800,50>,<760,700,100>,<900,600,0>,
<-400,250,200>,<-400,100,300>,<-400,0,150>,
<800,200,0>,<900,0,0>,<1000,-200,0>,
<-200,50,150>,<-200,-50,150>,<-200,-50,150> >),
mymaterial(color::isRGBcolor) = BASEMATERIAL:<color, color, 0.8, BLACK, 0.3, 1/4>,
scene1 = STRUCT:<
mountains COLOR grass,
(T:3:1:road) COLOR terrain,
beach COLOR terrain,
lake COLOR water,
controlTrees%,hutmapped%>,
scene2 = STRUCT:<
mountains MATERIAL mymaterial:(RGBCOLOR:<0.25,0.80,0>),
beach MATERIAL mymaterial:terrain,
lake MATERIAL mymaterial:water,
curves COLOR RED,
curves2 COLOR RGBcolor:<0.8,0.5,0.1>,
points COLOR RGBcolor:<0.2,0.8,1>,
points2 COLOR RGBcolor:<0.2,0.4,0.8>>,
scene3 = STRUCT:<
mountains COLOR grass TEXTURE SIMPLETEXTURE:'img/mountain.png',
(T:3:1:road) COLOR terrain TEXTURE SIMPLETEXTURE:'img/road.png',
beach COLOR terrain TEXTURE SIMPLETEXTURE:'img/beach.png',
lake COLOR water TEXTURE SIMPLETEXTURE:'img/water.png',
controlTrees%,hutmapped%>,
scene=AxialCameras:scene3
END;