public static void UpdateGIMaterials(this Terrain terrain)
 {
     if (terrain.terrainData == null)
     {
         throw new ArgumentException("Invalid terrainData.");
     }
     TerrainExtensions.UpdateGIMaterialsForTerrain(terrain.GetInstanceID(), new Rect(0f, 0f, 1f, 1f));
 }
        public static void UpdateGIMaterials(this Terrain terrain, int x, int y, int width, int height)
        {
            if (terrain.terrainData == null)
            {
                throw new ArgumentException("Invalid terrainData.");
            }
            float num  = (float)terrain.terrainData.alphamapWidth;
            float num2 = (float)terrain.terrainData.alphamapHeight;

            TerrainExtensions.UpdateGIMaterialsForTerrain(terrain.GetInstanceID(), new Rect((float)x / num, (float)y / num2, (float)width / num, (float)height / num2));
        }
Exemple #3
0
        public static void UpdateGIMaterials(this Terrain terrain, int x, int y, int width, int height)
        {
            if (terrain.terrainData == null)
            {
                throw new ArgumentException("Invalid terrainData.");
            }

            float alphamapWidth  = terrain.terrainData.alphamapWidth;
            float alphamapHeight = terrain.terrainData.alphamapHeight;

            UpdateGIMaterialsForTerrain(terrain.GetInstanceID(), new Rect(x / alphamapWidth, y / alphamapHeight, width / alphamapWidth, height / alphamapHeight));
        }