/** * 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" simpleWindowTex = fileRandom("*/assets/glass?.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 roofTex = "../assets/roof.jpg" attr facadeTex = "../assets/facade.jpg" attr atticObj = "../assets/attic.dae" attr simpleWindowObj = "../assets/simple_window.dae" attr tripleWindowObj = "../assets/composite_window.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 | {~4: 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: DoubleWindowTile | ~3.5: SimpleWindowTile}* } CompositeWindowTile --> split(x) { DWindowOffset: Wall | { split(y) { CompositeWindow Wall } } | DWindowOffset: Wall } Wall CompositeWindow --> r(90, 0, 0) s('1, '0.01, '0.09) [i(tripleWindowObj) CompositeWindowGlass ] CompositeWindowGlass --> setupProjection(0,scope.xz,-scope.sx,-2.43) texture(simpleWindowTex) s('1, '1, 2.43) t('-0.05 , '0.55, '-0.98) projectUV(0) DoubleWindowTile --> split(x) { DWindowOffset: Wall | { split(y) { split(x) { 1.3: DoubleWindow | 1.3: DoubleWindow } | Wall } } | DWindowOffset: Wall } Wall DoubleWindow --> r(90, 0, 0) s(1, '0.01, '0.09) [i(simpleWindowObj) DoubleWindowGlass ] DoubleWindowGlass --> setupProjection(0,scope.xz,-scope.sx,-2.43) texture(simpleWindowTex) s('1, '1, 2.43) t(0, '0.55, '-0.98) projectUV(0) SimpleWindowTile --> split(x) { SWindowOffset: Wall | { split(y) { windowHeight: SimpleWindow | Wall } } | SWindowOffset: Wall } SimpleWindow --> r(90, 0, 0) s('1, '0.01, '0.09) [i(simpleWindowObj) SimpleWindowGlass ] SimpleWindowGlass --> setupProjection(0,scope.xz,-scope.sx,-2.43) texture(simpleWindowTex) s('1, '1, 2.43) t(0, '-0.55, '-0.98) projectUV(0) MainColumn --> split(y) { { ~floorHeight: CompositeWindowTile}* } Wall --> setupProjection(0, scope.xy, 3, 3) projectUV(0) texture(facadeTex) //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 --> setupProjection(0, scope.xy, 3, 3) projectUV(0) texture(roofTex) UnderRoof --> extrude(0.5) color("#474552")