太和殿
Hall_of_supreme_harmony_cn_1.1
/**
* File: TaiHe2022.1-1.0.cga
* Created: 28 Nov 2022 03:27:59 GMT
* Author: mapda
*/
version "2022.1"
@Group("城市幻象","英文网站",0)
attr cityvistion_en = "www.createurban.com"
@Group("城市幻象","中文网站",0)
attr cityvistion_zh = "www.createurban.cn"
#####
##### attr
# color
const basecolor = "#E0E0E0"
const brickcolor = "#d0d0d0"
const columnbasecolor = "#9D9D9D"
const columncolor ="#A73630"
const wallcolor = "#FF9797"
const roofcolor = "#9F5000"
const wincolor = "#D9B3B3"
const doorcolor = "#B87070"
const beamcolor = "#95CACA"
#lot
# @Group("地块控制","长度",10)@Range(min=32, max=120)@Order(1)
# //@Hidden
# attr harmony_length = 68
# @Group("地块控制","宽度",11)@Range(min=17, max=52)@Order(2)
# //@Hidden
# attr harmony_width = 41
@Group("地块控制","旋转",12)@Range(min=0, max=360,stepsize=90)
attr rotate_angle = 0
@Group("地块控制","地基高度",13)@Range(min=0.2, max=2)
attr baseheight = 0.35
#column
@Group("柱","宽度",50)@Range(min=0.5, max=9)
@Hidden
attr columnwidth =columnradiu*3.5
@Group("柱","面数",50) @Range(min=4, max=32)
@Hidden
attr column_facenum = 16
@Group("柱","半径",50) @Range(min=0.1, max=1.2)
@Hidden
attr columnradiu = 0.5
@Group("柱","高度",50) @Range(min=3, max=15)
attr columnheight = columnradiu*11
@Group("柱","颜色",50) @Color
attr column_color = "#A73630"
#roof
# @Group("屋顶","顶层坡度",30) @Range(min=10, max=50)
# attr top_roof_angle = 37
@Group("屋顶","屋顶坡度",30) @Range(min=10, max=50)
attr base_roof_angle= 27
@Group("roof","middle height" ,32) @Range(min=1, max=5)
const roof_middle_height = columnwidth*2
@Group("屋顶","屋檐长度",30) @Range(min=1, max=5)
@Hidden
attr roof_off_distance = 3.5
@Group("屋顶","递增坡度",30)@Range(min=5, max=9,stepsize=0.1)
attr roof_step_angle = 7
@Group("屋顶","弯曲比例",30)@Range(min=0.25, max=0.35,stepsize=0.01)
attr roof_percent = 0.3
@Group("墙体","显示关闭",20)@Enum("显示", "关闭")
attr wall_show = "显示"
@Group("墙体","开间宽度",20)@Range(min=2, max=15)
attr center_width = 7
##### function
##
# gethight=
# # case scope.sx>scope.sz :scope.sx/9
# # else : scope.sz/9
# case geometry.area >= 2100 : 9
# case geometry.area >= 1500 : 8
#
# case geometry.area >= 1000 : 7
# else : 5
#
# getradiu =
# case scope.sx > scope.sz : scope.sx
# else : scope.sz/90
dist = comp(fe){
// inside : 2.5
back : 3.5
| front : 1.5
| left : 1
| right : 1
}
dists = comp(fe){ front = 6 |
back = scope.sx/12 |
side = 0.1
}
##### extension
## roofstyle
##################################
##### 中国古建筑屋顶类型扩展
//重檐歇山顶
extension DoubleGableAndHipRoof-->
roofHip(32,scope.sx/9)
split(y){'0.35:bottomroof | ~1 :
primitiveQuad
GableHiplot
t(0,scope.sx/5,0)
//roofGable(32,scope.sx/15)
roofHip (32,scope.sx/9)
split(y){'0.35:bottomroof |
~1 :primitiveQuad roofGable(39,scope.sx/20) GableHipbox
}
Gable_Hipbox
}
GableHiplot--> extrude(scope.sx/5)
//重檐庑殿顶
extension DoubleHipAndHipRoof-->
roofHip(32,scope.sx/9)
split(y){'0.35:bottomroof | ~1 :
primitiveQuad
HipHiplot
t(0,scope.sx/5,0)
roofHip(32,scope.sx/15)
Hip_Hipbox
}
HipHiplot--> extrude(scope.sx/5)
//歇山顶
extension GableAndHipRoof-->
roofHip(32,scope.sx/9)
split(y){'0.35:bottomroof | ~1 :
primitiveQuad
roofGable(39,scope.sx/20)
GableHipbox
}
//庑殿顶
extension HipRoof-->
roofHip(39,scope.sx/20)
Hipbox
// 硬山顶
extension GableRoof-->
roofGable(35,scope.sx/17)
Gablebox
//攒尖顶
extension PyramidRoof-->
roofPyramid(32)
Pyramidbox
//roofHip(32,scope.sx/17)
//split(y){'0.5:HipFlatbox}
//盝顶 庑殿顶平屋顶的组合
extension HipFlatRoof-->
roofHip(32,scope.sx/17)
split(y){'0.5:HipFlatbox}
//盔顶
extension PyramidFlatRoof-->
roofPyramid(32)
split(y){'0.5:PyramidFlatbox}
//Pyramidbox
// 平屋顶
extension ShedRoof-->
//extrude(scope.sx/20)
roofShed(9,0)
Shedbox
/////特殊的类型 屋顶屋檐
extension HipFlatSideRoof-->
roofHip(32,scope.sx/12)
split(y){'0.15:HipFlatbox}
##################################
##### 中国古建筑屋重楼阁类型
##############################################
##############################################
################# 执行规则 ##################
##############################################
##############################################
@StartRule
Taihe-->
r(scopeCenter, 0, rotate_angle, 0)
//primitiveQuad(harmony_length, harmony_width)
setback(dist) { all : extrude(baseheight) Taihe_base |
remainder : t(0, baseheight, 0) Taihe_build_lot }
Taihe_base-->
color(basecolor)
Taihe_build_lot-->
Taihe_column
Taihe_roof
Taihe_beam
Taihe_wall
Taihe_house
Taihe_roofside
RoofandRoof
Taihe_hiproof
Taihe_winanddoor
#####################
#### 生成柱 #####
#####################
Taihe_column-->
case scope.sx > scope.sz :
split(x){ scope.sx/90 : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }* | scope.sz/30 : column }
| scope.sx/90*5 : columnspace
| {scope.sx/90 : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }* | scope.sz/30 : column }
|scope.sx/90*7 : columnspace
} *
| scope.sx/90 : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }* | scope.sz/30 : column }
| ~scope.sx/90*9 : centerroad
| scope.sx/90 : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }* | scope.sz/30 : column }
| {scope.sx/90*7 : columnspace
|scope.sx/90 : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }* | scope.sz/30 : column }
} *
| scope.sx/90*5 : columnspace
| scope.sx/90 : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }* | scope.sz/30 : column }
}
else :
split(z){ scope.sz/90 : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }* | scope.sx/30 : column }
| scope.sz/90*5 : columnspace
| {scope.sz/90 : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }* | scope.sx/30 : column }
|scope.sz/90*7 : columnspace
} *
| scope.sz/90 : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }* | scope.sx/30 : column }
| ~scope.sz/90*9 : centerroad
| scope.sz/90 : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }* | scope.sx/30 : column }
| {scope.sz/90*7 : columnspace
|scope.sz/90 : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }* | scope.sx/30 : column }
} *
| scope.sz/90*5 : columnspace
| scope.sz/90 : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }* | scope.sx/30 : column }
}
column-->
//primitiveQuad(column_width, column_width)
extrude(world.up.flatTop, 0.01)
comp(f) { side : column_tex_copy | top : columnbase_top }
columnbase_top-->
alignScopeToAxes(world.y)
column_tex_copy
primitiveCone(column_facenum, columnradiu*1.5, columnradiu)
split(y){'0.1 : column_base
| ~5 : column_main }
column_base-->
color("#9D9D9D")
column_main-->
color(column_color)
primitiveCylinder(column_facenum, columnradiu, columnheight)
//柱础基贴图
column_tex_copy-->
color("#9D9D9D")
//生成墙外铺地砖外部底面
centerroad-->
color("#BEBEBE")
//柱之间地块铺装
columnspace-->
color("#d0d0d0")
###################
##### 太和房间
Taihe_house-->
extrude(baseheight+columnheight)
house_box
house_box-->
case scope.sx> scope.sz : split(z){ { scope.sz/30 : column | ~scope.sz/30*5 : columnspace }*
| scope.sz/30*5 : split(x){scope.sx/90 : wall_tin
| ~10 : NIL
| scope.sx/90 : wall_tin}
|~scope.sz/30 : NIL
}
//split(z){~10 :BOX| scope.sx/30*5 : NIL }
else : split(x){ { scope.sx/30 : column | ~scope.sx/30*5 : columnspace }*
| scope.sx/30*5 : split(z){scope.sz/90 : wall_tin
| ~10 : NIL
| scope.sz/90 : wall_tin}
|~scope.sx/30 : NIL
}
######################
#形成梁架体系
Taihe_beam-->
beam_down
beam_up
beam_down-->
t(0,columnheight,0)
setback(columnwidth*0.47) { all : NIL | remainder : setback(columnradiu) { all : beam_lot | remainder : NIL } }
beam_up-->
t(0,columnheight+0.75,0)
setback(columnwidth*0.4) { all : NIL | remainder : setback(columnradiu) { all : beam_lot | remainder : NIL } }
beam_lot-->
extrude(columnradiu*2)
comp(f){all : beam_tex}
beam_tex-->
color("#95CACA")
#########################
#形成屋顶
Taihe_roofside-->
color(roofcolor)
t(0,baseheight+columnheight+3,0)
HipFlatSideRoof
RoofandRoof-->
t(0,baseheight+columnheight+2,0)
color(beamcolor)
extrude(3)
RR
Taihe_hiproof-->
t(0,baseheight+columnheight+5.5,0)
# HipRoof
RoofBox
# Taihe_roof-->
# t(0,columnheight+baseheight+columnradiu*7,0)
# roofHip(base_roof_angle,roof_off_distance)
#
# split(y) { '0.25 : fengxian_roofside_one
# | ~5 : t (0,roof_middle_height*1.2,0)
# primitiveQuad
# roofHip(base_roof_angle,roof_off_distance)
# # fengxian_roofside
# RoofBox
# }
#
# //首层屋顶
# fengxian_roofside_one-->
# comp(f) { horizontal : fengxian_roofone_top | all : fengxian_roofside }
#
# fengxian_roofone_top-->
# case geometry.isOriented(world.up) : extrude(roof_middle_height*1.1) fengxian_roofmiddle_facade
#
# else : NIL
#
# fengxian_roofside-->
# comp(f) { all : fengxian_roofside_tex }
# fengxian_roofside_tex-->
# color("#9F5000")
#
# fengxian_roofmiddle_facade-->
# comp(f){side : split(y) { '0.5 : roofmiddle_tex
# | '0.3 : comp(f){side : roofShed(30)dougong}} } //斗拱贴图位置
#
# roofmiddle_tex-->
# color("#95CACA")
#
#
#
# dougong-->
# comp(f){side :dougong_tex }
#
# dougong_tex-->
# color("#95CACA")
#
#
//重檐屋顶坡度递增
RoofBox-->
roofHip(32,1.5)
split(y) { 'roof_percent : roofbottom | ~2 : NIL }
roofbottom-->
comp(f) { horizontal : roof_up_one
| all : harmony_roofside}
roof_up_one-->
case geometry.isOriented(world.up) : roofHip(base_roof_angle+roof_step_angle) split(y){'roof_percent : roofbottom_one | ~2 : NIL }
else : NIL
roofbottom_one-->
comp(f) { horizontal : roof_up_two
| all : harmony_roofside}
roof_up_two-->
case geometry.isOriented(world.up) : roofHip(base_roof_angle+roof_step_angle*2) split(y){'roof_percent : roofbottom_two | ~2 : NIL }
else : NIL
roofbottom_two-->
comp(f) { horizontal : roof_up_three
| all : harmony_roofside}
roof_up_three-->
case geometry.isOriented(world.up) : roofHip(base_roof_angle+roof_step_angle*3)
comp(f){side:harmony_roofside}
else : NIL
//屋顶贴图
harmony_roofside-->
color("#9F5000")
/*
*/
[/riplus-hide]
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
