导入规则文件可以使所导入规则文件的所有规则、属性和函数在指定前缀下可用。 有关详细信息,请参阅 CGA 参考

以下规则文件均定义了 Facade 规则。 每个规则以不同的方式设置建筑物立面纹理:

# -- facade1.cga

actualFloorHeight = scope.sy/rint(scope.sy/4)
actualTileWidth   = scope.sx/rint(scope.sx/4)
    
Facade --> setupProjection(0, scope.xy, 2, 2)
           projectUV(0)
           texture("facade1.jpg")
# -- facade2.cga

actualFloorHeight = scope.sy/rint(scope.sy/6)
actualTileWidth   = scope.sx/rint(scope.sx/4)
    
Facade --> setupProjection(0, scope.xy, 3, 2)
           projectUV(0)
           texture("facade2.jpg")

 

下一个规则文件将包含一个 Lot 规则,用于创建一个建筑体并将其分割为侧面和屋顶面:

# -- structure.cga

// the attribute height will be overridden by the
// attribute height from "main.cga" if this rule
// file is included. Thus if this rule file is
// used standalone, the buildings will be of height
// 100, if this rule file is included by "main.cga",
// the buildings will be of height 200.

attr height = 5

Lot --> extrude(height)
        comp(f) { side : Facade | top : Roof. }

 

最后,带有 Lot 初始规则的主规则文件将同时导入立面规则和结构规则。

  • Lot 规则使用 st. 命名空间在 structure.cga 中调用 Lot 规则。
  • structure.cga 中的 height 属性由 main.cga 中的 height 属性覆盖,因此将创建 height 为 10 的建筑物。
    注:

    如果 structure.cga 用作独立规则文件,则将创建 height 为 5 的建筑物。

  • structure.cga 的 Facade 规则在 main.cga 中定义。 它将调用 facade1.cga 或 facade2.cga 的 Facade 规则。

# -- main.cga

// define an attribute "height", potentially
// overriding the same attribute in imported
// rule files.

import f1 : "facade1.cga"
import f2 : "facade2.cga"
import st : "structure.cga"

attr height = 10

Lot --> st.Lot

st.Facade --> 50% : f1.Facade else : f2.Facade

本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。

最常见的情况是下载不完整: 可对比下载完压缩包的与网盘上的容量,若小于网盘提示的容量则是这个原因。这是浏览器下载的bug,建议用百度网盘软件或迅雷下载。 若排除这种情况,可在对应资源底部留言,或联络我们。

对于会员专享、资源素材,文章内用于介绍的图片通常并不包含在对应可供下载素材包内。这些相关商业图片需另外购买,且本站不负责(也没有办法)找到出处。 同样地一些字体文件也是这种情况,但部分素材会在素材包内有一份字体下载链接清单。

如果您已经成功付款但是网站没有弹出成功提示,请联系站长提供付款信息为您处理

资源属于虚拟商品,具有可复制性,可传播性,一旦授予,不接受任何形式的退款、换货要求。请您在购买获取之前确认好 是您所需要的资源