// Source: peyep 官方 demo 回填(原始 cityengine 规则)· https://www.peyep.com/#/demo/building-glass-20260928 version "2025.1" @Range(min=10, max=120) attr length = 32 @Range(min=10, max=50) attr width = 17 heightA = case scope.sx>scope.sz : 2*scope.sx else : 2*scope.sz heightB = case scope.sx>scope.sz : 2*scope.sx else : 2*scope.sz heightC = case scope.sx>scope.sz : 2*scope.sx else : 2*scope.sz @Color attr HighBuilding_Color="#6892d7" attr Border_Color = "#C0C0C0" const Tile_Width=1.8 const FloorTop_Hight=0.1 const Frame_Width=0.11 ##############执行规则############## @StartRule Lot--> primitiveQuad(length, width) block block--> [ BranchA ] block_b block_b--> [ BranchB ] block_c block_c--> BranchC BranchA--> extrude(heightA) BuildOut BranchB--> offset(-0.1,inside) extrude(heightB) BuildFloor BranchC--> offset(-3,inside) extrude(heightC) color(1,1,1,0.5) BuildMiddle. BuildOut--> split(y) { 12 : ground_foor | 9 : ground_foor| {5:FloorVolume}*|~1:topfloor} ground_foor--> comp(f) {side:ground_Sides} ground_Sides--> split(x) {~7*Tile_Width : GFloorTile }* GFloorTile --> split(x) {'0.3: GFloorTile1| '0.4: GFloorTile1| '0.3:GFloorTile1} GFloorTile1--> split(y) {'0.37: GFloorTile2| '0.63: GFloorTile2} GFloorTile2--> offset(-Frame_Width) comp(f) {border : color(Border_Color) Frame. | inside : Glass} FloorVolume--> comp(f) {top : offset(-0.1, inside) FloorTop| side:FloorSides} FloorTop --> color(0.5,0.5,0.5) FloorSides --> split(x) {~Tile_Width : FloorTile }* FloorTile --> offset(-Frame_Width) comp(f) {border : color(Border_Color) Frame. | inside : Glass} ##玻璃材质 Glass --> color(HighBuilding_Color) set(material.opacity, 0.4) set(material.specular.r,0.6) set(material.specular.g,0.6) set(material.specular.b,0.6) set(material.shininess,50) set(material.reflectivity, 0.2) ################楼层规则##################### BuildFloor--> split(y) { 0.1 :Buildbase. | 9 :NIL | 0.5 :Floorbase | 8.5 :NIL | {0.5 : Floorbase |5 : Floorhouse |0.5 : Floorbase }* | ~1 :Floorbase } Floorhouse--> NIL ################建筑顶层##################### topfloor--> comp(f) { top : topface | side : Glass} topface--> offset(-1.5) comp(f){ border : RoofEdge | inside : RoofFlat1 } RoofFlat1 --> //extrude(6) RoofFlat_satter RoofFlat RoofFlat_satter-->NIL # offset(-5, inside) # scatter(surface, 5, gaussian) { topcube } # topcube--> # primitiveCube(5, 3, 4) RoofFlat--> extrude(0.5) Glass RoofEdge --> extrude(1.5) Glass