forked from jbdong/CityEngine_cga
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmassmodeling_05.cga
113 lines (72 loc) · 1.79 KB
/
massmodeling_05.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
* File: massmodeling_05.cga
* Created: 6 Nov 2008 18:41:40 GMT
* Author: andi
*/
version "2011.1"
@Group("Building",2) @Range(20,200)
attr height =
case geometry.area > 1000: rand(50,200)
else: rand(20,50)
@StartRule
Lot --> Parcel
@StartRule
LotInner --> OpenSpace
######################
## Setback Parcels
######################
@Group("Footprint",1) @Range(3,6)
attr distanceStreet =
20% : 0
else : rand(3,6)
@Group("Footprint") @Range(4,8)
attr distanceBuildings =
50% : 0
else : rand(4,8)
@StartRule
Parcel -->
setback(distanceStreet)
{ streetSide: OpenSpace
| remainder: SubParcel }
SubParcel -->
setback(distanceBuildings/2)
{ noStreetSide: OpenSpace
| remainder: Footprint }
#####################
@StartRule
OpenSpace -->
color("#77ff77")
import lushapes : "massmodeling_01.cga"
import towers : "massmodeling_02.cga"
Footprint -->
case geometry.isRectangular(15):
25% : towers.Tower
else : lushapes.LUShape
else:
25%: towers.Tower
else : offset(-5,inside) lushapes.BasicFootprint
//////////////////
// Facades //
//////////////////
const randomFacadeTexture = fileRandom("*facade_textures/f*.tif")
@Group("Facade",3) @Range(3,6)
attr floorheight = rand(4,5)
actualFloorHeight =
case scope.sy >= 1 : scope.sy/rint(scope.sy/floorheight)
else : scope.sy
actualTileWidth =
case scope.sx >= 2 : scope.sx/rint(scope.sx/4)
else : scope.sx
towers.Mass --> Mass
lushapes.Mass --> Mass
@Group("Facade")
attr textured = true
@Group("Facade")
attr massColor = "#ffffff"
Mass -->
case textured : color(massColor) comp(f){ side: Facade | top: Roof. }
else : color(massColor) Mass.
Facade -->
setupProjection(0, scope.xy, 8*actualTileWidth, 8*actualFloorHeight)
texture(randomFacadeTexture)
projectUV(0)