protected virtual void UpdateResolutionChange() { #if UNITY_EDITOR UnityEditor.EditorUtility.DisplayProgressBar("uNature Foliage", "uNature is recalculating the new Foliage area resolution \nThat might take awhile...", 0.2f); #endif // recreate sectors. DestroyImmediate(sector.gameObject); // update world map worldMap = UNMapGenerators.GenerateWorldMap(this); // update & clean grass maps DisposeExistingGrassMaps(); _grassMaps = null; UpdateGrassMapsForMaterials(); PoolMeshInstances(); UNSettings.Log("uNature finished updating the area resolution successfully!! New resolution : " + _foliageAreaResolutionIntegral); #if UNITY_EDITOR UnityEditor.EditorUtility.ClearProgressBar(); #endif }
void DrawFoliageInstancesEditingUI() { EditorGUILayout.BeginVertical("Box", GUILayout.Width(450), GUILayout.MaxHeight(200)); GUILayout.Label("Chunks Settings:", EditorStyles.boldLabel); GUILayout.Space(10); if (selectedChunk == null) { GUILayout.Label("Chunk cannot be found!"); } else { if (!selectedChunk.isFoliageInstanceAttached) { GUILayout.Label("Chunk doesn't have a manager attached!"); } else { FoliageManagerInstance mInstance = selectedChunk.GetOrCreateFoliageManagerInstance(); mInstance.foliageAreaResolution = (FoliageResolutions)EditorGUILayout.EnumPopup("Foliage Area Resolution", mInstance.foliageAreaResolution); GUILayout.BeginHorizontal(); GUILayout.Label("World Maps Settings", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Generate")) { mInstance.worldMap = UNMapGenerators.GenerateWorldMap(mInstance); } GUILayout.EndHorizontal(); mInstance.worldMap.map = (Texture2D)EditorGUILayout.ObjectField(string.Format("World Map: ({0})", mInstance.foliageAreaResolutionIntegral), mInstance.worldMap.map, typeof(Texture2D), false); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Label("Color Maps Settings", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Generate")) { mInstance.colorMap = UNMapGenerators.GenerateColorMap(0, 0, FoliageCore_MainManager.FOLIAGE_INSTANCE_AREA_SIZE, mInstance.guid); } GUILayout.EndHorizontal(); mInstance.colorMap = (Texture2D)EditorGUILayout.ObjectField(string.Format("Color Map: ({0})", FoliageCore_MainManager.FOLIAGE_INSTANCE_AREA_SIZE), mInstance.colorMap, typeof(Texture2D), false); } } EditorGUILayout.EndVertical(); }
public void UpdateMaterialBlock(MaterialPropertyBlock mBlock) { // property blocks. (Unique to each manager instance). mBlock.SetTexture("_ColorMap", colorMap); if (worldMap.map == null) { worldMap = UNMapGenerators.GenerateWorldMap(this); } mBlock.SetTexture("_WorldMap", worldMap.map); mBlock.SetFloat("_FoliageAreaResolution", foliageAreaResolutionIntegral); mBlock.SetVector("_FoliageAreaPosition", transform.position); }