/** * File: building.cga * Created: 17 Nov 2013 16:30:33 GMT * Author: Tomas */ version "2011.2" attr LOD = 1 attr buildingHeight = 16 attr floorHeight = 3.5 attr groundFloorHeight = 5 attr DWindowOffset = 0.7 attr SWindowOffset = 0.9 attr windowHeight = 2.3 attr roofSideOffset = 2 attr domeSize = 5 attr atticSize = 2 attr doubleWindowTex = "../assets/double_window.jpg" attr simpleWindowTex = "../assets/glass1.jpg" attr shopWindowTex = "shop_window.jpg" attr doorTex = "../assets/door.png" attr bigDoorTex = "../assets/big_door.jpg" attr wideWindow2Tex = "wide_window_2.jpg" attr wideWindow3Tex = "wide_window_3.jpg" attr atticObj = "../assets/attic.dae" Lot --> extrude(buildingHeight) Building Building --> comp(f) { front: FrontF | side: SideF | top: Roof } SideF --> Wall FrontF --> split(y) { groundFloorHeight: GroundFloor | MainFront | 0.4: UnderRoof } GroundFloor --> split(x) { ~3: ShopWindowTile | ~3: DoorTile | {~3: ShopWindowTile}* | ~5: BigDoorTile } ShopWindowTile --> split(x) { DWindowOffset: Wall | { split(y) { Wall | windowHeight: ShopWindow | Wall } } | DWindowOffset: Wall } ShopWindow --> setupProjection(0, scope.xy, '1, '1) projectUV(0) texture(shopWindowTex) set(material.shininess, 4) DoorTile --> split(x) { DWindowOffset: Wall | { split(y) { Door | (groundFloorHeight-windowHeight)/2: Wall } } | DWindowOffset: Wall } Wall Door --> t(0, 0, 0.01) setupProjection(0, scope.xy, '1, '1) projectUV(0) texture(doorTex) set(material.shininess, 4) BigDoorTile --> split(x) { DWindowOffset: Wall | { split(y) { BigDoor | (groundFloorHeight-windowHeight)/2: Wall } } | DWindowOffset: Wall } BigDoor --> setupProjection(0, scope.xy, '1, '1) projectUV(0) texture(bigDoorTex) set(material.shininess, 4) MainFront --> split(x) { MainFrontWindows | 5: MainColumn } MainFrontWindows --> split(y) { { ~floorHeight: Floor}* } Floor --> split(x) { { ~3.5: WideWindowTile(1) | ~3.5: SimpleWindowTile}* } WideWindowTile(windowID) --> split(x) { DWindowOffset: Wall | { split(y) { windowHeight: WideWindow(windowID) | Wall } } | DWindowOffset: Wall } WideWindow(windowID) --> setupProjection(0, scope.xy, '1, '1) projectUV(0) texture( case windowID == 1: doubleWindowTex else: case windowID == 2: wideWindow2Tex else: wideWindow3Tex ) set(material.shininess, 4) SimpleWindowTile --> split(x) { SWindowOffset: Wall | { split(y) { windowHeight: SimpleWindow | Wall } } | SWindowOffset: Wall } SimpleWindow --> setupProjection(0,scope.xy, '1, '1) projectUV(0) texture(simpleWindowTex) set(material.shininess, 4) MainColumn --> split(y) { { ~floorHeight: WideWindowTile(1)}* | ~floorHeight: WideWindowTile(2) | ~floorHeight: WideWindowTile(3) } Wall --> color("#B8A48C") Roof --> roofGable(20) split(x) { ~3: RoofSurface | {~5: AtticTile}* | ~3: RoofSurface } AtticTile --> split(y) { ~0.2: RoofSurface | split(x) { ~2: RoofSurface | atticSize: Attic | ~2: RoofSurface } | RoofSurface } RoofSurface Attic --> s(atticSize, atticSize, '0.5) t(0, 0, '1) i(atticObj) RoofSurface --> color("#ff7255") UnderRoof --> extrude(0.5) color("#474552")