// Source: https://www.peyep.com/#/demo/skel-res-013 // License: CC-BY-4.0 · 保留本头注释即满足署名 · peyep 万物皆代码库 // peyep skeleton variant skel-res-013 (highrise-residential) // attrs: {"floors": 31, "roof_style": 0, "window_type": 0, "palette": 6, "balcony": 0} /** * 骨架: 高层住宅楼 (highrise-residential) v1.2 立面分区版 * 引擎适配: 单质量体+立面split分区(体积split/comp顶面extrude/s()+center在v0.2.0有缺陷已规避) * 风格模块: 4屋顶处理 × floors变化 × 5窗型 × 8配色 × 2阳台 */ attr floors = 31 // 8..40 attr floor_h = 3.0 attr roof_style = 0 // 0标准顶层 1女儿墙带 2退台豪宅顶层 3设备冠层 attr window_type = 0 // 0大窗 1条窗 2落地窗 3小方窗 4三格窗 attr palette = 6 // 0..7 attr balcony = 0 // 0无 1有(阳台挑板) const wall_c = case palette == 1 : "#c9b99a" case palette == 2 : "#b8c4cc" case palette == 3 : "#d8cfc2" case palette == 4 : "#a89880" case palette == 5 : "#ccd6dd" case palette == 6 : "#e0d5c8" case palette == 7 : "#b0a89c" else : "#e8e2d6" const accent_c = case palette == 1 : "#8a7a5c" case palette == 2 : "#5a7a8c" case palette == 3 : "#a89880" case palette == 4 : "#6e5f4c" case palette == 5 : "#4a6a7c" case palette == 6 : "#988870" case palette == 7 : "#5c5648" else : "#9a8e7a" const glass_c = case window_type == 2 : "#5a8aa8" case window_type == 4 : "#6a9ab8" else : "#7ab0cc" const win_h = case window_type == 1 : 1.2 case window_type == 2 : 2.1 case window_type == 3 : 1.0 else : 1.6 const sill_h = case window_type == 2 : 0.3 else : 0.7 const rest_h = floor_h - sill_h - win_h Lot --> extrude(floors * floor_h) Mass Mass --> comp(f){ side: Facades | top: Roof } Roof --> color("#9a9a92") RoofLeaf // ---- 立面总分区: 顶部按屋顶模块处理 ---- Facades --> case roof_style == 1 : split(y){ (floors - 1) * floor_h: NormZone | floor_h: ParapetZone } case roof_style == 2 : split(y){ (floors - 1) * floor_h: NormZone | floor_h: PentZone } case roof_style == 3 : split(y){ floors * floor_h - 2.2: NormZone | 2.2: VentZone } else : split(y){ floor_h: Floor }* NormZone --> split(y){ floor_h: Floor }* Floor --> split(x){ ~1: Bay }* Bay --> split(x){ 0.5: WallSeg | ~2.6: WinSeg | 0.5: WallSeg } WallSeg --> color(wall_c) WallLeaf WinSeg --> split(y){ ~sill_h: Sill | ~win_h: Glass | ~rest_h: Lintel } Sill --> color(accent_c) SillExt SillExt --> extrude(0.08) SillLeaf Glass --> color(glass_c) GlassExt GlassExt --> case window_type == 3 : split(x){ ~1: Pane | 0.12: Mullion | ~1: Pane } case window_type == 4 : split(x){ ~1: Pane | 0.08: Mullion | ~1: Pane | 0.08: Mullion | ~1: Pane } else : extrude(-0.05) GlassLeaf Pane --> extrude(-0.05) PaneLeaf Mullion --> color(accent_c) MullionExt MullionExt --> extrude(0.03) MullionLeaf Lintel --> case balcony == 1 : color(accent_c) BalconyExt else : color(accent_c) LintelLeaf BalconyExt --> extrude(0.55) BalconyLeaf // ---- 屋顶模块(立面顶部处理, 4式) ---- ParapetZone --> split(y){ ~2.0: ParaBand | 1.0: ParaRim } ParaBand --> color(accent_c) ParaBandLeaf ParaRim --> color(accent_c) ParaRimExt ParaRimExt --> extrude(0.15) ParaRimLeaf PentZone --> split(x){ 0.4: PWall | ~3.2: PWin | 0.4: PWall }* PWall --> color(accent_c) PWallLeaf PWin --> split(y){ 0.3: PSill | ~2.2: PGlass | 0.4: PLintel } PSill --> color(accent_c) PSillLeaf PGlass --> color("#4a7a98") PGlassExt PGlassExt --> extrude(-0.08) PGlassLeaf PLintel --> color(accent_c) PLintelLeaf VentZone --> split(y){ 0.6: VentDark | 1.0: VentSlat | 0.6: VentDark2 } VentDark --> color("#4a4a44") VentDarkLeaf VentSlat --> split(x){ ~0.8: Slat | 0.25: SlatGap }* Slat --> color("#8a9298") SlatLeaf SlatGap --> color("#3a3a36") SlatGapLeaf VentDark2 --> color("#4a4a44") VentDark2Leaf