Esempio n. 1
0
        // 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);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        // Token: 0x06000DF2 RID: 3570 RVA: 0x00061C00 File Offset: 0x00060000
        public static bool getSplatmapMaterial(Vector3 position, out AssetReference <LandscapeMaterialAsset> materialAsset)
        {
            LandscapeCoord tileCoord     = new LandscapeCoord(position);
            SplatmapCoord  splatmapCoord = new SplatmapCoord(tileCoord, position);

            return(Landscape.getSplatmapMaterial(tileCoord, splatmapCoord, out materialAsset));
        }
Esempio n. 3
0
        // 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);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        // Token: 0x06000DF4 RID: 3572 RVA: 0x00061C68 File Offset: 0x00060068
        public static bool getSplatmapLayer(Vector3 position, out int layer)
        {
            LandscapeCoord tileCoord     = new LandscapeCoord(position);
            SplatmapCoord  splatmapCoord = new SplatmapCoord(tileCoord, position);

            return(Landscape.getSplatmapLayer(tileCoord, splatmapCoord, out layer));
        }
Esempio n. 5
0
        // 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);
        }
Esempio n. 6
0
        // 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);
        }
Esempio n. 7
0
        // Token: 0x06000DFC RID: 3580 RVA: 0x00061E20 File Offset: 0x00060220
        public static Vector3 getWorldPosition(LandscapeCoord tileCoord, SplatmapCoord splatmapCoord)
        {
            float num = (float)tileCoord.x * Landscape.TILE_SIZE + (float)splatmapCoord.y / (float)Landscape.SPLATMAP_RESOLUTION * Landscape.TILE_SIZE;

            num = (float)Mathf.RoundToInt(num) + Landscape.HALF_SPLATMAP_WORLD_UNIT;
            float num2 = (float)tileCoord.y * Landscape.TILE_SIZE + (float)splatmapCoord.x / (float)Landscape.SPLATMAP_RESOLUTION * Landscape.TILE_SIZE;

            num2 = (float)Mathf.RoundToInt(num2) + Landscape.HALF_SPLATMAP_WORLD_UNIT;
            Vector3 vector = new Vector3(num, 0f, num2);
            float   y;

            Landscape.getWorldHeight(vector, out y);
            vector.y = y;
            return(vector);
        }
Esempio n. 8
0
 public void convertLegacySplatmap()
 {
     for (int i = 0; i < Landscape.SPLATMAP_RESOLUTION; i++)
     {
         for (int j = 0; j < Landscape.SPLATMAP_RESOLUTION; j++)
         {
             SplatmapCoord splatmapCoord = new SplatmapCoord(i, j);
             Vector3       worldPosition = Landscape.getWorldPosition(this.coord, splatmapCoord);
             for (int k = 0; k < Landscape.SPLATMAP_LAYERS; k++)
             {
                 float conversionWeight = LevelGround.getConversionWeight(worldPosition, k, true);
                 this.sourceSplatmap[i, j, k] = conversionWeight;
             }
         }
     }
     this.data.SetAlphamaps(0, 0, this.sourceSplatmap);
 }
Esempio n. 9
0
        // 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);
                    }
                }
            }
        }
Esempio n. 10
0
        // Token: 0x06000DF6 RID: 3574 RVA: 0x00061CC0 File Offset: 0x000600C0
        public static int getSplatmapHighestWeightLayerIndex(SplatmapCoord splatmapCoord, float[,,] currentWeights, int ignoreLayer = -1)
        {
            float num    = -1f;
            int   result = -1;

            for (int i = 0; i < Landscape.SPLATMAP_LAYERS; i++)
            {
                if (i != ignoreLayer)
                {
                    if (currentWeights[splatmapCoord.x, splatmapCoord.y, i] > num)
                    {
                        num    = currentWeights[splatmapCoord.x, splatmapCoord.y, i];
                        result = i;
                    }
                }
            }
            return(result);
        }
 // Token: 0x06000EA8 RID: 3752 RVA: 0x00065154 File Offset: 0x00063554
 public static void cleanSplatmapCoord(ref LandscapeCoord tileCoord, ref SplatmapCoord splatmapCoord)
 {
     if (splatmapCoord.x < 0)
     {
         tileCoord.y--;
         splatmapCoord.x += Landscape.SPLATMAP_RESOLUTION;
     }
     if (splatmapCoord.y < 0)
     {
         tileCoord.x--;
         splatmapCoord.y += Landscape.SPLATMAP_RESOLUTION;
     }
     if (splatmapCoord.x >= Landscape.SPLATMAP_RESOLUTION)
     {
         tileCoord.y++;
         splatmapCoord.x -= Landscape.SPLATMAP_RESOLUTION;
     }
     if (splatmapCoord.y >= Landscape.SPLATMAP_RESOLUTION)
     {
         tileCoord.x++;
         splatmapCoord.y -= Landscape.SPLATMAP_RESOLUTION;
     }
 }
Esempio n. 12
0
        public void bakeFoliageSurface(FoliageBakeSettings bakeSettings, FoliageTile foliageTile)
        {
            int num  = (foliageTile.coord.y * FoliageSystem.TILE_SIZE_INT - this.coord.y * Landscape.TILE_SIZE_INT) / FoliageSystem.TILE_SIZE_INT * FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;
            int num2 = num + FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;
            int num3 = (foliageTile.coord.x * FoliageSystem.TILE_SIZE_INT - this.coord.x * Landscape.TILE_SIZE_INT) / FoliageSystem.TILE_SIZE_INT * FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;
            int num4 = num3 + FoliageSystem.SPLATMAP_RESOLUTION_PER_TILE;

            for (int i = num; i < num2; i++)
            {
                for (int j = num3; j < num4; j++)
                {
                    SplatmapCoord splatmapCoord = new SplatmapCoord(i, j);
                    float         num5          = (float)this.coord.x * Landscape.TILE_SIZE + (float)splatmapCoord.y * Landscape.SPLATMAP_WORLD_UNIT;
                    float         num6          = (float)this.coord.y * Landscape.TILE_SIZE + (float)splatmapCoord.x * Landscape.SPLATMAP_WORLD_UNIT;
                    Bounds        bounds        = default(Bounds);
                    bounds.min = new Vector3(num5, 0f, num6);
                    bounds.max = new Vector3(num5 + Landscape.SPLATMAP_WORLD_UNIT, 0f, num6 + Landscape.SPLATMAP_WORLD_UNIT);
                    for (int k = 0; k < Landscape.SPLATMAP_LAYERS; k++)
                    {
                        float num7 = this.sourceSplatmap[i, j, k];
                        if (num7 >= 0.01f)
                        {
                            LandscapeMaterialAsset landscapeMaterialAsset = Assets.find <LandscapeMaterialAsset>(this.materials[k]);
                            if (landscapeMaterialAsset != null)
                            {
                                FoliageInfoCollectionAsset foliageInfoCollectionAsset = Assets.find <FoliageInfoCollectionAsset>(landscapeMaterialAsset.foliage);
                                if (foliageInfoCollectionAsset != null)
                                {
                                    foliageInfoCollectionAsset.bakeFoliage(bakeSettings, this, bounds, num7);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 13
0
 // Token: 0x06000EA9 RID: 3753 RVA: 0x00065219 File Offset: 0x00063619
 public SplatmapBounds(SplatmapCoord newMin, SplatmapCoord newMax)
 {
     this.min = newMin;
     this.max = newMax;
 }