-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathFacades.cga
142 lines (114 loc) · 3.59 KB
/
Facades.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
/**
* File: Facades.cga
* Created: 11 May 2012 19:56:15 GMT
* Author: craig mccabe
*/
version "2014.0"
@Order(1) @Range("No","Yes")
attr roofVisible = "Yes"
@Order(2) @Range(0,1)
attr bldgTransparency = 1
@Order(1) @Range("M","A","Benjarong","C","Central Plant (M)","Central Plant (O)","Central Plant (Q)","D","E","F","G","Gym","H","J","L","M","O","OA","Q","Restroom","S","U.S. Post Office","W","Z")
attr excludeBuilding = "M"
// floor & facade tile dimensions
attr FLOORCOUNT = 1 //FLOORCOUNT is an attribute of Buiilding polygon feature
attr SHORTNAME = "unknown"
attr groundfloor_height = 3.6576
attr floor_height = 3.6576
attr tile_width = 3
attr wallColor = "#ffffff"
attr windowColor = "#000000"
// textures
frontdoor_tex = "facades/textures/shopdoor.tif"
//wall_tex = "facades/textures/wall_wood_"+SHORTNAME+".jpg" // texture exterior according to building name attribute (unique texture.jpg file for each bldg)
wall_tex = "facades/textures/wall_wood_M.jpg"
dirt_tex = "facades/textures/dirtmap.15.tif"
roof_tex = "roofs/roof.jpg"
randomWindowTexture = fileRandom("facades/textures/window.*.tif")
// geometries
window_asset = "facades/elem.window.frame.obj"
Building -->
comp(f){ front : FrontFacade | side : SideFacade | top : Roof }
Lot -->
extrude(FLOORCOUNT * floor_height) Building
FrontFacade -->
setupProjection(0, scope.xy, 1.5, 1, 1)
setupProjection(2, scope.xy, scope.sx, scope.sy)
split(y){groundfloor_height : Groundfloor | { ~floor_height: Floor }* }
SideFacade -->
setupProjection(0, scope.xy, 1.5, 1, 1)
setupProjection(2, scope.xy, scope.sx, scope.sy)
split(y){ groundfloor_height : Floor | { ~floor_height : Floor }* }
Floor -->
split(x){ 0.5 : Wall | {~tile_width : Tile }* | 0.5 : Wall }
Groundfloor -->
split(x){ 0.5 : Wall | {~tile_width : Tile }* | ~tile_width: EntranceTile | 0.5 : Wall }
Tile -->
split(x){ ~1 : Wall | 2.2 : split(y){ 1: Wall | 1.7: Window | ~1: Wall } | ~1 : Wall}
EntranceTile -->
split(x){ ~1 : SolidWall | 2 : split(y){ 2.5 : Door | ~2: SolidWall } | ~1 : SolidWall}
Window -->
case scope.sx > 1.4:
split(x){ ~1: SashWin | ~1: SashWin }
else:
SashWin
SashWin -->
setupProjection(0, scope.xy, '1, '1) projectUV(0)
texture(fileRandom("assets/windowtextures/sash*"))
set(material.reflectivity, 0.1)
set(material.shininess, 10)
set(material.specular.r, 0.7)
set(material.specular.g, 0.7)
set(material.specular.b, 0.7)
/*
case SHORTNAME != excludeBuilding :
s('1,'1,0.4)
t(0,0,-0.25)
set(material.opacity,bldgTransparency)
i(window_asset)
color(windowColor)
else :
NIL
*/
Door -->
case SHORTNAME != excludeBuilding :
s('1,'1,0.1)
t(0,0,-0.5)
set(material.opacity,bldgTransparency)
texture(frontdoor_tex)
i("builtin:cube")
else:
NIL
Wall -->
case SHORTNAME != excludeBuilding :
color(wallColor)
texture(wall_tex)
set(material.opacity,bldgTransparency)
set(material.dirtmap, dirt_tex)
projectUV(0) projectUV(2)
else :
NIL
SolidWall -->
// case SHORTNAME != "M" :
case SHORTNAME != excludeBuilding :
color(wallColor)
s('1,'1,0.4)
t(0,0,-0.4)
texture(wall_tex)
set(material.opacity,bldgTransparency)
set(material.dirtmap, dirt_tex)
i("builtin:cube:notex")
projectUV(0) projectUV(2)
else :
NIL
Roof -->
// case roofVisible == "Yes" && SHORTNAME != "M":
case roofVisible == "Yes" && SHORTNAME != excludeBuilding :
setupProjection(0, scope.xy, scope.sx, scope.sy)
texture(roof_tex)
set(material.opacity,bldgTransparency)
projectUV(0)
else : NIL
RoofM -->
translate(rel, world, 0, FLOORCOUNT*floor_height, 0)
set(material.opacity,0.3)