全部的cityengine学习步骤(6)

2019-04-17 00:12

概要

设置后退值

setback(setbackDistance) { selector operator operations | selector operator operations ... }

44

参数

??setbackDistance (float):设置后退距离。 ??其他参数同comf

示例

LotInner-->Lot Lot-->

setback(5) { streetSide : Garten | remainder : Building } //设置后退距离5,后退的这部分作为绿地Garten,Lot剩余的作为Building Garten --> color(\Building-->

//Building后退距离3,选择中心的拉伸成立体建筑 offset(-3, inside)

extrude(world.y, rand(5, 15))

material.color

概要

float material.color.{r|g|b} string material.color.rgb

示例

彩虹建筑

Lot-->

extrude(20) //拉伸到20

set(material.color.g, 0) //绿色通道设置为0 split(x) {

3 : set(material.color.r, split.index/split.total) set(material.color.b, 1.0 - split.index/split.total) X

}*// 根据分割的索引与分割总数的比值来确定另外两个通道的颜色。

Split

Split属性包含两个整数(CGA 没有整型,用浮点型代替),描述上一次分割操作所有生 成元素的数量(float split.index)和当前shape的索引(float split.total)。该属性不能被重设, 在分割操作过程中写入。

示例

Lot --> extrude(20) A(A也可以不要) A --> split(y){2 : B}*

B --> case (split.index == 0) :

color(\(X可以去掉,没发现什么不同) case (split.index == split.total-1) : color(\可以去掉,没发现什么不同) else: X

多个cga规则生成随机高度

{

attr h=36

attr window=fileRandom(\墙/wall_stone_*.jpg\Lot--> extrude(h)

comp(f){side :S|top:T} S-->

//split(y){{~3:fst}*} //fst-->

//split(x){{~3:window1}*} //window1-->

setupProjection(0, scope.xy, 10,10) projectUV(0) texture(window) T-->

setupProjection(0, scope.xy, 5,5) projectUV(0)

texture(fileRandom(\

attr h=63

attr window=fileRandom(\Lot--> extrude(h)

comp(f){side :S|top:T} S-->

//split(y){{~3:fst}*} //fst-->

//split(x){{~3:window1}*} //window1-->

setupProjection(0, scope.xy, 3,3) projectUV(0) texture(window) T-->

setupProjection(0, scope.xy, 5,5) projectUV(0)

texture(fileRandom(\

简模型贴图 前后一样 (front和side一样) 全局变量(可以多建立几个不同高度的规则然后随机贴图) attr h=48

attr wall=fileRandom(\//scope.sx=BuildingHeight

Lot--> extrude(h)

comp(f){front:Front|side:Side|top:Top} Front-->

setupProjection(0, scope.xy,8,10) projectUV(0) texture(wall) Side -->

setupProjection(0, scope.xy,8 ,10) projectUV(0) texture(wall) Top-->

setupProjection(0, scope.xy, scope.sx,scope.sy) projectUV(0)

texture(fileRandom(\

}

复杂的在同一规则中随机生成不同高度加贴图贴图

version \

attr wall=fileRandom(\attr wding=fileRandom(\lot-->

case scope.sx>scope.sy:

20% :extrude(12) fw1 30% :extrude(30) fw2 30% :extrude(45) fw3 else:extrude(36) fw4 else: NIL fw1-->

comp(f){side:s1|top:T} s1-->

setupProjection(0,scope.xy,3,scope.sy/4) projectUV(0) texture(wall) fw2-->

comp(f){side:s2|top:T} s2-->

setupProjection(0,scope.xy,3,scope.sy/10) projectUV(0) texture(wall) fw3-->

comp(f){side:s3|top:T} s3-->

setupProjection(0,scope.xy,3,scope.sy/15) projectUV(0) texture(wall) fw4-->

comp(f){side:s4|top:T} s4-->

setupProjection(0,scope.xy,3,scope.sy/12) projectUV(0) texture(wall) T-->

setupProjection(0,scope.xy,scope.sx,scope.sy) projectUV(0) texture(wding)

(不同高的房屋生成的比例为0.2,0.3,0.3,0.2)下面的代码也可以改成如下:


全部的cityengine学习步骤(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:论述中国古代科技落后的原因一

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: