public static PaintContext BeginPaintTexture(Terrain terrain, Rect boundsInTerrainSpace, TerrainLayer inputLayer, int extraBorderPixels = 0) { if (inputLayer == null) { return(null); } int resolution = terrain.terrainData.alphamapResolution; PaintContext ctx = InitializePaintContext(terrain, resolution, resolution, RenderTextureFormat.R8, boundsInTerrainSpace, extraBorderPixels); ctx.GatherAlphamap(inputLayer, true); return(ctx); }
public static PaintContext BeginPaintTexture(Terrain terrain, Rect boundsInTerrainSpace, TerrainLayer inputLayer, int extraBorderPixels = 0) { bool flag = inputLayer == null; PaintContext result; if (flag) { result = null; } else { int alphamapResolution = terrain.terrainData.alphamapResolution; PaintContext paintContext = TerrainPaintUtility.InitializePaintContext(terrain, alphamapResolution, alphamapResolution, RenderTextureFormat.R8, boundsInTerrainSpace, extraBorderPixels, true); paintContext.GatherAlphamap(inputLayer, true); result = paintContext; } return(result); }
public static PaintContext BeginPaintTexture(Terrain terrain, Rect boundsInTerrainSpace, TerrainLayer inputLayer, int extraBorderPixels = 0) { if (inputLayer == null) { return(null); } int terrainLayerIndex = FindTerrainLayerIndex(terrain, inputLayer); if (terrainLayerIndex == -1) { terrainLayerIndex = AddTerrainLayer(terrain, inputLayer); } Texture2D inputTexture = GetTerrainAlphaMapChecked(terrain, terrainLayerIndex >> 2); PaintContext ctx = InitializePaintContext(terrain, inputTexture, RenderTextureFormat.R8, boundsInTerrainSpace, extraBorderPixels); ctx.GatherAlphamap(inputLayer); return(ctx); }
public static PaintContext BeginPaintTexture(Terrain terrain, Rect bounds, TerrainLayer inputLayer) { if (inputLayer == null) { return(null); } int terrainLayerIndex = FindTerrainLayerIndex(terrain, inputLayer); if (terrainLayerIndex == -1) { terrainLayerIndex = AddTerrainLayer(terrain, inputLayer); } Texture2D inputTexture = GetTerrainAlphaMapChecked(terrain, terrainLayerIndex >> 2); PaintContext ctx = InitializePaintContext(terrain, bounds, inputTexture.width, inputTexture.height, RenderTextureFormat.R8); ctx.GatherAlphamap(terrain, inputLayer); return(ctx); }