Version: 2021.1
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