示例#1
0
        // 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);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        // Token: 0x06000DFB RID: 3579 RVA: 0x00061D9C File Offset: 0x0006019C
        public static Vector3 getWorldPosition(LandscapeCoord tileCoord, HeightmapCoord heightmapCoord, float height)
        {
            float num = (float)tileCoord.x * Landscape.TILE_SIZE + (float)heightmapCoord.y / (float)Landscape.HEIGHTMAP_RESOLUTION_MINUS_ONE * Landscape.TILE_SIZE;

            num = (float)Mathf.RoundToInt(num);
            float y    = -Landscape.TILE_HEIGHT / 2f + height * Landscape.TILE_HEIGHT;
            float num2 = (float)tileCoord.y * Landscape.TILE_SIZE + (float)heightmapCoord.x / (float)Landscape.HEIGHTMAP_RESOLUTION_MINUS_ONE * Landscape.TILE_SIZE;

            num2 = (float)Mathf.RoundToInt(num2);
            return(new Vector3(num, y, num2));
        }
示例#3
0
        // 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);
        }
示例#4
0
        // 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);
        }
示例#5
0
 public void convertLegacyHeightmap()
 {
     for (int i = 0; i < Landscape.HEIGHTMAP_RESOLUTION; i++)
     {
         for (int j = 0; j < Landscape.HEIGHTMAP_RESOLUTION; j++)
         {
             HeightmapCoord heightmapCoord = new HeightmapCoord(i, j);
             Vector3        worldPosition  = Landscape.getWorldPosition(this.coord, heightmapCoord, this.sourceHeightmap[i, j]);
             float          num            = LevelGround.getConversionHeight(worldPosition);
             num /= Landscape.TILE_HEIGHT;
             num += 0.5f;
             this.sourceHeightmap[i, j] = num;
         }
     }
     this.data.SetHeights(0, 0, this.sourceHeightmap);
 }
示例#6
0
        // 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: 0x06000EA7 RID: 3751 RVA: 0x0006508C File Offset: 0x0006348C
 public static void cleanHeightmapCoord(ref LandscapeCoord tileCoord, ref HeightmapCoord heightmapCoord)
 {
     if (heightmapCoord.x < 0)
     {
         tileCoord.y--;
         heightmapCoord.x += Landscape.HEIGHTMAP_RESOLUTION;
     }
     if (heightmapCoord.y < 0)
     {
         tileCoord.x--;
         heightmapCoord.y += Landscape.HEIGHTMAP_RESOLUTION;
     }
     if (heightmapCoord.x >= Landscape.HEIGHTMAP_RESOLUTION)
     {
         tileCoord.y++;
         heightmapCoord.x -= Landscape.HEIGHTMAP_RESOLUTION;
     }
     if (heightmapCoord.y >= Landscape.HEIGHTMAP_RESOLUTION)
     {
         tileCoord.x++;
         heightmapCoord.y -= Landscape.HEIGHTMAP_RESOLUTION;
     }
 }
 // Token: 0x06000DD6 RID: 3542 RVA: 0x000616C3 File Offset: 0x0005FAC3
 public HeightmapBounds(HeightmapCoord newMin, HeightmapCoord newMax)
 {
     this.min = newMin;
     this.max = newMax;
 }