Version: 2020.2
Experimental: this API is experimental and might be changed or removed in the future.

TerrainPaintUtility.BeginPaintHoles

切换到手册
public static Experimental.TerrainAPI.PaintContext BeginPaintHoles (Terrain terrain, Rect boundsInTerrainSpace, int extraBorderPixels);

参数

terrain 参考地形区块。
boundsInTerrainSpace 要编辑的地形空间中的区域。
extraBorderPixels 所需的额外边框像素数量。

返回

PaintContext 包含指定区域的组合地形孔洞数据的 PaintContext。

描述

Helper 函数,用于设置 PaintContext 来修改一个或多个地形区块的地形孔洞。

BeginPaintHoles 标识位于边界矩形的 extraBorderPixels 中的所有地形孔洞像素。 将在相邻的连接地形区块中搜索。 像素被收集到临时渲染纹理中并存储在 PaintContext.sourceRenderTexture 中。

调用此函数后,可以将新值写入到 PaintContext.destinationRenderTexture 中以修改地形孔洞。 然后,可以通过调用 TerrainPaintUtility.EndPaintHoles 将修改后的数据复制回地形区块,从而完成修改。 或者,也可以调用 TerrainPaintUtility.ReleaseContextResources 来释放 RenderTexture 资源,从而取消修改。

另请参阅:TerrainPaintUtility.EndPaintHolesPaintContext

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961