/** * File: Walls.cga * Created: 1 May 2018 22:56:10 GMT * Author: hrichards-rissetto2 */ version "2017.0" @Range(0,1,2,3,4) attr FIRST_Type = 4 attr height = 5 @Range(0.25,1) attr platform_height = 1 @Range(1.25,2) attr stair_width = 2 attr basemolding_platform_ratio = 0.82 attr building_platform_ratio = 0.8 attr door_height = 2 attr door_width = 1 attr roof_height = 2 attr roof_overhang = 0.25 attr roof_angle = 50 attr offset_distance = (roof_height)/(tan(roof_angle)) @Range ("Hip", "Flat") attr roof_type = "Hip" //Textures side_texture = "assets/Texture/ClayWall.jpg" side_texture2 = "assets/Texture/Bonampak_Red.jpg" top_texture = "assets/Texture/Floor.jpg" ground_texture = "assets/Texture/green_01.jpg" dirt_texture = "assets/Texture/dirt.jpg" wall_texture = "assets/Texture/ClayWall.jpg" wall_texture2 = "assets/Texture/Bonampak_Red.jpg" roof_texture = "assets/Texture/Thatch.jpg" //Set scope for base molding, break into components BaseMolding--> case FIRST_Type == 3: s('basemolding_platform_ratio,'1,'basemolding_platform_ratio) center(xyz) comp(f){front:BaseMoldFront | side:BaseMoldSide | top:Floor} case FIRST_Type == 4: s('basemolding_platform_ratio,'1,'basemolding_platform_ratio) center(xyz) comp(f){front:BaseMoldFront | side:BaseMoldSide | top:Floor} else: Building //Texture base molding sides BaseMoldFront--> case FIRST_Type == 4: setupProjection(0, scope.xy, 0.5, 0.5) projectUV(0) texture(side_texture2) case FIRST_Type == 3: setupProjection(0, scope.xy, 0.5, 0.5) projectUV(0) texture(side_texture2) else: setupProjection(0, scope.xy, 0.5, 0.5) projectUV(0) texture(side_texture) BaseMoldSide--> case FIRST_Type == 4: setupProjection(0, scope.xy, 0.5, 0.5) projectUV(0) texture(side_texture2) case FIRST_Type == 3: setupProjection(0, scope.xy, 0.5, 0.5) projectUV(0) texture(side_texture2) else: setupProjection(0, scope.xy, 0.5, 0.5) projectUV(0) texture(side_texture) //Texture base molding top Floor--> setupProjection(0, scope.xy, 10, 10) projectUV(0) texture(top_texture) ############################################################################### //Set scope for building, break into components Building--> s('building_platform_ratio,'1,'building_platform_ratio) center(xyz) comp(f){front:Front | back:Facade | side:Side | top: Roof} //Build front wall with entrance Front--> split(x) {~1:Facade | door_width : DoorSplitY | ~1:Facade} DoorSplitY--> case FIRST_Type == 4: split(y) {door_height:Door | 0.15:FrontMedialMolding | ~1:Facade | 0.15:FrontCorniceMolding} else: split(y) {door_height:Door | ~1:Facade} Facade--> case FIRST_Type == 4: split(y){door_height:Wall | 0.15:FrontMedialMolding | ~1:Wall | 0.15:FrontCorniceMolding} else: Wall //Build side walls Side--> case FIRST_Type == 4: split(y){door_height:Wall | 0.15:SideMedialMolding | ~1:Wall | 0.15:SideCorniceMolding} else: Wall //Texture walls Wall--> case FIRST_Type == 4: setupProjection(0, scope.xy, 5, 5) projectUV(0) texture(wall_texture2) case FIRST_Type == 3: setupProjection(0, scope.xy, 5, 5) projectUV(0) texture(wall_texture2) else: setupProjection(0, scope.xy, 5, 5) projectUV(0) texture(wall_texture) //Texture door Door--> color(0,0,0) //setupProjection(0, scope.xy, 0.1, 0.1) //projectUV(0) //texture(door_texture) //Build medial molding FrontMedialMolding--> extrude(face.normal, 0.1) comp(f){top:MedMoldFront | world.up:MedMoldTop | world.down:MedMoldBottom} SideMedialMolding--> extrude(face.normal, 0.1) comp(f){top:MedMoldFront | world.up:MedMoldTop | world.down:MedMoldBottom | side:MedMoldExtension} //Texture medial molding MedMoldFront--> setupProjection(0, scope.xy, 0.1, 0.1) projectUV(0) texture(side_texture2) MedMoldSide--> setupProjection(0, scope.xy, 0.1, 0.1) projectUV(0) texture(side_texture2) MedMoldBottom--> setupProjection(0, scope.xz, 0.1, 0.1) projectUV(0) texture(side_texture2) MedMoldTop--> setupProjection(0, scope.xz, 0.1, 0.1) projectUV(0) texture(side_texture2) MedMoldExtension--> extrude(face.normal,0.1) comp(f){top:MedMoldFront | back:MedMoldFront | world.up:MedMoldTop | world.down:MedMoldBottom} ########################################################################################### //Build cornice Molding FrontCorniceMolding--> extrude(face.normal, 0.1) comp(f){top:CornMoldFront | world.up:CornMoldTop | world.down:CornMoldBottom} SideCorniceMolding--> extrude(face.normal, 0.1) comp(f){top:CornMoldFront | world.up:CornMoldTop | world.down:CornMoldBottom | side:CornMoldExtension} //Texture cornice molding CornMoldFront--> setupProjection(0, scope.xy, 0.1, 0.1) projectUV(0) texture(side_texture2) CornMoldSide--> setupProjection(0, scope.xy, 0.1, 0.1) projectUV(0) texture(side_texture2) CornMoldBottom--> setupProjection(0, scope.xz, 0.1, 0.1) projectUV(0) texture(side_texture2) CornMoldTop--> setupProjection(0, scope.xz, 0.1, 0.1) projectUV(0) texture(side_texture2) CornMoldExtension--> extrude(face.normal,0.1) comp(f){top:CornMoldFront | back:CornMoldFront | world.up:CornMoldTop | world.down:CornMoldBottom}