forked from jbdong/CityEngine_cga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsimpleBuildingShells_01.cga
85 lines (55 loc) · 1.44 KB
/
simpleBuildingShells_01.cga
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* File: simpleBuildingShells.cga
* Created: 14 Jul 2008 16:03:27 GMT
* Author: andi
*/
version "2012.1"
// height value
attr height =80
## Rules
Lot -->
// prepare building ground size
case geometry.isConcave : LotSub(height)
else : s('.8,'1,'.8) center(xz) LotSub(height)
LotInner --> Lot
LotSub(h) -->
// trigger building rules depending on lot polygon
case geometry.isRectangular(10) :
case scope.sx-10 < scope.sz && scope.sx+10 > scope.sz:
RectQuad(h)
else:
Rect(h)
else:
Gen(h)
RectQuad(h) -->
case h > 30 : s('.8,'1,'.8) center(xz) extrude(h) UShaped
else : extrude(h) House
Rect(h) -->
case h > 30 : extrude(h) LShaped
else : extrude(h) House
Gen(h) -->
case h > 60 : extrude(h) Tower
else : extrude(h) Facades
// U-Shaped
UShaped -->
split(x){ 'rand(.3,.5): Facades | ~1: SideWings }
SideWings -->
split(z){ 'rand(.3,.45): SideWing | ~1: NIL | 'rand(.3,.45): SideWing }
SideWing -->
30% : Facades
30% : split(x){ 'rand(0.2,0.8) : Facades }
else : s('1,'rand(0.2,0.9),'1) Facades
// L-Shaped
LShaped -->
split(x){ 'rand(.3,.5): Facades | ~1: SideWings }
Tower -->
case scope.sy > 5 :
s('0.9,'1,'0.9) center(xz) split(y){ '0.3 : Element. | '0.7 : Tower }
else :
NIL
House -->
comp(f){top : alignScopeToAxes("y") Roof | side : Facades}
Roof --> roofPyramid(30) comp(f){bottom : NIL | all : RoofTop}
// no building details on roof and facades
Facades --> X.
RoofTop --> X.