Beispiel #1
0
        /// <summary>
        /// Repaints an individual terrain
        /// </summary>
        /// <param name="terrain"></param>
        public void RepaintTerrain(Terrain terrain)
        {
            if (layerSettings.Count == 0 || terrain == null)
            {
                return;
            }

            ModifierStack.Configure(terrain, bounds, splatmapResolution);

            ModifierStack.ProcessLayers(terrain, layerSettings);

            ApplyStampsToTerrain(terrain);

            //Regenerate basemap
            terrain.terrainData.baseMapResolution = colorMapResolution;
            terrain.terrainData.SetBaseMapDirty();

            RefreshVegetation(terrain);

            terrain.Flush();

            OnTerrainRepaint?.Invoke(terrain);

#if UNITY_EDITOR
            EditorUtility.SetDirty(terrain.terrainData);
#endif
        }
        /// <summary>
        /// Repaints an individual terrain
        /// </summary>
        /// <param name="terrain"></param>
        public void RepaintTerrain(Terrain terrain)
        {
            if (layerSettings.Count == 0 || terrain == null)
            {
                return;
            }

            ModifierStack.Configure(terrain, bounds, splatmapResolution);

            for (int i = layerSettings.Count - 1; i >= 0; i--)
            {
                //Disabled or no settings, paint fill with black
                if (!layerSettings[i].enabled && i < layerSettings.Count - 1)
                {
                    continue;
                }

                ModifierStack.Execute(terrain, layerSettings[i].layer, layerSettings[i].modifierStack);
            }

            //Regenerate basemap
            terrain.terrainData.baseMapResolution = colorMapResolution;
            terrain.terrainData.SetBaseMapDirty();

            RefreshVegetation(terrain);

            terrain.Flush();

#if UNITY_EDITOR
            EditorUtility.SetDirty(terrain.terrainData);
#endif
        }