Version: 2023.1
public void Gather (Func<ITerrainInfo,Texture> terrainSource, Color defaultColor, Material blitMaterial, int blitPass, Action<ITerrainInfo> beforeBlit, Action<ITerrainInfo> afterBlit);

参数

terrainSource 返回从每个地形收集的纹理数据的函数。
defaultColor sourceRenderTexture 的默认颜色。
blitMaterial 用于复制数据的材质。如果为 null,则使用默认 blit 材质。
blitPass 用于复制数据的材质通道。
beforeBlit 要在从每个地形复制之前调用的可选操作。默认值为 null。
afterBlit 要在从每个地形复制之后调用的可选操作。默认值为 null。

描述

将用户指定的纹理数据收集到 sourceRenderTexture 中。

此函数从 PaintContext 中的所有地形瓦片收集纹理数据,并将这些数据合并到 sourceRenderTexture 中。 terrainSource 函数指定要从每个地形收集哪些数据。 Gather 假设 terrainSource 返回的纹理数据以类似于高度贴图和 Alpha 贴图的方式在地形瓦片上映射。

首先,函数将 sourceRenderTexture 清除为 /defaultColor/。
随后它使用以下步骤收集 PaintContext 中的每个瓦片:
1) 调用 terrainSource 以获取纹理。
2) 调用 /beforeBlit/。
3) 使用 blitMaterialblitPass 将纹理复制到 sourceRenderTexture 中。
4) 调用 /afterBlit/。

另请参阅:PaintContextPaintContext.Scatter

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