I'm working with the .cga script in the Example_Downtown_Damage_2014_0 that damages certain houses within the scene. I'm trying to change the levels of damage to represent more damage to the buildings. The code calls a handle @damage to specify how much the building changes. Can anyone point me towards the part of the code that can be changed to depict further damage to the building? The script for alstadthaus_heavydamage.cga is below:
/ **
* Author: matt, Esri R & D Center Zurich
* /
version "2013.1"
Import smoke: "smoke.cga"
######################
#
# ATTRIBUTE
#
######################
Range (2.6)
attr = 5 tilespacing
Range (12,26)
attr building height = rand (12,26)
Range (2.5,4.5)
attr stock = 3.5
Group ("Damage")Range (-1.2)
attr = 0 offset_damage
Group ("Damage")Range (-1.5)
attr = 0 offset_damage2
Range (0.16)
attr Ground Floor = 5
const orientation =
Case scope.sx> scope.sz: 0
else: 1
const wall thickness = 2
const = rint floors (building height / stock)
const CorrVal = 2
######################
#
# ASSETS
#
######################
const bruch_gr2 = "tiles / town house / demolished / bruch_gr2.obj"
const bruch_kl1_2 = "tiles / town house / demolished / bruch_kl1_2.obj"
const bruch_kl2_2 = "tiles / town house / demolished / bruch_kl2_2.obj"
const bruch_kl3_2 = "tiles / town house / demolished / bruch_kl3_2.obj"
const bruch_binde2 = "tiles / town house / demolished / bruch_binde2.obj"
# bruch_gr = "brown / doppelfenster_br.obj"
const bruch_gr = "tiles / town house / demolished / bruch_gr.obj"
const bruch_kl = "tiles / town house / demolished / bruch_kl.obj"
const bruch_kl2 = "tiles / town house / demolished / bruch_kl2.obj"
const bruch_kl3 = "tiles / town house / demolished / bruch_kl3.obj"
const bruch_binde = "tiles / town house / demolished / bruch_binde.obj"
const = roof "tiles / town house / demolished / dach_cln.obj"
stb = 70%: "tiles / town house / demolished / stockwerkboden.obj"
else "tiles / town house / demolished / stockwerkboden2.obj"
###
# stb = "collapse / stockwerkboden.obj"
const schauF1 = "tiles / town house / shop_rec1.obj"
const schauF2 = "tiles / town house / shop_round1.obj"
##
# win = "OrnateFinal / win_breit.obj"
const win = "tiles / town house / double.obj"
const door = "tiles / town house / door.obj"
const hole = "tiles / town house / demolished / doubleH.obj"
const Ledge = "pillar / ledge.obj"
LotInner ->
Solder
Lot ->
smoke.Smoke
GroundFilled
innerRect
alignScopeToGeometry (yup, 0, orientation)
extrude (building height)
comp (f) {top: alignScopeToGeometry (ZUP, 0, orientation) above (scope.sx)
| left: IntakteWand | right: niedereSeite
| back: back | front: Front
| bottom: reverse normals alignScopeToGeometry (ZUP, 0, orientation) down (scope.sy)}
Ground floor -> Split {
// Bar width / 2: beams
{~ Ground Floor: Ground Element (split.index)} *
# | 1: bars (0)
}
Ground Element (nr) -> Case nr == 3: i (door) t (0,0, -0.75)
Case No.% 2 == 0: i (schauF2) t (0,0, -scope.sz)
else i (schauF1) t (0,0, -scope.sz)
Top -> Split {tilespacing: top serviceability (split.index, split.total)} *
above (xLength) -> Split {((getRatio ((xLength / tilespacing), floors) + offset_damage * 0.9) * tilespacing): Roof
}
#AM floor are the stories generated
below (origWidth) ->
extrude (building height) floor Split
Floor Split ->
split (y) {Ground Floor: NIL
| {~ stock: story floor (split.index, split.total)} *}
story floor (in, to) ->
split {~ 1: floor Asset | ~ ((in-2) / (to)): NIL}
Floor Asset ->
setPivot (xyz floor, (rand (1,4))) #randomly rotate asset to create variation
set (trim.vertical, false)
s (scope.sx-1, '1, scope.sz-0.2) center
i (stb)
#Baut Space for the roof by 1 jump 1 element is scaled ---
Top serviceability (index, total) ->
Case Index == 0:
s ('1 * getRatio (total, floors), scope.sy + getRatio (total, floors),' 1) Roof
else: NIL
Roof ->
set (trim.vertical, false) s (scope.sx * (2.5-offset_damage) scope.sy + scope.sy * 0075, '1)
Center (y) t (-0.5,0,0) i (roof)
niedereSeite ->
split (y) {
Ground Floor: Ground floor
| 1: Ledge (1)
| {~ stock: front floor (split.index, split.total)} *
}
front floor (ind, dead) ->
Case ind <= offset_damage + CorrVal-1:
PlatteF
Case ind <= offset_damage + CorrVal:
33%: i (bruch_kl) reverse normals s ('1,3, -1) 34%: i (bruch_kl2) reverse normals s (' 1,2, -1) else: i (bruch_kl3) reverse normals s ('1,2.7, -1)
else: NIL
IntakteWand -> Split (y) {
Ground Floor: Ground floor
| 1: Ledge (1)
| {~ stock: plate} *
}
PlatteF -> Split {~ tilespacing: FensterF} *
FensterF -> 85%: i (win) t (0,0, -0.39)
else i (hole) t (0,0, -scope.sz-0025)
Disk -> Split {~ tilespacing: window} *
Window -> i (win) t (0,0, -0.35)
high side -> color ("# ad45d8")
back -> Split (y) {Ground Floor: Ground floor | 1: Ledge (1) | ~ 1000: rear2}
rear2 -> Split {~ tilespacing: split height (split.index, split.total, 1)} *
front -> Split (y) {Ground Floor: Ground floor | 1: Ledge (1) | ~ 1000: vorne2} *
vorne2 -> Split {~ tilespacing: split height (split.index, split.total, 0)} *
split height (Xnr, maxElementsX, side) ->
Case page == 0:
split (y) {
#groundfloor: Ground
# | 1: Ledge (1)
{~ stock: plate (Xnr, split.index, maxElementsX, split.total, 0, page)} *
}
else:
split (y) {
#groundfloor: Ground
# | 1: Ledge (1)
{~ stock: plate ((abs (Xnr-maxElementsX) -1), split.index, maxElementsX, split.total, 1 page)
} *}
getRatio (maxElementsX, maxElementsY) = (ceil (1 / (maxElementsY / maxElementsX)))
#
Plate (Xnr, YNR, maxElementsX, maxElementsY, front, side) ->
#STATEMENT:
# Akt.x Stocknr. flipped how many y to Zeilensrpung above insertion of objects
Case page == 0:
Case Xnr> = (((abs (YNR-maxElementsY)) * getRatio (maxElementsX, maxElementsY)) + offset_damage) && YNR == maxElementsY- (abs (YNR-maxElementsY)) && yNr!=0:Einriss(seite,getRatio(maxElementsX,maxElementsY),xNr-((abs(yNr-maxElementsY))+offset_damage)*getRatio(maxElementsX,maxElementsY),maxElementsX,xNr)
else: 85%: i (win) t (0.0, -0.4) s ('1,' 1, '2) // W. i ("builtin: cube") s ('1,' 1, wall thickness * 0.4) texture ("tex_ornate_win2.jpg") end Wall
else i (hole) t (0.0, -0.4) s ('1,' 1, '1.6)
else:
Case Xnr> = (((abs (YNR-maxElementsY)) * getRatio (maxElementsX, maxElementsY)) + offset_damage2) && YNR == maxElementsY- (abs (YNR-maxElementsY)) && yNr!=0:Einriss(seite,getRatio(maxElementsX,maxElementsY),xNr-((abs(yNr-maxElementsY))+offset_damage2)*getRatio(maxElementsX,maxElementsY),maxElementsX,xNr)
else: 85%: i (win) t (0.0, -0.4) s ('1,' 1, '2) // W. i ("builtin: cube") s ('1,' 1, wall thickness * 0.4) texture ("tex_ornate_win2.jpg") end Wall
else i (hole) t (0.0, -0.4) s ('1,' 1, '1.6)
Tear (page ratio, number, maxElementsX, Xnr) ->
Case Number> Ratio: NIL
Case page == 0:
Case number == 0: i (bruch_gr) s ('1, scope.sy, wall thickness * 0:35) t (0,0, -mauerdicke * 0:20)
Case number == ratio: i (bruch_binde) s (scope.sx/4.1,scope.sy/8.5,mauerdicke*0.435) t (0,0, -mauerdicke * 0:33)
Case number> 0 && number <Ratio: // && Xnr = maxElementsX:
33%: i (bruch_kl) s ('1, scope.sy / 3, wall thickness 0.25 *) t (0,0, -mauerdicke * 0.20) // color ("# afff00")
33%: i (bruch_kl2) s ('1, scope.sy / 4, wall thickness * 0.25) t (0,0, * -mauerdicke 00:20) // color ("# afff00")
else i (bruch_kl3) s ('1, scope.sy / 3, wall thickness * 0.25) t (0,0, * -mauerdicke 00:20) // color ("# afff00")
else:
85%: i (win) t (0.0, -0.4) s ('1,' 1, wall thickness * 0.5) // W. i ("builtin: cube") s ('1,' 1, wall thickness * 0.4) texture ("tex_ornate_win2.jpg") end Wall
else i (hole) t (0,0, -scope.sz-0025)
else:
Case number == 0 && Xnr = 1: i (bruch_gr2) s ('1 scope.sy, wall thickness * 0:35) t (0,0, -mauerdicke * 0.2)
Case number == ratio: i (bruch_binde2) s (scope.sx/4.1,scope.sy/8.5,mauerdicke*0.25) t (scope.sx * 3.11,0, -mauerdicke * 0.2)
Case number> 0 && number <Ratio: // && Xnr = maxElementsX:
33%: i (bruch_kl1_2) s ('1, scope.sy / 3, wall thickness * 0.25) t (0,0, * -mauerdicke 00:20) // color ("# afff00")
33%: i (bruch_kl2_2) s ('1, scope.sy / 4, wall thickness 0.25 *) t (0,0, -mauerdicke * 0.20) // color ("# afff00")
else i (bruch_kl3_2) s ('1, scope.sy / 3, wall thickness * 0.25) t (0,0, * -mauerdicke 00:20) // color ("# afff00")
else:
85%: i (win) t (0.0, -0.4) s ('1,' 1, wall thickness * 0.5) // W. i ("builtin: cube") s ('1,' 1, wall thickness * 0.4) texture ("tex_ornate_win2.jpg") end Wall
else i (hole) t (0,0, -scope.sz-0025)
Ledge (size) -> S ('1.3,' 1.1) center i (Ledge)
End Wall ->
scaleUV (0, 0.1, .11)
comp (f) {front: NIL | back: NIL | all: Wall}.
Import cy: "courtyard.cga"
Ground -> cy.FloorTexture
GroundFilled -> cy.LotInner