程序化建模(城市大楼)

一个小练习:主要用的是通过得到OSM文件中的地图信息和各建筑的信息,调用其建筑属性,来分别先对一个建筑进行进行建模后,再通过for each节点对所选择的各建筑进行遍历。将构建过程赋予每一个所希望生成的大楼。

 Attribute Wrangle1:

f@level_height = ch('floorHeight'); //输入建筑楼层高度
i@stories_level = atoi(s@building_levels);  //获取文件中原数据楼层数量
float min_height = ch('minHeight'); //移动的最低数量
int prim = chi('prim');     //获取遍历中每个建筑的prim数据
float seed = ch('seed');    //随机种子
if(!@stories_level){        //如果楼层数量为0,则手动增加其随机楼层数
i@stories_level = int(rand(prim * seed) * 20 + min_height);
}
f@zscale = (i@stories_level * f@level_height) * 0.5;   //实际楼层的高度

 Attribute Wrangle2:

if( @P.y < 0.1 ){
 @group_floor_pts_group = 1;
}

猜你喜欢

转载自blog.csdn.net/TingQiaoQiao/article/details/127741662