// 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: 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: 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: 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);
                    }
                }
            }
        }
Example #6
0
        // 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>());
            }
        }