// Token: 0x06000DFE RID: 3582 RVA: 0x00061FD4 File Offset: 0x000603D4 public static void readSplatmap(Bounds worldBounds, Landscape.LandscapeReadSplatmapHandler callback) { if (callback == null) { return; } LandscapeBounds landscapeBounds = new LandscapeBounds(worldBounds); for (int i = landscapeBounds.min.x; i <= landscapeBounds.max.x; i++) { for (int j = landscapeBounds.min.y; j <= landscapeBounds.max.y; j++) { LandscapeCoord landscapeCoord = new LandscapeCoord(i, j); LandscapeTile tile = Landscape.getTile(landscapeCoord); if (tile != null) { SplatmapBounds splatmapBounds = new SplatmapBounds(landscapeCoord, worldBounds); for (int k = splatmapBounds.min.x; k < splatmapBounds.max.x; k++) { for (int l = splatmapBounds.min.y; l < splatmapBounds.max.y; l++) { SplatmapCoord splatmapCoord = new SplatmapCoord(k, l); for (int m = 0; m < Landscape.SPLATMAP_LAYERS; m++) { Landscape.SPLATMAP_LAYER_BUFFER[m] = tile.sourceSplatmap[k, l, m]; } Vector3 worldPosition = Landscape.getWorldPosition(landscapeCoord, splatmapCoord); callback(landscapeCoord, splatmapCoord, worldPosition, Landscape.SPLATMAP_LAYER_BUFFER); } } } } } }
// Token: 0x06000E02 RID: 3586 RVA: 0x00062570 File Offset: 0x00060970 public static void getSplatmapVertices(Bounds worldBounds, Landscape.LandscapeGetSplatmapVerticesHandler callback) { if (callback == null) { return; } LandscapeBounds landscapeBounds = new LandscapeBounds(worldBounds); for (int i = landscapeBounds.min.x; i <= landscapeBounds.max.x; i++) { for (int j = landscapeBounds.min.y; j <= landscapeBounds.max.y; j++) { LandscapeCoord landscapeCoord = new LandscapeCoord(i, j); if (Landscape.getTile(landscapeCoord) != null) { SplatmapBounds splatmapBounds = new SplatmapBounds(landscapeCoord, worldBounds); for (int k = splatmapBounds.min.x; k <= splatmapBounds.max.x; k++) { for (int l = splatmapBounds.min.y; l <= splatmapBounds.max.y; l++) { SplatmapCoord splatmapCoord = new SplatmapCoord(k, l); Vector3 worldPosition = Landscape.getWorldPosition(landscapeCoord, splatmapCoord); callback(landscapeCoord, splatmapCoord, worldPosition); } } } } } }
// Token: 0x06000E01 RID: 3585 RVA: 0x00062450 File Offset: 0x00060850 public static void getHeightmapVertices(Bounds worldBounds, Landscape.LandscapeGetHeightmapVerticesHandler callback) { if (callback == null) { return; } LandscapeBounds landscapeBounds = new LandscapeBounds(worldBounds); for (int i = landscapeBounds.min.x; i <= landscapeBounds.max.x; i++) { for (int j = landscapeBounds.min.y; j <= landscapeBounds.max.y; j++) { LandscapeCoord landscapeCoord = new LandscapeCoord(i, j); LandscapeTile tile = Landscape.getTile(landscapeCoord); if (tile != null) { HeightmapBounds heightmapBounds = new HeightmapBounds(landscapeCoord, worldBounds); for (int k = heightmapBounds.min.x; k <= heightmapBounds.max.x; k++) { for (int l = heightmapBounds.min.y; l <= heightmapBounds.max.y; l++) { HeightmapCoord heightmapCoord = new HeightmapCoord(k, l); float height = tile.sourceHeightmap[k, l]; Vector3 worldPosition = Landscape.getWorldPosition(landscapeCoord, heightmapCoord, height); callback(landscapeCoord, heightmapCoord, worldPosition); } } } } } }
// Token: 0x06000DF0 RID: 3568 RVA: 0x00061B44 File Offset: 0x0005FF44 public static bool getHeight01(LandscapeCoord tileCoord, HeightmapCoord heightmapCoord, out float height) { LandscapeTile tile = Landscape.getTile(tileCoord); if (tile != null) { height = tile.sourceHeightmap[heightmapCoord.x, heightmapCoord.y]; return(true); } height = 0f; return(false); }
// Token: 0x06000DF5 RID: 3573 RVA: 0x00061C90 File Offset: 0x00060090 public static bool getSplatmapLayer(LandscapeCoord tileCoord, SplatmapCoord splatmapCoord, out int layer) { LandscapeTile tile = Landscape.getTile(tileCoord); if (tile != null) { layer = Landscape.getSplatmapHighestWeightLayerIndex(splatmapCoord, tile.sourceSplatmap, -1); return(true); } layer = -1; return(false); }
// Token: 0x06000DF3 RID: 3571 RVA: 0x00061C28 File Offset: 0x00060028 public static bool getSplatmapMaterial(LandscapeCoord tileCoord, SplatmapCoord splatmapCoord, out AssetReference <LandscapeMaterialAsset> materialAsset) { int index; if (Landscape.getSplatmapLayer(tileCoord, splatmapCoord, out index)) { materialAsset = Landscape.getTile(tileCoord).materials[index]; return(true); } materialAsset = AssetReference <LandscapeMaterialAsset> .invalid; return(false); }
// Token: 0x06000DEE RID: 3566 RVA: 0x00061AB0 File Offset: 0x0005FEB0 public static bool getWorldHeight(LandscapeCoord tileCoord, HeightmapCoord heightmapCoord, out float height) { LandscapeTile tile = Landscape.getTile(tileCoord); if (tile != null) { height = tile.sourceHeightmap[heightmapCoord.x, heightmapCoord.y] * Landscape.TILE_HEIGHT - Landscape.TILE_HEIGHT / 2f; return(true); } height = 0f; return(false); }
// Token: 0x06000DF1 RID: 3569 RVA: 0x00061B84 File Offset: 0x0005FF84 public static bool getNormal(Vector3 position, out Vector3 normal) { LandscapeCoord coord = new LandscapeCoord(position); LandscapeTile tile = Landscape.getTile(coord); if (tile != null) { normal = tile.data.GetInterpolatedNormal((position.x - (float)coord.x * Landscape.TILE_SIZE) / Landscape.TILE_SIZE, (position.z - (float)coord.y * Landscape.TILE_SIZE) / Landscape.TILE_SIZE); return(true); } normal = Vector3.up; return(false); }
// Token: 0x06000DEF RID: 3567 RVA: 0x00061B04 File Offset: 0x0005FF04 public static bool getHeight01(Vector3 position, out float height) { LandscapeCoord coord = new LandscapeCoord(position); LandscapeTile tile = Landscape.getTile(coord); if (tile != null) { height = tile.terrain.SampleHeight(position) / Landscape.TILE_HEIGHT; return(true); } height = 0f; return(false); }
public static void linkNeighbors() { foreach (KeyValuePair <LandscapeCoord, LandscapeTile> keyValuePair in Landscape.tiles) { LandscapeTile value = keyValuePair.Value; LandscapeTile tile = Landscape.getTile(new LandscapeCoord(value.coord.x - 1, value.coord.y)); LandscapeTile tile2 = Landscape.getTile(new LandscapeCoord(value.coord.x, value.coord.y + 1)); LandscapeTile tile3 = Landscape.getTile(new LandscapeCoord(value.coord.x + 1, value.coord.y)); LandscapeTile tile4 = Landscape.getTile(new LandscapeCoord(value.coord.x, value.coord.y - 1)); Terrain terrain = (tile != null) ? tile.terrain : null; Terrain terrain2 = (tile2 != null) ? tile2.terrain : null; Terrain terrain3 = (tile3 != null) ? tile3.terrain : null; Terrain terrain4 = (tile4 != null) ? tile4.terrain : null; value.terrain.SetNeighbors(terrain, terrain2, terrain3, terrain4); value.terrain.Flush(); } }
// Token: 0x06000E04 RID: 3588 RVA: 0x000626E4 File Offset: 0x00060AE4 public static void linkNeighbors() { foreach (KeyValuePair <LandscapeCoord, LandscapeTile> keyValuePair in Landscape.tiles) { LandscapeTile value = keyValuePair.Value; LandscapeTile tile = Landscape.getTile(new LandscapeCoord(value.coord.x - 1, value.coord.y)); LandscapeTile tile2 = Landscape.getTile(new LandscapeCoord(value.coord.x, value.coord.y + 1)); LandscapeTile tile3 = Landscape.getTile(new LandscapeCoord(value.coord.x + 1, value.coord.y)); LandscapeTile tile4 = Landscape.getTile(new LandscapeCoord(value.coord.x, value.coord.y - 1)); Terrain left = (tile != null) ? tile.terrain : null; Terrain top = (tile2 != null) ? tile2.terrain : null; Terrain right = (tile3 != null) ? tile3.terrain : null; Terrain bottom = (tile4 != null) ? tile4.terrain : null; value.terrain.SetNeighbors(left, top, right, bottom); value.terrain.Flush(); } }
// Token: 0x06000E00 RID: 3584 RVA: 0x00062290 File Offset: 0x00060690 public static void writeSplatmap(Bounds worldBounds, Landscape.LandscapeWriteSplatmapHandler callback) { if (callback == null) { return; } LandscapeBounds landscapeBounds = new LandscapeBounds(worldBounds); for (int i = landscapeBounds.min.x; i <= landscapeBounds.max.x; i++) { for (int j = landscapeBounds.min.y; j <= landscapeBounds.max.y; j++) { LandscapeCoord landscapeCoord = new LandscapeCoord(i, j); LandscapeTile tile = Landscape.getTile(landscapeCoord); if (tile != null) { if (!Landscape.splatmapTransactions.ContainsKey(landscapeCoord)) { LandscapeSplatmapTransaction landscapeSplatmapTransaction = new LandscapeSplatmapTransaction(tile); DevkitTransactionManager.recordTransaction(landscapeSplatmapTransaction); Landscape.splatmapTransactions.Add(landscapeCoord, landscapeSplatmapTransaction); } SplatmapBounds splatmapBounds = new SplatmapBounds(landscapeCoord, worldBounds); for (int k = splatmapBounds.min.x; k <= splatmapBounds.max.x; k++) { for (int l = splatmapBounds.min.y; l <= splatmapBounds.max.y; l++) { SplatmapCoord splatmapCoord = new SplatmapCoord(k, l); for (int m = 0; m < Landscape.SPLATMAP_LAYERS; m++) { Landscape.SPLATMAP_LAYER_BUFFER[m] = tile.sourceSplatmap[k, l, m]; } Vector3 worldPosition = Landscape.getWorldPosition(landscapeCoord, splatmapCoord); callback(landscapeCoord, splatmapCoord, worldPosition, Landscape.SPLATMAP_LAYER_BUFFER); for (int n = 0; n < Landscape.SPLATMAP_LAYERS; n++) { tile.sourceSplatmap[k, l, n] = Mathf.Clamp01(Landscape.SPLATMAP_LAYER_BUFFER[n]); } } } tile.data.SetAlphamaps(0, 0, tile.sourceSplatmap); } } } }
// Token: 0x06000E05 RID: 3589 RVA: 0x00062870 File Offset: 0x00060C70 public static void reconcileNeighbors(LandscapeTile tile) { LandscapeTile tile2 = Landscape.getTile(new LandscapeCoord(tile.coord.x - 1, tile.coord.y)); if (tile2 != null) { for (int i = 0; i < Landscape.HEIGHTMAP_RESOLUTION; i++) { tile.sourceHeightmap[i, 0] = tile2.sourceHeightmap[i, Landscape.HEIGHTMAP_RESOLUTION - 1]; } } LandscapeTile tile3 = Landscape.getTile(new LandscapeCoord(tile.coord.x, tile.coord.y - 1)); if (tile3 != null) { for (int j = 0; j < Landscape.HEIGHTMAP_RESOLUTION; j++) { tile.sourceHeightmap[0, j] = tile3.sourceHeightmap[Landscape.HEIGHTMAP_RESOLUTION - 1, j]; } } LandscapeTile tile4 = Landscape.getTile(new LandscapeCoord(tile.coord.x + 1, tile.coord.y)); if (tile4 != null) { for (int k = 0; k < Landscape.HEIGHTMAP_RESOLUTION; k++) { tile.sourceHeightmap[k, Landscape.HEIGHTMAP_RESOLUTION - 1] = tile4.sourceHeightmap[k, 0]; } } LandscapeTile tile5 = Landscape.getTile(new LandscapeCoord(tile.coord.x, tile.coord.y + 1)); if (tile5 != null) { for (int l = 0; l < Landscape.HEIGHTMAP_RESOLUTION; l++) { tile.sourceHeightmap[Landscape.HEIGHTMAP_RESOLUTION - 1, l] = tile5.sourceHeightmap[0, l]; } } tile.data.SetHeightsDelayLOD(0, 0, tile.sourceHeightmap); }
// Token: 0x06000DFF RID: 3583 RVA: 0x00062118 File Offset: 0x00060518 public static void writeHeightmap(Bounds worldBounds, Landscape.LandscapeWriteHeightmapHandler callback) { if (callback == null) { return; } LandscapeBounds landscapeBounds = new LandscapeBounds(worldBounds); for (int i = landscapeBounds.min.x; i <= landscapeBounds.max.x; i++) { for (int j = landscapeBounds.min.y; j <= landscapeBounds.max.y; j++) { LandscapeCoord landscapeCoord = new LandscapeCoord(i, j); LandscapeTile tile = Landscape.getTile(landscapeCoord); if (tile != null) { if (!Landscape.heightmapTransactions.ContainsKey(landscapeCoord)) { LandscapeHeightmapTransaction landscapeHeightmapTransaction = new LandscapeHeightmapTransaction(tile); DevkitTransactionManager.recordTransaction(landscapeHeightmapTransaction); Landscape.heightmapTransactions.Add(landscapeCoord, landscapeHeightmapTransaction); } HeightmapBounds heightmapBounds = new HeightmapBounds(landscapeCoord, worldBounds); for (int k = heightmapBounds.min.x; k <= heightmapBounds.max.x; k++) { for (int l = heightmapBounds.min.y; l <= heightmapBounds.max.y; l++) { HeightmapCoord heightmapCoord = new HeightmapCoord(k, l); float num = tile.sourceHeightmap[k, l]; Vector3 worldPosition = Landscape.getWorldPosition(landscapeCoord, heightmapCoord, num); tile.sourceHeightmap[k, l] = Mathf.Clamp01(callback(landscapeCoord, heightmapCoord, worldPosition, num)); } } tile.data.SetHeightsDelayLOD(0, 0, tile.sourceHeightmap); } } } }
// Token: 0x06000E66 RID: 3686 RVA: 0x00063A64 File Offset: 0x00061E64 protected void findTerrainColliders() { this.terrainColliders.Clear(); Bounds bounds = base.box.bounds; LandscapeBounds landscapeBounds = new LandscapeBounds(bounds); for (int i = landscapeBounds.min.x; i <= landscapeBounds.max.x; i++) { for (int j = landscapeBounds.min.y; j <= landscapeBounds.max.y; j++) { LandscapeCoord coord = new LandscapeCoord(i, j); LandscapeTile tile = Landscape.getTile(coord); if (tile != null) { this.terrainColliders.Add(tile.collider); } } } if (LevelGround.terrain != null) { this.terrainColliders.Add(LevelGround.terrain.transform.GetComponent <TerrainCollider>()); } }
// Token: 0x06000DFA RID: 3578 RVA: 0x00061D8B File Offset: 0x0006018B public static bool isPointerInTile(Vector3 worldPosition) { return(Landscape.getTile(worldPosition) != null); }
// Token: 0x06000E09 RID: 3593 RVA: 0x00062B24 File Offset: 0x00060F24 public static LandscapeTile getTile(Vector3 worldPosition) { LandscapeCoord coord = new LandscapeCoord(worldPosition); return(Landscape.getTile(coord)); }