texture("filePath")\ntexture("filePath", textureType)
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
filePath | string | — | 纹理文件路径或 URL。支持相对路径。 |
textureType | selector | diffuse | 纹理类型:diffuse、bump、specular、opacity、normal。 |
为当前形状设置纹理贴图。纹理会应用到材质对应的通道上。若已设置 color,纹理的 diffuse 通道会与颜色混合。
设置 diffuse 纹理:
Wall --> texture("brick.jpg")
设置 bump 纹理:
Wall --> texture("brick_bump.jpg", bump)
CGA.js 中的 texture 实现基于 CityEngine 2025.1 官方文档。
@StartRule\nLot --> primitiveCube(4, 4, 4)\n color(0.7, 0.7, 0.7)\n // texture("example.jpg")
texture( 时,补全列表显示带 textureType 的条目: