├── .gitattributes ├── .gitignore ├── Assets ├── Editor │ ├── MapGenEditor.cs │ └── NoiseDesigner.cs ├── Materials │ ├── AwesomeMap.png │ ├── AwesomeMapColor.png │ ├── CustomWater.mat │ ├── Materials │ │ ├── AwesomeMap.mat │ │ ├── AwesomeMapColor.mat │ │ ├── MapMat.mat │ │ ├── New Material.mat │ │ ├── TestMat.mat │ │ ├── uv_map_reference.mat │ │ ├── uv_mapping_grid_by_cymae 1.mat │ │ ├── uv_mapping_grid_by_cymae 2.mat │ │ └── uv_mapping_grid_by_cymae.mat │ ├── better.mat │ ├── mapimage.mat │ ├── meshMaterial.mat │ ├── newMap.mat │ ├── spherenoise.mat │ ├── uv_map_reference.jpg │ └── uv_mapping_grid_by_cymae.jpg ├── Resources │ ├── BillingMode.json │ └── LibNoise │ │ ├── COPYING.LESSER.txt │ │ ├── COPYING.LESSER.txt.meta │ │ ├── COPYING.txt │ │ ├── COPYING.txt.meta │ │ ├── Generator.meta │ │ ├── Generator │ │ ├── Billow.cs │ │ ├── Billow.cs.meta │ │ ├── Checker.cs │ │ ├── Checker.cs.meta │ │ ├── Const.cs │ │ ├── Const.cs.meta │ │ ├── Cylinders.cs │ │ ├── Cylinders.cs.meta │ │ ├── Perlin.cs │ │ ├── Perlin.cs.meta │ │ ├── RidgedMultifractal.cs │ │ ├── RidgedMultifractal.cs.meta │ │ ├── Spheres.cs │ │ ├── Spheres.cs.meta │ │ ├── Voronoi.cs │ │ └── Voronoi.cs.meta │ │ ├── GradientPresets.cs │ │ ├── GradientPresets.cs.meta │ │ ├── ModuleBase.cs │ │ ├── ModuleBase.cs.meta │ │ ├── Noise2D.cs │ │ ├── Noise2D.cs.meta │ │ ├── Operator.meta │ │ ├── Operator │ │ ├── Abs.cs │ │ ├── Abs.cs.meta │ │ ├── Add.cs │ │ ├── Add.cs.meta │ │ ├── Blend.cs │ │ ├── Blend.cs.meta │ │ ├── Cache.cs │ │ ├── Cache.cs.meta │ │ ├── Clamp.cs │ │ ├── Clamp.cs.meta │ │ ├── Curve.cs │ │ ├── Curve.cs.meta │ │ ├── Displace.cs │ │ ├── Displace.cs.meta │ │ ├── Exponent.cs │ │ ├── Exponent.cs.meta │ │ ├── Invert.cs │ │ ├── Invert.cs.meta │ │ ├── Max.cs │ │ ├── Max.cs.meta │ │ ├── Min.cs │ │ ├── Min.cs.meta │ │ ├── Multiply.cs │ │ ├── Multiply.cs.meta │ │ ├── Power.cs │ │ ├── Power.cs.meta │ │ ├── Rotate.cs │ │ ├── Rotate.cs.meta │ │ ├── Scale.cs │ │ ├── Scale.cs.meta │ │ ├── ScaleBias.cs │ │ ├── ScaleBias.cs.meta │ │ ├── Select.cs │ │ ├── Select.cs.meta │ │ ├── Subtract.cs │ │ ├── Subtract.cs.meta │ │ ├── Terrace.cs │ │ ├── Terrace.cs.meta │ │ ├── Translate.cs │ │ ├── Translate.cs.meta │ │ ├── Turbulence.cs │ │ └── Turbulence.cs.meta │ │ ├── Properties.meta │ │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── AssemblyInfo.cs.meta │ │ ├── README.md │ │ ├── README.md.meta │ │ ├── Utils.cs │ │ └── Utils.cs.meta ├── Scenes │ ├── NoiseGenerator.unity │ └── NoiseGeneratorSettings.lighting ├── Scripts │ ├── DemoController.cs │ ├── FlatMeshGenerator.cs │ ├── MapDisplay.cs │ ├── MapGenerator.cs │ ├── MiscStatics.cs │ └── SphereMagic.cs ├── better.png ├── coolnoisecombo.npr ├── coool.npr ├── default.tpr ├── good planet.npr ├── goodwithseedtackos.npr ├── hideous.tpr ├── mapimage.png ├── neat.npr ├── neat.tpr ├── newMap.png ├── planet egg.png ├── spherenoise.png └── wat.png ├── LICENSE ├── Packages ├── manifest.json └── packages-lock.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── MemorySettings.asset ├── NavMeshAreas.asset ├── NetworkManager.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── SceneTemplateSettings.json ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── boot.config ├── README.md └── UserSettings ├── EditorUserSettings.asset └── Layouts └── default-2021.dwlt /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # Custom for Visual Studio 5 | *.cs diff=csharp 6 | 7 | # Standard to msysgit 8 | *.doc diff=astextplain 9 | *.DOC diff=astextplain 10 | *.docx diff=astextplain 11 | *.DOCX diff=astextplain 12 | *.dot diff=astextplain 13 | *.DOT diff=astextplain 14 | *.pdf diff=astextplain 15 | *.PDF diff=astextplain 16 | *.rtf diff=astextplain 17 | *.RTF diff=astextplain 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Uu]ser[Ss]ettings/ 12 | 13 | # MemoryCaptures can get excessive in size. 14 | # They also could contain extremely sensitive data 15 | /[Mm]emoryCaptures/ 16 | 17 | # Recordings can get excessive in size 18 | /[Rr]ecordings/ 19 | 20 | # Uncomment this line if you wish to ignore the asset store tools plugin 21 | # /[Aa]ssets/AssetStoreTools* 22 | 23 | # Autogenerated Jetbrains Rider plugin 24 | /[Aa]ssets/Plugins/Editor/JetBrains* 25 | 26 | # Visual Studio cache directory 27 | .vs/ 28 | 29 | # Gradle cache directory 30 | .gradle/ 31 | 32 | # Autogenerated VS/MD/Consulo solution and project files 33 | ExportedObj/ 34 | .consulo/ 35 | *.csproj 36 | *.unityproj 37 | *.sln 38 | *.suo 39 | *.tmp 40 | *.user 41 | *.userprefs 42 | *.pidb 43 | *.booproj 44 | *.svd 45 | *.pdb 46 | *.mdb 47 | *.opendb 48 | *.VC.db 49 | 50 | # Unity3D generated meta files 51 | *.pidb.meta 52 | *.pdb.meta 53 | *.mdb.meta 54 | *.*.meta 55 | *.cs.meta 56 | *.tpr.meta 57 | *.npr.meta 58 | *.png.meta 59 | *.meta 60 | 61 | # Unity3D generated file on crash reports 62 | sysinfo.txt 63 | 64 | # Builds 65 | *.apk 66 | *.aab 67 | *.unitypackage 68 | *.app 69 | 70 | # Crashlytics generated file 71 | crashlytics-build.properties 72 | 73 | # Packed Addressables 74 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin* 75 | 76 | # Temporary auto-generated Android Assets 77 | /[Aa]ssets/[Ss]treamingAssets/aa.meta 78 | /[Aa]ssets/[Ss]treamingAssets/aa/* 79 | -------------------------------------------------------------------------------- /Assets/Editor/MapGenEditor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | using UnityEditor.UI; 6 | 7 | [CustomEditor(typeof (MapGenerator))] 8 | public class MapGenEditor : Editor { 9 | 10 | #region Variables 11 | public NoiseFunctions.NoiseType noiseType; 12 | public bool showNoiseFunctions; 13 | public bool showRegionGroups; 14 | public bool showTextures; 15 | private string fileName; 16 | public NoiseFunctions[] oldNoises; 17 | #endregion 18 | 19 | #region Initial Setup 20 | void OnEnable() 21 | { 22 | EditorApplication.update += Update; 23 | } 24 | 25 | static void Update() 26 | { 27 | MapGenerator mapGen = FindObjectOfType(); 28 | if (mapGen.noiseMapUpdateAvailable) 29 | { 30 | mapGen.UpdateSphereMap(); 31 | } 32 | } 33 | 34 | public override void OnInspectorGUI() 35 | { 36 | 37 | 38 | 39 | MapGenerator mapGen = (MapGenerator)target; 40 | 41 | if (DrawDefaultInspector()) 42 | { 43 | if ((mapGen.autoUpdate)&&!(mapGen.multithreading)) 44 | { mapGen.GenerateMap(); } 45 | } 46 | #endregion 47 | 48 | #region Error Control 49 | //error control to keep height positive and non zero 50 | if (mapGen.mapWidth < 1) mapGen.mapWidth = 1; 51 | if (mapGen.mapHeight < 1) mapGen.mapHeight = 1; 52 | #endregion 53 | 54 | #region Image Save Functionality 55 | 56 | if (GUILayout.Button("Save Image")) 57 | { 58 | fileName = EditorUtility.SaveFilePanel("Save a Copy of Texture", Application.dataPath, "mapimage", "png"); 59 | mapGen.SaveImage(fileName); 60 | } 61 | #endregion 62 | TerrainFoldout(ref mapGen); 63 | NoiseFunctionFoldout(ref mapGen); 64 | if (GUILayout.Button("Generate")){mapGen.GenerateMap();} 65 | 66 | } 67 | 68 | #region Inspector Elements 69 | 70 | #region Terrain Elements 71 | 72 | public void TerrainFoldout(ref MapGenerator _mapGen) 73 | { 74 | showRegionGroups = EditorGUILayout.Foldout(showRegionGroups, "Regions"); 75 | if (showRegionGroups) 76 | { 77 | if (GUILayout.Button("Add New Region")) 78 | { 79 | TerrainType[] placeHolder = new TerrainType[_mapGen.regions.Length + 1]; 80 | for (int k = 0; k < _mapGen.regions.Length; k++) 81 | { 82 | placeHolder[k] = _mapGen.regions[k]; 83 | } 84 | placeHolder[_mapGen.regions.Length] = new TerrainType(); 85 | _mapGen.regions = new TerrainType[placeHolder.Length]; 86 | for (int k = 0; k < _mapGen.regions.Length; k++) 87 | { 88 | _mapGen.regions[k] = placeHolder[k]; 89 | } 90 | return; 91 | } 92 | if (GUILayout.Button("Save Regions")) 93 | { 94 | fileName = EditorUtility.SaveFilePanel("Save Current Regions", Application.dataPath, "Regions", "tpr"); 95 | _mapGen.SaveTerrain(_mapGen.regions, fileName); 96 | } 97 | if (GUILayout.Button("Load Regions From File")) 98 | { 99 | fileName = EditorUtility.OpenFilePanel("Load Regions from File ", null, "tpr"); 100 | _mapGen.LoadTerrain(fileName); 101 | _mapGen.GenerateMap(); 102 | } 103 | if (GUILayout.Button("Sort Regions By Height")) 104 | { 105 | System.Array.Sort(_mapGen.regions); 106 | return; 107 | } 108 | } 109 | 110 | for (int i = 0; i < _mapGen.regions.Length; i++) 111 | { 112 | if (showRegionGroups) 113 | { 114 | GetInspectorElements(_mapGen.regions[i], i, _mapGen); 115 | } 116 | 117 | } 118 | } 119 | 120 | public void GetInspectorElements(TerrainType terrainType, int index, MapGenerator generator) 121 | { 122 | EditorGUILayout.Space(); 123 | terrainType.name = EditorGUILayout.TextField("Region Name", terrainType.name); 124 | terrainType.color = EditorGUILayout.ColorField(terrainType.color); 125 | terrainType.height = EditorGUILayout.Slider("Height", (float)terrainType.height, -1.80000f, 1.80000f); 126 | 127 | if (GUILayout.Button("Remove")) 128 | { 129 | generator.regions = generator.regions.RemoveAt(index); 130 | } 131 | } 132 | 133 | #endregion 134 | 135 | #region Noise Elements 136 | 137 | public void NoiseFunctionFoldout(ref MapGenerator _mapGen) 138 | { 139 | showNoiseFunctions = EditorGUILayout.Foldout(showNoiseFunctions, "Noise Stack"); 140 | if (showNoiseFunctions) 141 | { 142 | //if (GUILayout.Button("Open Noise Designer")) { NoiseDesigner.ShowWindow(); } 143 | 144 | if (GUILayout.Button("Add New Noise Function")) 145 | { 146 | NoiseFunctions[] placeholder = new NoiseFunctions[_mapGen.noiseFunctions.Length + 1]; 147 | for (int j = 0; j < _mapGen.noiseFunctions.Length; j++) 148 | { 149 | placeholder[j] = _mapGen.noiseFunctions[j]; 150 | } 151 | placeholder[_mapGen.noiseFunctions.Length] = new NoiseFunctions(); 152 | _mapGen.noiseFunctions = new NoiseFunctions[placeholder.Length]; 153 | for (int j = 0; j < placeholder.Length; j++) 154 | { 155 | _mapGen.noiseFunctions[j] = placeholder[j]; 156 | } 157 | } 158 | #region Save / Load Functions 159 | if (GUILayout.Button("Save This Noise Preset")) 160 | { 161 | fileName = EditorUtility.SaveFilePanel("Save a New Preset", Application.dataPath, "Noise Preset", "npr"); 162 | _mapGen.SavePresets(_mapGen.noiseFunctions, fileName); 163 | } 164 | if (GUILayout.Button("Load Preset From File")) 165 | { 166 | fileName = EditorUtility.OpenFilePanel("Load a noise File ", null, "npr"); 167 | _mapGen.LoadPresets(fileName); 168 | _mapGen.GenerateMap(); 169 | } 170 | #endregion 171 | 172 | for (int i = 0; i < _mapGen.noiseFunctions.Length; i++) 173 | { 174 | if (showNoiseFunctions) 175 | { 176 | GetInspectorElements(_mapGen.noiseFunctions[i], i, _mapGen); 177 | } 178 | 179 | } 180 | 181 | } 182 | } 183 | 184 | public void GetInspectorElements(NoiseFunctions noiseFunc, int index, MapGenerator generator) 185 | { 186 | //to autoupdate if this panel has been changed 187 | EditorGUI.BeginChangeCheck(); 188 | 189 | #region Perlin Function UI 190 | if (noiseFunc.type == NoiseFunctions.NoiseType.Perlin) 191 | { 192 | EditorGUILayout.Space(); 193 | string name = "Perlin Noise"; 194 | EditorGUILayout.LabelField(name); 195 | noiseFunc.type = (NoiseFunctions.NoiseType)EditorGUILayout.EnumPopup("Type of Noise", noiseFunc.type); 196 | noiseFunc.enabled = EditorGUILayout.ToggleLeft("Enabled", noiseFunc.enabled); 197 | noiseFunc.frequency = (double)EditorGUILayout.Slider("Frequency",(float)noiseFunc.frequency, -20f, 20f); 198 | noiseFunc.lacunarity = (double)EditorGUILayout.Slider("Lacunarity", (float)noiseFunc.lacunarity, -2.0000000f, 2.5000000f); 199 | noiseFunc.persistence = (double)EditorGUILayout.Slider("Persistence", (float)noiseFunc.persistence, -1f, 1f); 200 | noiseFunc.octaves = EditorGUILayout.IntSlider("Octaves", noiseFunc.octaves, 0, 18); 201 | noiseFunc.qualityMode = (LibNoise.QualityMode)EditorGUILayout.EnumPopup("Quality Mode", noiseFunc.qualityMode); 202 | noiseFunc.blendMode = (NoiseFunctions.BlendMode)EditorGUILayout.EnumPopup("Blend Mode", noiseFunc.blendMode); 203 | if (GUILayout.Button("Remove")) 204 | { 205 | NoiseFunctions[] placeHolder = new NoiseFunctions[generator.noiseFunctions.Length - 1]; 206 | placeHolder = generator.noiseFunctions.RemoveAt(index); 207 | generator.noiseFunctions = placeHolder; 208 | } 209 | } 210 | #endregion 211 | 212 | #region Billow Function UI 213 | else if (noiseFunc.type == NoiseFunctions.NoiseType.Billow) 214 | { 215 | EditorGUILayout.Space(); 216 | string name = "Billow Noise"; 217 | EditorGUILayout.LabelField(name); 218 | noiseFunc.type = (NoiseFunctions.NoiseType)EditorGUILayout.EnumPopup("Type of Noise", noiseFunc.type); 219 | noiseFunc.enabled = EditorGUILayout.ToggleLeft("Enabled", noiseFunc.enabled); 220 | noiseFunc.frequency = (double)EditorGUILayout.Slider("Frequency", (float)noiseFunc.frequency, 0f, 20f); 221 | noiseFunc.lacunarity = (double)EditorGUILayout.Slider("Lacunarity", (float)noiseFunc.lacunarity, 1.5000000f, 3.5000000f); 222 | noiseFunc.persistence = (double)EditorGUILayout.Slider("Persistence", (float)noiseFunc.persistence, 0f, 1f); 223 | noiseFunc.octaves = EditorGUILayout.IntSlider("Octaves", noiseFunc.octaves, 0, 18); 224 | noiseFunc.qualityMode = (LibNoise.QualityMode)EditorGUILayout.EnumPopup("Quality Mode", noiseFunc.qualityMode); 225 | noiseFunc.blendMode = (NoiseFunctions.BlendMode)EditorGUILayout.EnumPopup("Blend Mode", noiseFunc.blendMode); 226 | if (GUILayout.Button("Remove")) 227 | { 228 | NoiseFunctions[] placeHolder = new NoiseFunctions[generator.noiseFunctions.Length - 1]; 229 | placeHolder = generator.noiseFunctions.RemoveAt(index); 230 | generator.noiseFunctions = placeHolder; 231 | } 232 | } 233 | #endregion 234 | 235 | #region Voronoi UI 236 | else if (noiseFunc.type == NoiseFunctions.NoiseType.Voronoi) 237 | { 238 | EditorGUILayout.Space(); 239 | string name = "Voronoi Noise"; 240 | EditorGUILayout.LabelField(name); 241 | noiseFunc.type = (NoiseFunctions.NoiseType)EditorGUILayout.EnumPopup("Type of Noise", noiseFunc.type); 242 | noiseFunc.enabled = EditorGUILayout.ToggleLeft("Enabled", noiseFunc.enabled); 243 | noiseFunc.frequency = (double)EditorGUILayout.Slider("Frequency", (float)noiseFunc.frequency, 0f, 20f); 244 | noiseFunc.displacement = (double)EditorGUILayout.Slider("Displacement", (float)noiseFunc.displacement, 0f, 20f); 245 | noiseFunc.distance = EditorGUILayout.ToggleLeft("Use Distance", noiseFunc.distance); 246 | noiseFunc.blendMode = (NoiseFunctions.BlendMode)EditorGUILayout.EnumPopup("Blend Mode", noiseFunc.blendMode); 247 | if (GUILayout.Button("Remove")) 248 | { 249 | NoiseFunctions[] placeHolder = new NoiseFunctions[generator.noiseFunctions.Length - 1]; 250 | placeHolder = generator.noiseFunctions.RemoveAt(index); 251 | generator.noiseFunctions = placeHolder; 252 | } 253 | 254 | } 255 | #endregion 256 | 257 | #region Ridged Multifractal UI 258 | else if (noiseFunc.type == NoiseFunctions.NoiseType.RidgedMultifractal) 259 | { 260 | 261 | EditorGUILayout.Space(); 262 | string name = "Ridged Multifractal"; 263 | EditorGUILayout.LabelField(name); 264 | noiseFunc.type = (NoiseFunctions.NoiseType)EditorGUILayout.EnumPopup("Type of Noise", noiseFunc.type); 265 | noiseFunc.enabled = EditorGUILayout.ToggleLeft("Enabled", noiseFunc.enabled); 266 | noiseFunc.frequency = (double)EditorGUILayout.Slider("Frequency", (float)noiseFunc.frequency, 0f, 20f); 267 | noiseFunc.lacunarity = (double)EditorGUILayout.Slider("Lacunarity", (float)noiseFunc.lacunarity, 1.5000000f, 3.5000000f); 268 | noiseFunc.octaves = EditorGUILayout.IntSlider("Octaves", noiseFunc.octaves, 0, 18); 269 | noiseFunc.qualityMode = (LibNoise.QualityMode)EditorGUILayout.EnumPopup("Quality Mode", noiseFunc.qualityMode); 270 | noiseFunc.blendMode = (NoiseFunctions.BlendMode)EditorGUILayout.EnumPopup("Blend Mode", noiseFunc.blendMode); 271 | if (GUILayout.Button("Remove")) 272 | { 273 | NoiseFunctions[] placeHolder = new NoiseFunctions[generator.noiseFunctions.Length - 1]; 274 | placeHolder = generator.noiseFunctions.RemoveAt(index); 275 | generator.noiseFunctions = placeHolder; 276 | } 277 | } 278 | #endregion 279 | 280 | #region None UI 281 | else if (noiseFunc.type == NoiseFunctions.NoiseType.None) 282 | { 283 | 284 | EditorGUILayout.Space(); 285 | string name = "None"; 286 | EditorGUILayout.LabelField(name); 287 | noiseFunc.type = (NoiseFunctions.NoiseType)EditorGUILayout.EnumPopup("Type of Noise", noiseFunc.type); 288 | if (GUILayout.Button("Remove")) 289 | { 290 | NoiseFunctions[] placeHolder = new NoiseFunctions[generator.noiseFunctions.Length - 1]; 291 | placeHolder = generator.noiseFunctions.RemoveAt(index); 292 | generator.noiseFunctions = placeHolder; 293 | } 294 | noiseFunc.enabled = false; 295 | } 296 | 297 | #endregion 298 | 299 | //to autoupdate if this inspector element has changed 300 | if (generator.autoUpdate&&EditorGUI.EndChangeCheck()) 301 | { 302 | generator.GenerateMap(); 303 | } 304 | 305 | 306 | 307 | } 308 | 309 | #endregion 310 | 311 | #endregion 312 | 313 | 314 | 315 | } 316 | -------------------------------------------------------------------------------- /Assets/Editor/NoiseDesigner.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using UnityEditor; 5 | 6 | public class NoiseDesigner : EditorWindow { 7 | [MenuItem("Noise Designer")] 8 | public static void ShowWindow() 9 | { 10 | EditorWindow.GetWindow(typeof(NoiseDesigner)); 11 | } 12 | 13 | 14 | private void OnGUI() 15 | { 16 | MapGenerator mapGen = FindObjectOfType(); 17 | MapGenEditor mGenEditor = (FindObjectOfType()); 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assets/Materials/AwesomeMap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/AwesomeMap.png -------------------------------------------------------------------------------- /Assets/Materials/AwesomeMapColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/AwesomeMapColor.png -------------------------------------------------------------------------------- /Assets/Materials/CustomWater.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/CustomWater.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/AwesomeMap.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/AwesomeMap.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/AwesomeMapColor.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/AwesomeMapColor.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/MapMat.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/MapMat.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/New Material.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/New Material.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/TestMat.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/TestMat.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/uv_map_reference.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/uv_map_reference.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/uv_mapping_grid_by_cymae 1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/uv_mapping_grid_by_cymae 1.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/uv_mapping_grid_by_cymae 2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/uv_mapping_grid_by_cymae 2.mat -------------------------------------------------------------------------------- /Assets/Materials/Materials/uv_mapping_grid_by_cymae.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/Materials/uv_mapping_grid_by_cymae.mat -------------------------------------------------------------------------------- /Assets/Materials/better.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/better.mat -------------------------------------------------------------------------------- /Assets/Materials/mapimage.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/mapimage.mat -------------------------------------------------------------------------------- /Assets/Materials/meshMaterial.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/meshMaterial.mat -------------------------------------------------------------------------------- /Assets/Materials/newMap.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/newMap.mat -------------------------------------------------------------------------------- /Assets/Materials/spherenoise.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/spherenoise.mat -------------------------------------------------------------------------------- /Assets/Materials/uv_map_reference.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/uv_map_reference.jpg -------------------------------------------------------------------------------- /Assets/Materials/uv_mapping_grid_by_cymae.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Materials/uv_mapping_grid_by_cymae.jpg -------------------------------------------------------------------------------- /Assets/Resources/BillingMode.json: -------------------------------------------------------------------------------- 1 | {"androidStore":"GooglePlay"} -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/COPYING.LESSER.txt: -------------------------------------------------------------------------------- 1 | GNU LESSER GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | 9 | This version of the GNU Lesser General Public License incorporates 10 | the terms and conditions of version 3 of the GNU General Public 11 | License, supplemented by the additional permissions listed below. 12 | 13 | 0. Additional Definitions. 14 | 15 | As used herein, "this License" refers to version 3 of the GNU Lesser 16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU 17 | General Public License. 18 | 19 | "The Library" refers to a covered work governed by this License, 20 | other than an Application or a Combined Work as defined below. 21 | 22 | An "Application" is any work that makes use of an interface provided 23 | by the Library, but which is not otherwise based on the Library. 24 | Defining a subclass of a class defined by the Library is deemed a mode 25 | of using an interface provided by the Library. 26 | 27 | A "Combined Work" is a work produced by combining or linking an 28 | Application with the Library. The particular version of the Library 29 | with which the Combined Work was made is also called the "Linked 30 | Version". 31 | 32 | The "Minimal Corresponding Source" for a Combined Work means the 33 | Corresponding Source for the Combined Work, excluding any source code 34 | for portions of the Combined Work that, considered in isolation, are 35 | based on the Application, and not on the Linked Version. 36 | 37 | The "Corresponding Application Code" for a Combined Work means the 38 | object code and/or source code for the Application, including any data 39 | and utility programs needed for reproducing the Combined Work from the 40 | Application, but excluding the System Libraries of the Combined Work. 41 | 42 | 1. Exception to Section 3 of the GNU GPL. 43 | 44 | You may convey a covered work under sections 3 and 4 of this License 45 | without being bound by section 3 of the GNU GPL. 46 | 47 | 2. Conveying Modified Versions. 48 | 49 | If you modify a copy of the Library, and, in your modifications, a 50 | facility refers to a function or data to be supplied by an Application 51 | that uses the facility (other than as an argument passed when the 52 | facility is invoked), then you may convey a copy of the modified 53 | version: 54 | 55 | a) under this License, provided that you make a good faith effort to 56 | ensure that, in the event an Application does not supply the 57 | function or data, the facility still operates, and performs 58 | whatever part of its purpose remains meaningful, or 59 | 60 | b) under the GNU GPL, with none of the additional permissions of 61 | this License applicable to that copy. 62 | 63 | 3. Object Code Incorporating Material from Library Header Files. 64 | 65 | The object code form of an Application may incorporate material from 66 | a header file that is part of the Library. You may convey such object 67 | code under terms of your choice, provided that, if the incorporated 68 | material is not limited to numerical parameters, data structure 69 | layouts and accessors, or small macros, inline functions and templates 70 | (ten or fewer lines in length), you do both of the following: 71 | 72 | a) Give prominent notice with each copy of the object code that the 73 | Library is used in it and that the Library and its use are 74 | covered by this License. 75 | 76 | b) Accompany the object code with a copy of the GNU GPL and this license 77 | document. 78 | 79 | 4. Combined Works. 80 | 81 | You may convey a Combined Work under terms of your choice that, 82 | taken together, effectively do not restrict modification of the 83 | portions of the Library contained in the Combined Work and reverse 84 | engineering for debugging such modifications, if you also do each of 85 | the following: 86 | 87 | a) Give prominent notice with each copy of the Combined Work that 88 | the Library is used in it and that the Library and its use are 89 | covered by this License. 90 | 91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license 92 | document. 93 | 94 | c) For a Combined Work that displays copyright notices during 95 | execution, include the copyright notice for the Library among 96 | these notices, as well as a reference directing the user to the 97 | copies of the GNU GPL and this license document. 98 | 99 | d) Do one of the following: 100 | 101 | 0) Convey the Minimal Corresponding Source under the terms of this 102 | License, and the Corresponding Application Code in a form 103 | suitable for, and under terms that permit, the user to 104 | recombine or relink the Application with a modified version of 105 | the Linked Version to produce a modified Combined Work, in the 106 | manner specified by section 6 of the GNU GPL for conveying 107 | Corresponding Source. 108 | 109 | 1) Use a suitable shared library mechanism for linking with the 110 | Library. A suitable mechanism is one that (a) uses at run time 111 | a copy of the Library already present on the user's computer 112 | system, and (b) will operate properly with a modified version 113 | of the Library that is interface-compatible with the Linked 114 | Version. 115 | 116 | e) Provide Installation Information, but only if you would otherwise 117 | be required to provide such information under section 6 of the 118 | GNU GPL, and only to the extent that such information is 119 | necessary to install and execute a modified version of the 120 | Combined Work produced by recombining or relinking the 121 | Application with a modified version of the Linked Version. (If 122 | you use option 4d0, the Installation Information must accompany 123 | the Minimal Corresponding Source and Corresponding Application 124 | Code. If you use option 4d1, you must provide the Installation 125 | Information in the manner specified by section 6 of the GNU GPL 126 | for conveying Corresponding Source.) 127 | 128 | 5. Combined Libraries. 129 | 130 | You may place library facilities that are a work based on the 131 | Library side by side in a single library together with other library 132 | facilities that are not Applications and are not covered by this 133 | License, and convey such a combined library under terms of your 134 | choice, if you do both of the following: 135 | 136 | a) Accompany the combined library with a copy of the same work based 137 | on the Library, uncombined with any other library facilities, 138 | conveyed under the terms of this License. 139 | 140 | b) Give prominent notice with the combined library that part of it 141 | is a work based on the Library, and explaining where to find the 142 | accompanying uncombined form of the same work. 143 | 144 | 6. Revised Versions of the GNU Lesser General Public License. 145 | 146 | The Free Software Foundation may publish revised and/or new versions 147 | of the GNU Lesser General Public License from time to time. Such new 148 | versions will be similar in spirit to the present version, but may 149 | differ in detail to address new problems or concerns. 150 | 151 | Each version is given a distinguishing version number. If the 152 | Library as you received it specifies that a certain numbered version 153 | of the GNU Lesser General Public License "or any later version" 154 | applies to it, you have the option of following the terms and 155 | conditions either of that published version or of any later version 156 | published by the Free Software Foundation. If the Library as you 157 | received it does not specify a version number of the GNU Lesser 158 | General Public License, you may choose any version of the GNU Lesser 159 | General Public License ever published by the Free Software Foundation. 160 | 161 | If the Library as you received it specifies that a proxy can decide 162 | whether future versions of the GNU Lesser General Public License shall 163 | apply, that proxy's public statement of acceptance of any version is 164 | permanent authorization for you to choose that version for the 165 | Library. 166 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/COPYING.LESSER.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 95ee612b2757f48569ed91e17b141883 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/COPYING.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 8390780810d5f4732a6a41190622d691 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 01d2ad28d1dda48d091ca1d68c49dfb4 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Billow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace LibNoise.Generator 5 | { 6 | /// 7 | /// Provides a noise module that outputs a three-dimensional billowy noise. [GENERATOR] 8 | /// 9 | public class Billow : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _frequency = 1.0; 14 | private double _lacunarity = 2.0; 15 | private QualityMode _quality = QualityMode.Medium; 16 | private int _octaveCount = 6; 17 | private double _persistence = 0.5; 18 | private int _seed; 19 | 20 | #endregion 21 | 22 | #region Constructors 23 | 24 | /// 25 | /// Initializes a new instance of Billow. 26 | /// 27 | public Billow() 28 | : base(0) 29 | { 30 | } 31 | 32 | /// 33 | /// Initializes a new instance of Billow. 34 | /// 35 | /// The frequency of the first octave. 36 | /// The lacunarity of the billowy noise. 37 | /// The persistence of the billowy noise. 38 | /// The number of octaves of the billowy noise. 39 | /// The seed of the billowy noise. 40 | /// The quality of the billowy noise. 41 | public Billow(double frequency, double lacunarity, double persistence, int octaves, int seed, 42 | QualityMode quality) 43 | : base(0) 44 | { 45 | Frequency = frequency; 46 | Lacunarity = lacunarity; 47 | OctaveCount = octaves; 48 | Persistence = persistence; 49 | Seed = seed; 50 | Quality = quality; 51 | } 52 | 53 | #endregion 54 | 55 | #region Properties 56 | 57 | /// 58 | /// Gets or sets the frequency of the first octave. 59 | /// 60 | public double Frequency 61 | { 62 | get { return _frequency; } 63 | set { _frequency = value; } 64 | } 65 | 66 | /// 67 | /// Gets or sets the lacunarity of the billowy noise. 68 | /// 69 | public double Lacunarity 70 | { 71 | get { return _lacunarity; } 72 | set { _lacunarity = value; } 73 | } 74 | 75 | /// 76 | /// Gets or sets the quality of the billowy noise. 77 | /// 78 | public QualityMode Quality 79 | { 80 | get { return _quality; } 81 | set { _quality = value; } 82 | } 83 | 84 | /// 85 | /// Gets or sets the number of octaves of the billowy noise. 86 | /// 87 | public int OctaveCount 88 | { 89 | get { return _octaveCount; } 90 | set { _octaveCount = Mathf.Clamp(value, 1, Utils.OctavesMaximum); } 91 | } 92 | 93 | /// 94 | /// Gets or sets the persistence of the billowy noise. 95 | /// 96 | public double Persistence 97 | { 98 | get { return _persistence; } 99 | set { _persistence = value; } 100 | } 101 | 102 | /// 103 | /// Gets or sets the seed of the billowy noise. 104 | /// 105 | public int Seed 106 | { 107 | get { return _seed; } 108 | set { _seed = value; } 109 | } 110 | 111 | #endregion 112 | 113 | #region ModuleBase Members 114 | 115 | /// 116 | /// Returns the output value for the given input coordinates. 117 | /// 118 | /// The input coordinate on the x-axis. 119 | /// The input coordinate on the y-axis. 120 | /// The input coordinate on the z-axis. 121 | /// The resulting output value. 122 | public override double GetValue(double x, double y, double z) 123 | { 124 | var value = 0.0; 125 | var curp = 1.0; 126 | x *= _frequency; 127 | y *= _frequency; 128 | z *= _frequency; 129 | for (var i = 0; i < _octaveCount; i++) 130 | { 131 | var nx = Utils.MakeInt32Range(x); 132 | var ny = Utils.MakeInt32Range(y); 133 | var nz = Utils.MakeInt32Range(z); 134 | var seed = (_seed + i) & 0xffffffff; 135 | var signal = Utils.GradientCoherentNoise3D(nx, ny, nz, seed, _quality); 136 | signal = 2.0 * Math.Abs(signal) - 1.0; 137 | value += signal * curp; 138 | x *= _lacunarity; 139 | y *= _lacunarity; 140 | z *= _lacunarity; 141 | curp *= _persistence; 142 | } 143 | return value + 0.5; 144 | } 145 | 146 | #endregion 147 | } 148 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Billow.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: f9f0293dd46394b779bf22259c6dad97 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Checker.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LibNoise.Generator 4 | { 5 | /// 6 | /// Provides a noise module that outputs a checkerboard pattern. [GENERATOR] 7 | /// 8 | public class Checker : ModuleBase 9 | { 10 | #region Constructors 11 | 12 | /// 13 | /// Initializes a new instance of Checker. 14 | /// 15 | public Checker() 16 | : base(0) 17 | { 18 | } 19 | 20 | #endregion 21 | 22 | #region ModuleBase Members 23 | 24 | /// 25 | /// Returns the output value for the given input coordinates. 26 | /// 27 | /// The input coordinate on the x-axis. 28 | /// The input coordinate on the y-axis. 29 | /// The input coordinate on the z-axis. 30 | /// The resulting output value. 31 | public override double GetValue(double x, double y, double z) 32 | { 33 | var ix = (int) (Math.Floor(Utils.MakeInt32Range(x))); 34 | var iy = (int) (Math.Floor(Utils.MakeInt32Range(y))); 35 | var iz = (int) (Math.Floor(Utils.MakeInt32Range(z))); 36 | return (ix & 1 ^ iy & 1 ^ iz & 1) != 0 ? -1.0 : 1.0; 37 | } 38 | 39 | #endregion 40 | } 41 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Checker.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: eb233ecbeadf94f018307ccdfb683ec9 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Const.cs: -------------------------------------------------------------------------------- 1 | namespace LibNoise.Generator 2 | { 3 | /// 4 | /// Provides a noise module that outputs a constant value. [GENERATOR] 5 | /// 6 | public class Const : ModuleBase 7 | { 8 | #region Fields 9 | 10 | private double _value; 11 | 12 | #endregion 13 | 14 | #region Constructors 15 | 16 | /// 17 | /// Initializes a new instance of Const. 18 | /// 19 | public Const() 20 | : base(0) 21 | { 22 | } 23 | 24 | /// 25 | /// Initializes a new instance of Const. 26 | /// 27 | /// The constant value. 28 | public Const(double value) 29 | : base(0) 30 | { 31 | Value = value; 32 | } 33 | 34 | #endregion 35 | 36 | #region Properties 37 | 38 | /// 39 | /// Gets or sets the constant value. 40 | /// 41 | public double Value 42 | { 43 | get { return _value; } 44 | set { _value = value; } 45 | } 46 | 47 | #endregion 48 | 49 | #region ModuleBase Members 50 | 51 | /// 52 | /// Returns the output value for the given input coordinates. 53 | /// 54 | /// The input coordinate on the x-axis. 55 | /// The input coordinate on the y-axis. 56 | /// The input coordinate on the z-axis. 57 | /// The resulting output value. 58 | public override double GetValue(double x, double y, double z) 59 | { 60 | return _value; 61 | } 62 | 63 | #endregion 64 | } 65 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Const.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: c6cec7c8a26b54cd3ab29b44d6360a9f 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Cylinders.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LibNoise.Generator 4 | { 5 | /// 6 | /// Provides a noise module that outputs concentric cylinders. [GENERATOR] 7 | /// 8 | public class Cylinders : ModuleBase 9 | { 10 | #region Fields 11 | 12 | private double _frequency = 1.0; 13 | 14 | #endregion 15 | 16 | #region Constructors 17 | 18 | /// 19 | /// Initializes a new instance of Cylinders. 20 | /// 21 | public Cylinders() 22 | : base(0) 23 | { 24 | } 25 | 26 | /// 27 | /// Initializes a new instance of Cylinders. 28 | /// 29 | /// The frequency of the concentric cylinders. 30 | public Cylinders(double frequency) 31 | : base(0) 32 | { 33 | Frequency = frequency; 34 | } 35 | 36 | #endregion 37 | 38 | #region Properties 39 | 40 | /// 41 | /// Gets or sets the frequency of the concentric cylinders. 42 | /// 43 | public double Frequency 44 | { 45 | get { return _frequency; } 46 | set { _frequency = value; } 47 | } 48 | 49 | #endregion 50 | 51 | #region ModuleBase Members 52 | 53 | /// 54 | /// Returns the output value for the given input coordinates. 55 | /// 56 | /// The input coordinate on the x-axis. 57 | /// The input coordinate on the y-axis. 58 | /// The input coordinate on the z-axis. 59 | /// The resulting output value. 60 | public override double GetValue(double x, double y, double z) 61 | { 62 | x *= _frequency; 63 | z *= _frequency; 64 | var dfc = Math.Sqrt(x * x + z * z); 65 | var dfss = dfc - Math.Floor(dfc); 66 | var dfls = 1.0 - dfss; 67 | var nd = Math.Min(dfss, dfls); 68 | return 1.0 - (nd * 4.0); 69 | } 70 | 71 | #endregion 72 | } 73 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Cylinders.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: b9fae44e80dd846dd9781b972e97c6e6 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Perlin.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace LibNoise.Generator 4 | { 5 | /// 6 | /// Provides a noise module that outputs a three-dimensional perlin noise. [GENERATOR] 7 | /// 8 | public class Perlin : ModuleBase 9 | { 10 | #region Fields 11 | 12 | private double _frequency = 1.0; 13 | private double _lacunarity = 2.0; 14 | private QualityMode _quality = QualityMode.Medium; 15 | private int _octaveCount = 6; 16 | private double _persistence = 0.5; 17 | private int _seed; 18 | 19 | #endregion 20 | 21 | #region Constructors 22 | 23 | /// 24 | /// Initializes a new instance of Perlin. 25 | /// 26 | public Perlin() 27 | : base(0) 28 | { 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of Perlin. 33 | /// 34 | /// The frequency of the first octave. 35 | /// The lacunarity of the perlin noise. 36 | /// The persistence of the perlin noise. 37 | /// The number of octaves of the perlin noise. 38 | /// The seed of the perlin noise. 39 | /// The quality of the perlin noise. 40 | public Perlin(double frequency, double lacunarity, double persistence, int octaves, int seed, 41 | QualityMode quality) 42 | : base(0) 43 | { 44 | Frequency = frequency; 45 | Lacunarity = lacunarity; 46 | OctaveCount = octaves; 47 | Persistence = persistence; 48 | Seed = seed; 49 | Quality = quality; 50 | } 51 | 52 | #endregion 53 | 54 | #region Properties 55 | 56 | /// 57 | /// Gets or sets the frequency of the first octave. 58 | /// 59 | public double Frequency 60 | { 61 | get { return _frequency; } 62 | set { _frequency = value; } 63 | } 64 | 65 | /// 66 | /// Gets or sets the lacunarity of the perlin noise. 67 | /// 68 | public double Lacunarity 69 | { 70 | get { return _lacunarity; } 71 | set { _lacunarity = value; } 72 | } 73 | 74 | /// 75 | /// Gets or sets the quality of the perlin noise. 76 | /// 77 | public QualityMode Quality 78 | { 79 | get { return _quality; } 80 | set { _quality = value; } 81 | } 82 | 83 | /// 84 | /// Gets or sets the number of octaves of the perlin noise. 85 | /// 86 | public int OctaveCount 87 | { 88 | get { return _octaveCount; } 89 | set { _octaveCount = Mathf.Clamp(value, 1, Utils.OctavesMaximum); } 90 | } 91 | 92 | /// 93 | /// Gets or sets the persistence of the perlin noise. 94 | /// 95 | public double Persistence 96 | { 97 | get { return _persistence; } 98 | set { _persistence = value; } 99 | } 100 | 101 | /// 102 | /// Gets or sets the seed of the perlin noise. 103 | /// 104 | public int Seed 105 | { 106 | get { return _seed; } 107 | set { _seed = value; } 108 | } 109 | 110 | #endregion 111 | 112 | #region ModuleBase Members 113 | 114 | /// 115 | /// Returns the output value for the given input coordinates. 116 | /// 117 | /// The input coordinate on the x-axis. 118 | /// The input coordinate on the y-axis. 119 | /// The input coordinate on the z-axis. 120 | /// The resulting output value. 121 | public override double GetValue(double x, double y, double z) 122 | { 123 | var value = 0.0; 124 | var cp = 1.0; 125 | x *= _frequency; 126 | y *= _frequency; 127 | z *= _frequency; 128 | for (var i = 0; i < _octaveCount; i++) 129 | { 130 | var nx = Utils.MakeInt32Range(x); 131 | var ny = Utils.MakeInt32Range(y); 132 | var nz = Utils.MakeInt32Range(z); 133 | var seed = (_seed + i) & 0xffffffff; 134 | var signal = Utils.GradientCoherentNoise3D(nx, ny, nz, seed, _quality); 135 | value += signal * cp; 136 | x *= _lacunarity; 137 | y *= _lacunarity; 138 | z *= _lacunarity; 139 | cp *= _persistence; 140 | } 141 | return value; 142 | } 143 | 144 | #endregion 145 | } 146 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Perlin.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: f4531ed2ca2bf4002a1b9515f754ea6a 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/RidgedMultifractal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | 4 | namespace LibNoise.Generator 5 | { 6 | /// 7 | /// Provides a noise module that outputs 3-dimensional ridged-multifractal noise. [GENERATOR] 8 | /// 9 | public class RidgedMultifractal : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _frequency = 1.0; 14 | private double _lacunarity = 2.0; 15 | private QualityMode _quality = QualityMode.Medium; 16 | private int _octaveCount = 6; 17 | private int _seed; 18 | private readonly double[] _weights = new double[Utils.OctavesMaximum]; 19 | 20 | #endregion 21 | 22 | #region Constructors 23 | 24 | /// 25 | /// Initializes a new instance of RidgedMultifractal. 26 | /// 27 | public RidgedMultifractal() 28 | : base(0) 29 | { 30 | UpdateWeights(); 31 | } 32 | 33 | /// 34 | /// Initializes a new instance of RidgedMultifractal. 35 | /// 36 | /// The frequency of the first octave. 37 | /// The lacunarity of the ridged-multifractal noise. 38 | /// The number of octaves of the ridged-multifractal noise. 39 | /// The seed of the ridged-multifractal noise. 40 | /// The quality of the ridged-multifractal noise. 41 | public RidgedMultifractal(double frequency, double lacunarity, int octaves, int seed, QualityMode quality) 42 | : base(0) 43 | { 44 | Frequency = frequency; 45 | Lacunarity = lacunarity; 46 | OctaveCount = octaves; 47 | Seed = seed; 48 | Quality = quality; 49 | } 50 | 51 | #endregion 52 | 53 | #region Properties 54 | 55 | /// 56 | /// Gets or sets the frequency of the first octave. 57 | /// 58 | public double Frequency 59 | { 60 | get { return _frequency; } 61 | set { _frequency = value; } 62 | } 63 | 64 | /// 65 | /// Gets or sets the lacunarity of the ridged-multifractal noise. 66 | /// 67 | public double Lacunarity 68 | { 69 | get { return _lacunarity; } 70 | set 71 | { 72 | _lacunarity = value; 73 | UpdateWeights(); 74 | } 75 | } 76 | 77 | /// 78 | /// Gets or sets the quality of the ridged-multifractal noise. 79 | /// 80 | public QualityMode Quality 81 | { 82 | get { return _quality; } 83 | set { _quality = value; } 84 | } 85 | 86 | /// 87 | /// Gets or sets the number of octaves of the ridged-multifractal noise. 88 | /// 89 | public int OctaveCount 90 | { 91 | get { return _octaveCount; } 92 | set { _octaveCount = Mathf.Clamp(value, 1, Utils.OctavesMaximum); } 93 | } 94 | 95 | /// 96 | /// Gets or sets the seed of the ridged-multifractal noise. 97 | /// 98 | public int Seed 99 | { 100 | get { return _seed; } 101 | set { _seed = value; } 102 | } 103 | 104 | #endregion 105 | 106 | #region Methods 107 | 108 | /// 109 | /// Updates the weights of the ridged-multifractal noise. 110 | /// 111 | private void UpdateWeights() 112 | { 113 | var f = 1.0; 114 | for (var i = 0; i < Utils.OctavesMaximum; i++) 115 | { 116 | _weights[i] = Math.Pow(f, -1.0); 117 | f *= _lacunarity; 118 | } 119 | } 120 | 121 | #endregion 122 | 123 | #region ModuleBase Members 124 | 125 | /// 126 | /// Returns the output value for the given input coordinates. 127 | /// 128 | /// The input coordinate on the x-axis. 129 | /// The input coordinate on the y-axis. 130 | /// The input coordinate on the z-axis. 131 | /// The resulting output value. 132 | public override double GetValue(double x, double y, double z) 133 | { 134 | x *= _frequency; 135 | y *= _frequency; 136 | z *= _frequency; 137 | var value = 0.0; 138 | var weight = 1.0; 139 | var offset = 1.0; // TODO: Review why Offset is never assigned 140 | var gain = 2.0; // TODO: Review why gain is never assigned 141 | for (var i = 0; i < _octaveCount; i++) 142 | { 143 | var nx = Utils.MakeInt32Range(x); 144 | var ny = Utils.MakeInt32Range(y); 145 | var nz = Utils.MakeInt32Range(z); 146 | long seed = (_seed + i) & 0x7fffffff; 147 | var signal = Utils.GradientCoherentNoise3D(nx, ny, nz, seed, _quality); 148 | signal = Math.Abs(signal); 149 | signal = offset - signal; 150 | signal *= signal; 151 | signal *= weight; 152 | weight = signal * gain; 153 | weight = Mathf.Clamp01((float) weight); 154 | value += (signal * _weights[i]); 155 | x *= _lacunarity; 156 | y *= _lacunarity; 157 | z *= _lacunarity; 158 | } 159 | return (value * 1.25) - 1.0; 160 | } 161 | 162 | #endregion 163 | } 164 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/RidgedMultifractal.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 80802e8c5f463441795212412a4cf4ef 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Spheres.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LibNoise.Generator 4 | { 5 | /// 6 | /// Provides a noise module that outputs concentric spheres. [GENERATOR] 7 | /// 8 | public class Spheres : ModuleBase 9 | { 10 | #region Fields 11 | 12 | private double _frequency = 1.0; 13 | 14 | #endregion 15 | 16 | #region Constructors 17 | 18 | /// 19 | /// Initializes a new instance of Spheres. 20 | /// 21 | public Spheres() 22 | : base(0) 23 | { 24 | } 25 | 26 | /// 27 | /// Initializes a new instance of Spheres. 28 | /// 29 | /// The frequency of the concentric spheres. 30 | public Spheres(double frequency) 31 | : base(0) 32 | { 33 | Frequency = frequency; 34 | } 35 | 36 | #endregion 37 | 38 | #region Properties 39 | 40 | /// 41 | /// Gets or sets the frequency of the concentric spheres. 42 | /// 43 | public double Frequency 44 | { 45 | get { return _frequency; } 46 | set { _frequency = value; } 47 | } 48 | 49 | #endregion 50 | 51 | #region ModuleBase Members 52 | 53 | /// 54 | /// Returns the output value for the given input coordinates. 55 | /// 56 | /// The input coordinate on the x-axis. 57 | /// The input coordinate on the y-axis. 58 | /// The input coordinate on the z-axis. 59 | /// The resulting output value. 60 | public override double GetValue(double x, double y, double z) 61 | { 62 | x *= _frequency; 63 | y *= _frequency; 64 | z *= _frequency; 65 | var dfc = Math.Sqrt(x * x + y * y + z * z); 66 | var dfss = dfc - Math.Floor(dfc); 67 | var dfls = 1.0 - dfss; 68 | var nd = Math.Min(dfss, dfls); 69 | return 1.0 - (nd * 4.0); 70 | } 71 | 72 | #endregion 73 | } 74 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Spheres.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 9cd65dace5b2b41c4bc8d1d344da6cfc 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Voronoi.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LibNoise.Generator 4 | { 5 | /// 6 | /// Provides a noise module that outputs Voronoi cells. [GENERATOR] 7 | /// 8 | public class Voronoi : ModuleBase 9 | { 10 | #region Fields 11 | 12 | private double _displacement = 1.0; 13 | private double _frequency = 1.0; 14 | private int _seed; 15 | private bool _distance; 16 | 17 | #endregion 18 | 19 | #region Constructors 20 | 21 | /// 22 | /// Initializes a new instance of Voronoi. 23 | /// 24 | public Voronoi() 25 | : base(0) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of Voronoi. 31 | /// 32 | /// The frequency of the first octave. 33 | /// The displacement of the ridged-multifractal noise. 34 | /// The seed of the ridged-multifractal noise. 35 | /// Indicates whether the distance from the nearest seed point is applied to the output value. 36 | public Voronoi(double frequency, double displacement, int seed, bool distance) 37 | : base(0) 38 | { 39 | Frequency = frequency; 40 | Displacement = displacement; 41 | Seed = seed; 42 | UseDistance = distance; 43 | } 44 | 45 | #endregion 46 | 47 | #region Properties 48 | 49 | /// 50 | /// Gets or sets the displacement value of the Voronoi cells. 51 | /// 52 | public double Displacement 53 | { 54 | get { return _displacement; } 55 | set { _displacement = value; } 56 | } 57 | 58 | /// 59 | /// Gets or sets the frequency of the seed points. 60 | /// 61 | public double Frequency 62 | { 63 | get { return _frequency; } 64 | set { _frequency = value; } 65 | } 66 | 67 | /// 68 | /// Gets or sets the seed value used by the Voronoi cells. 69 | /// 70 | public int Seed 71 | { 72 | get { return _seed; } 73 | set { _seed = value; } 74 | } 75 | 76 | /// 77 | /// Gets or sets a value whether the distance from the nearest seed point is applied to the output value. 78 | /// 79 | public bool UseDistance 80 | { 81 | get { return _distance; } 82 | set { _distance = value; } 83 | } 84 | 85 | #endregion 86 | 87 | #region ModuleBase Members 88 | 89 | /// 90 | /// Returns the output value for the given input coordinates. 91 | /// 92 | /// The input coordinate on the x-axis. 93 | /// The input coordinate on the y-axis. 94 | /// The input coordinate on the z-axis. 95 | /// The resulting output value. 96 | public override double GetValue(double x, double y, double z) 97 | { 98 | x *= _frequency; 99 | y *= _frequency; 100 | z *= _frequency; 101 | var xi = (x > 0.0 ? (int) x : (int) x - 1); 102 | var iy = (y > 0.0 ? (int) y : (int) y - 1); 103 | var iz = (z > 0.0 ? (int) z : (int) z - 1); 104 | var md = 2147483647.0; 105 | double xc = 0; 106 | double yc = 0; 107 | double zc = 0; 108 | for (var zcu = iz - 2; zcu <= iz + 2; zcu++) 109 | { 110 | for (var ycu = iy - 2; ycu <= iy + 2; ycu++) 111 | { 112 | for (var xcu = xi - 2; xcu <= xi + 2; xcu++) 113 | { 114 | var xp = xcu + Utils.ValueNoise3D(xcu, ycu, zcu, _seed); 115 | var yp = ycu + Utils.ValueNoise3D(xcu, ycu, zcu, _seed + 1); 116 | var zp = zcu + Utils.ValueNoise3D(xcu, ycu, zcu, _seed + 2); 117 | var xd = xp - x; 118 | var yd = yp - y; 119 | var zd = zp - z; 120 | var d = xd * xd + yd * yd + zd * zd; 121 | if (d < md) 122 | { 123 | md = d; 124 | xc = xp; 125 | yc = yp; 126 | zc = zp; 127 | } 128 | } 129 | } 130 | } 131 | double v; 132 | if (_distance) 133 | { 134 | var xd = xc - x; 135 | var yd = yc - y; 136 | var zd = zc - z; 137 | v = (Math.Sqrt(xd * xd + yd * yd + zd * zd)) * Utils.Sqrt3 - 1.0; 138 | } 139 | else 140 | { 141 | v = 0.0; 142 | } 143 | return v + (_displacement * Utils.ValueNoise3D((int) (Math.Floor(xc)), (int) (Math.Floor(yc)), 144 | (int) (Math.Floor(zc)), 0)); 145 | } 146 | 147 | #endregion 148 | } 149 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Generator/Voronoi.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 0d715628644034e579a398e471e978bf 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/GradientPresets.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace LibNoise 5 | { 6 | /// 7 | /// Provides a series of gradient presets 8 | /// 9 | public static class GradientPresets 10 | { 11 | #region Fields 12 | 13 | private static readonly Gradient _empty; 14 | private static readonly Gradient _grayscale; 15 | private static readonly Gradient _rgb; 16 | private static readonly Gradient _rgba; 17 | private static readonly Gradient _terrain; 18 | 19 | #endregion 20 | 21 | #region Constructors 22 | 23 | /// 24 | /// Initializes a new instance of Gradient. 25 | /// 26 | static GradientPresets() 27 | { 28 | // Grayscale gradient color keys 29 | var grayscaleColorKeys = new List 30 | { 31 | new GradientColorKey(Color.black, 0), 32 | new GradientColorKey(Color.white, 1) 33 | }; 34 | 35 | // RGB gradient color keys 36 | var rgbColorKeys = new List 37 | { 38 | new GradientColorKey(Color.red, 0), 39 | new GradientColorKey(Color.green, 0.5f), 40 | new GradientColorKey(Color.blue, 1) 41 | }; 42 | 43 | // RGBA gradient color keys 44 | var rgbaColorKeys = new List 45 | { 46 | new GradientColorKey(Color.red, 0), 47 | new GradientColorKey(Color.green, 1 / 3f), 48 | new GradientColorKey(Color.blue, 2 / 3f), 49 | new GradientColorKey(Color.black, 1) 50 | }; 51 | 52 | // RGBA gradient alpha keys 53 | var rgbaAlphaKeys = new List {new GradientAlphaKey(0, 2 / 3f), new GradientAlphaKey(1, 1)}; 54 | 55 | // Terrain gradient color keys 56 | var terrainColorKeys = new List 57 | { 58 | new GradientColorKey(new Color(0, 0, 0.5f), 0), 59 | new GradientColorKey(new Color(0.125f, 0.25f, 0.5f), 0.4f), 60 | new GradientColorKey(new Color(0.25f, 0.375f, 0.75f), 0.48f), 61 | new GradientColorKey(new Color(0, 0.75f, 0), 0.5f), 62 | new GradientColorKey(new Color(0.75f, 0.75f, 0), 0.625f), 63 | new GradientColorKey(new Color(0.625f, 0.375f, 0.25f), 0.75f), 64 | new GradientColorKey(new Color(0.5f, 1, 1), 0.875f), 65 | new GradientColorKey(Color.white, 1) 66 | }; 67 | 68 | // Generic gradient alpha keys 69 | var alphaKeys = new List {new GradientAlphaKey(1, 0), new GradientAlphaKey(1, 1)}; 70 | 71 | _empty = new Gradient(); 72 | 73 | _rgb = new Gradient(); 74 | _rgb.SetKeys(rgbColorKeys.ToArray(), alphaKeys.ToArray()); 75 | 76 | _rgba = new Gradient(); 77 | _rgba.SetKeys(rgbaColorKeys.ToArray(), rgbaAlphaKeys.ToArray()); 78 | 79 | _grayscale = new Gradient(); 80 | _grayscale.SetKeys(grayscaleColorKeys.ToArray(), alphaKeys.ToArray()); 81 | 82 | _terrain = new Gradient(); 83 | _terrain.SetKeys(terrainColorKeys.ToArray(), alphaKeys.ToArray()); 84 | } 85 | 86 | #endregion 87 | 88 | #region Properties 89 | 90 | /// 91 | /// Gets the empty instance of Gradient. 92 | /// 93 | public static Gradient Empty 94 | { 95 | get { return _empty; } 96 | } 97 | 98 | /// 99 | /// Gets the grayscale instance of Gradient. 100 | /// 101 | public static Gradient Grayscale 102 | { 103 | get { return _grayscale; } 104 | } 105 | 106 | /// 107 | /// Gets the RGB instance of Gradient. 108 | /// 109 | public static Gradient RGB 110 | { 111 | get { return _rgb; } 112 | } 113 | 114 | /// 115 | /// Gets the RGBA instance of Gradient. 116 | /// 117 | public static Gradient RGBA 118 | { 119 | get { return _rgba; } 120 | } 121 | 122 | /// 123 | /// Gets the terrain instance of Gradient. 124 | /// 125 | public static Gradient Terrain 126 | { 127 | get { return _terrain; } 128 | } 129 | 130 | #endregion 131 | } 132 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/GradientPresets.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 7274fe25a8f9642c9b3e34a7e54ecd6f 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/ModuleBase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | using UnityEngine; 4 | using Debug = System.Diagnostics.Debug; 5 | 6 | namespace LibNoise 7 | { 8 | 9 | #region Enumerations 10 | 11 | /// 12 | /// Defines a collection of quality modes. 13 | /// 14 | public enum QualityMode 15 | { 16 | Low, 17 | Medium, 18 | High, 19 | } 20 | 21 | #endregion 22 | 23 | /// 24 | /// Base class for noise modules. 25 | /// 26 | public abstract class ModuleBase : IDisposable 27 | { 28 | #region Fields 29 | 30 | private ModuleBase[] _modules; 31 | 32 | #endregion 33 | 34 | #region Constructors 35 | 36 | /// 37 | /// Initializes a new instance of Helpers. 38 | /// 39 | /// The number of source modules. 40 | protected ModuleBase(int count) 41 | { 42 | if (count > 0) 43 | { 44 | _modules = new ModuleBase[count]; 45 | } 46 | } 47 | 48 | #endregion 49 | 50 | #region Indexers 51 | 52 | /// 53 | /// Gets or sets a source module by index. 54 | /// 55 | /// The index of the source module to aquire. 56 | /// The requested source module. 57 | public virtual ModuleBase this[int index] 58 | { 59 | get 60 | { 61 | Debug.Assert(_modules != null); 62 | Debug.Assert(_modules.Length > 0); 63 | if (index < 0 || index >= _modules.Length) 64 | { 65 | throw new ArgumentOutOfRangeException("Index out of valid module range"); 66 | } 67 | if (_modules[index] == null) 68 | { 69 | throw new ArgumentNullException("Desired element is null"); 70 | } 71 | return _modules[index]; 72 | } 73 | set 74 | { 75 | Debug.Assert(_modules.Length > 0); 76 | if (index < 0 || index >= _modules.Length) 77 | { 78 | throw new ArgumentOutOfRangeException("Index out of valid module range"); 79 | } 80 | if (value == null) 81 | { 82 | throw new ArgumentNullException("Value should not be null"); 83 | } 84 | _modules[index] = value; 85 | } 86 | } 87 | 88 | #endregion 89 | 90 | #region Properties 91 | protected ModuleBase[] Modules 92 | { 93 | get { return _modules; } 94 | } 95 | 96 | /// 97 | /// Gets the number of source modules required by this noise module. 98 | /// 99 | public int SourceModuleCount 100 | { 101 | get { return (_modules == null) ? 0 : _modules.Length; } 102 | } 103 | 104 | #endregion 105 | 106 | #region Methods 107 | 108 | /// 109 | /// Returns the output value for the given input coordinates. 110 | /// 111 | /// The input coordinate on the x-axis. 112 | /// The input coordinate on the y-axis. 113 | /// The input coordinate on the z-axis. 114 | /// The resulting output value. 115 | public abstract double GetValue(double x, double y, double z); 116 | 117 | /// 118 | /// Returns the output value for the given input coordinates. 119 | /// 120 | /// The input coordinate. 121 | /// The resulting output value. 122 | public double GetValue(Vector3 coordinate) 123 | { 124 | return GetValue(coordinate.x, coordinate.y, coordinate.z); 125 | } 126 | 127 | /// 128 | /// Returns the output value for the given input coordinates. 129 | /// 130 | /// The input coordinate. 131 | /// The resulting output value. 132 | public double GetValue(ref Vector3 coordinate) 133 | { 134 | return GetValue(coordinate.x, coordinate.y, coordinate.z); 135 | } 136 | 137 | #endregion 138 | 139 | #region IDisposable Members 140 | 141 | [XmlIgnore] 142 | #if !XBOX360 && !ZUNE 143 | [NonSerialized] 144 | #endif 145 | private bool _disposed; 146 | 147 | /// 148 | /// Gets a value whether the object is disposed. 149 | /// 150 | public bool IsDisposed 151 | { 152 | get { return _disposed; } 153 | } 154 | 155 | /// 156 | /// Immediately releases the unmanaged resources used by this object. 157 | /// 158 | public void Dispose() 159 | { 160 | if (!_disposed) 161 | { 162 | _disposed = Disposing(); 163 | } 164 | GC.SuppressFinalize(this); 165 | } 166 | 167 | /// 168 | /// Immediately releases the unmanaged resources used by this object. 169 | /// 170 | /// True if the object is completely disposed. 171 | protected virtual bool Disposing() 172 | { 173 | if (_modules != null) 174 | { 175 | for (var i = 0; i < _modules.Length; i++) 176 | { 177 | _modules[i].Dispose(); 178 | _modules[i] = null; 179 | } 180 | _modules = null; 181 | } 182 | return true; 183 | } 184 | 185 | #endregion 186 | } 187 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/ModuleBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: e90c63f5533e4400583745edd03b9a44 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Noise2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 9b7ba00b7ee094d618be890f09a59f95 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: dc5e0fafbdfd44742b85ea173f0ac76f 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Abs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace LibNoise.Operator 5 | { 6 | /// 7 | /// Provides a noise module that outputs the absolute value of the output value from 8 | /// a source module. [OPERATOR] 9 | /// 10 | public class Abs : ModuleBase 11 | { 12 | #region Constructors 13 | 14 | /// 15 | /// Initializes a new instance of Abs. 16 | /// 17 | public Abs() 18 | : base(1) 19 | { 20 | } 21 | 22 | /// 23 | /// Initializes a new instance of Abs. 24 | /// 25 | /// The input module. 26 | public Abs(ModuleBase input) 27 | : base(1) 28 | { 29 | Modules[0] = input; 30 | } 31 | 32 | #endregion 33 | 34 | #region ModuleBase Members 35 | 36 | /// 37 | /// Returns the output value for the given input coordinates. 38 | /// 39 | /// The input coordinate on the x-axis. 40 | /// The input coordinate on the y-axis. 41 | /// The input coordinate on the z-axis. 42 | /// The resulting output value. 43 | public override double GetValue(double x, double y, double z) 44 | { 45 | Debug.Assert(Modules[0] != null); 46 | return Math.Abs(Modules[0].GetValue(x, y, z)); 47 | } 48 | 49 | #endregion 50 | } 51 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Abs.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 23b1f62fc46bd4ea79b73bdfa896b034 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Add.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that outputs the sum of the two output values from two 7 | /// source modules. [OPERATOR] 8 | /// 9 | public class Add : ModuleBase 10 | { 11 | #region Constructors 12 | 13 | /// 14 | /// Initializes a new instance of Add. 15 | /// 16 | public Add() 17 | : base(2) 18 | { 19 | } 20 | 21 | /// 22 | /// Initializes a new instance of Add. 23 | /// 24 | /// The left hand input module. 25 | /// The right hand input module. 26 | public Add(ModuleBase lhs, ModuleBase rhs) 27 | : base(2) 28 | { 29 | Modules[0] = lhs; 30 | Modules[1] = rhs; 31 | } 32 | 33 | #endregion 34 | 35 | #region ModuleBase Members 36 | 37 | /// 38 | /// Returns the output value for the given input coordinates. 39 | /// 40 | /// The input coordinate on the x-axis. 41 | /// The input coordinate on the y-axis. 42 | /// The input coordinate on the z-axis. 43 | /// The resulting output value. 44 | public override double GetValue(double x, double y, double z) 45 | { 46 | Debug.Assert(Modules[0] != null); 47 | Debug.Assert(Modules[1] != null); 48 | return Modules[0].GetValue(x, y, z) + Modules[1].GetValue(x, y, z); 49 | } 50 | 51 | #endregion 52 | } 53 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Add.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: d7ac90f93a2ab427c831c60c111bf54f 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Blend.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that outputs a weighted blend of the output values from 7 | /// two source modules given the output value supplied by a control module. [OPERATOR] 8 | /// 9 | public class Blend : ModuleBase 10 | { 11 | #region Constructors 12 | 13 | /// 14 | /// Initializes a new instance of Blend. 15 | /// 16 | public Blend() 17 | : base(3) 18 | { 19 | } 20 | 21 | /// 22 | /// Initializes a new instance of Blend. 23 | /// 24 | /// The left hand input module. 25 | /// The right hand input module. 26 | /// The controller of the operator. 27 | public Blend(ModuleBase lhs, ModuleBase rhs, ModuleBase controller) 28 | : base(3) 29 | { 30 | Modules[0] = lhs; 31 | Modules[1] = rhs; 32 | Modules[2] = controller; 33 | } 34 | 35 | #endregion 36 | 37 | #region Properties 38 | 39 | /// 40 | /// Gets or sets the controlling module. 41 | /// 42 | public ModuleBase Controller 43 | { 44 | get { return Modules[2]; } 45 | set 46 | { 47 | Debug.Assert(value != null); 48 | Modules[2] = value; 49 | } 50 | } 51 | 52 | #endregion 53 | 54 | #region ModuleBase Members 55 | 56 | /// 57 | /// Returns the output value for the given input coordinates. 58 | /// 59 | /// The input coordinate on the x-axis. 60 | /// The input coordinate on the y-axis. 61 | /// The input coordinate on the z-axis. 62 | /// The resulting output value. 63 | public override double GetValue(double x, double y, double z) 64 | { 65 | Debug.Assert(Modules[0] != null); 66 | Debug.Assert(Modules[1] != null); 67 | Debug.Assert(Modules[2] != null); 68 | var a = Modules[0].GetValue(x, y, z); 69 | var b = Modules[1].GetValue(x, y, z); 70 | var c = (Modules[2].GetValue(x, y, z) + 1.0) / 2.0; 71 | return Utils.InterpolateLinear(a, b, c); 72 | } 73 | 74 | #endregion 75 | } 76 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Blend.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 26925e2038d704fcfb699b013c25ae69 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Cache.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that caches the last output value generated by a source 7 | /// module. [OPERATOR] 8 | /// 9 | public class Cache : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _value; 14 | private bool _cached; 15 | private double _x; 16 | private double _y; 17 | private double _z; 18 | 19 | #endregion 20 | 21 | #region Constructors 22 | 23 | /// 24 | /// Initializes a new instance of Cache. 25 | /// 26 | public Cache() 27 | : base(1) 28 | { 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of Cache. 33 | /// 34 | /// The input module. 35 | public Cache(ModuleBase input) 36 | : base(1) 37 | { 38 | Modules[0] = input; 39 | } 40 | 41 | #endregion 42 | 43 | #region ModuleBase Members 44 | 45 | /// 46 | /// Gets or sets a source module by index. 47 | /// 48 | /// The index of the source module to aquire. 49 | /// The requested source module. 50 | public override ModuleBase this[int index] 51 | { 52 | get { return base[index]; } 53 | set 54 | { 55 | base[index] = value; 56 | _cached = false; 57 | } 58 | } 59 | 60 | /// 61 | /// Returns the output value for the given input coordinates. 62 | /// 63 | /// The input coordinate on the x-axis. 64 | /// The input coordinate on the y-axis. 65 | /// The input coordinate on the z-axis. 66 | /// The resulting output value. 67 | public override double GetValue(double x, double y, double z) 68 | { 69 | Debug.Assert(Modules[0] != null); 70 | if (!(_cached && _x == x && _y == y && _z == z)) 71 | { 72 | _value = Modules[0].GetValue(x, y, z); 73 | _x = x; 74 | _y = y; 75 | _z = z; 76 | } 77 | _cached = true; 78 | return _value; 79 | } 80 | 81 | #endregion 82 | } 83 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Cache.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 97d943450f43c42f8a85dd94d870b34e 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Clamp.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that clamps the output value from a source module to a 7 | /// range of values. [OPERATOR] 8 | /// 9 | public class Clamp : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _min = -1.0; 14 | private double _max = 1.0; 15 | 16 | #endregion 17 | 18 | #region Constructors 19 | 20 | /// 21 | /// Initializes a new instance of Clamp. 22 | /// 23 | public Clamp() 24 | : base(1) 25 | { 26 | } 27 | 28 | /// 29 | /// Initializes a new instance of Clamp. 30 | /// 31 | /// The input module. 32 | public Clamp(ModuleBase input) 33 | : base(1) 34 | { 35 | Modules[0] = input; 36 | } 37 | 38 | /// 39 | /// Initializes a new instance of Clamp. 40 | /// 41 | /// The input module. 42 | /// The minimum value. 43 | /// The maximum value. 44 | public Clamp(double min, double max, ModuleBase input) 45 | : base(1) 46 | { 47 | Minimum = min; 48 | Maximum = max; 49 | Modules[0] = input; 50 | } 51 | 52 | #endregion 53 | 54 | #region Properties 55 | 56 | /// 57 | /// Gets or sets the maximum to clamp to. 58 | /// 59 | public double Maximum 60 | { 61 | get { return _max; } 62 | set { _max = value; } 63 | } 64 | 65 | /// 66 | /// Gets or sets the minimum to clamp to. 67 | /// 68 | public double Minimum 69 | { 70 | get { return _min; } 71 | set { _min = value; } 72 | } 73 | 74 | #endregion 75 | 76 | #region Methods 77 | 78 | /// 79 | /// Sets the bounds. 80 | /// 81 | /// The minimum value. 82 | /// The maximum value. 83 | public void SetBounds(double min, double max) 84 | { 85 | Debug.Assert(min < max); 86 | _min = min; 87 | _max = max; 88 | } 89 | 90 | #endregion 91 | 92 | #region ModuleBase Members 93 | 94 | /// 95 | /// Returns the output value for the given input coordinates. 96 | /// 97 | /// The input coordinate on the x-axis. 98 | /// The input coordinate on the y-axis. 99 | /// The input coordinate on the z-axis. 100 | /// The resulting output value. 101 | public override double GetValue(double x, double y, double z) 102 | { 103 | Debug.Assert(Modules[0] != null); 104 | if (_min > _max) 105 | { 106 | var t = _min; 107 | _min = _max; 108 | _max = t; 109 | } 110 | var v = Modules[0].GetValue(x, y, z); 111 | if (v < _min) 112 | { 113 | return _min; 114 | } 115 | if (v > _max) 116 | { 117 | return _max; 118 | } 119 | return v; 120 | } 121 | 122 | #endregion 123 | } 124 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Clamp.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 1f614701fffbe4d6881a735ef849eb92 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Curve.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using Debug = System.Diagnostics.Debug; 4 | 5 | namespace LibNoise.Operator 6 | { 7 | /// 8 | /// Provides a noise module that maps the output value from a source module onto an 9 | /// arbitrary function curve. [OPERATOR] 10 | /// 11 | public class Curve : ModuleBase 12 | { 13 | #region Fields 14 | 15 | private readonly List> _data = new List>(); 16 | 17 | #endregion 18 | 19 | #region Constructors 20 | 21 | /// 22 | /// Initializes a new instance of Curve. 23 | /// 24 | public Curve() 25 | : base(1) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of Curve. 31 | /// 32 | /// The input module. 33 | public Curve(ModuleBase input) 34 | : base(1) 35 | { 36 | Modules[0] = input; 37 | } 38 | 39 | #endregion 40 | 41 | #region Properties 42 | 43 | /// 44 | /// Gets the number of control points. 45 | /// 46 | public int ControlPointCount 47 | { 48 | get { return _data.Count; } 49 | } 50 | 51 | /// 52 | /// Gets the list of control points. 53 | /// 54 | public List> ControlPoints 55 | { 56 | get { return _data; } 57 | } 58 | 59 | #endregion 60 | 61 | #region Methods 62 | 63 | /// 64 | /// Adds a control point to the curve. 65 | /// 66 | /// The curves input value. 67 | /// The curves output value. 68 | public void Add(double input, double output) 69 | { 70 | var kvp = new KeyValuePair(input, output); 71 | if (!_data.Contains(kvp)) 72 | { 73 | _data.Add(kvp); 74 | } 75 | _data.Sort( 76 | delegate(KeyValuePair lhs, KeyValuePair rhs) 77 | { 78 | return lhs.Key.CompareTo(rhs.Key); 79 | }); 80 | } 81 | 82 | /// 83 | /// Clears the control points. 84 | /// 85 | public void Clear() 86 | { 87 | _data.Clear(); 88 | } 89 | 90 | #endregion 91 | 92 | #region ModuleBase Members 93 | 94 | /// 95 | /// Returns the output value for the given input coordinates. 96 | /// 97 | /// The input coordinate on the x-axis. 98 | /// The input coordinate on the y-axis. 99 | /// The input coordinate on the z-axis. 100 | /// The resulting output value. 101 | public override double GetValue(double x, double y, double z) 102 | { 103 | Debug.Assert(Modules[0] != null); 104 | Debug.Assert(ControlPointCount >= 4); 105 | var smv = Modules[0].GetValue(x, y, z); 106 | int ip; 107 | for (ip = 0; ip < _data.Count; ip++) 108 | { 109 | if (smv < _data[ip].Key) 110 | { 111 | break; 112 | } 113 | } 114 | var i0 = Mathf.Clamp(ip - 2, 0, _data.Count - 1); 115 | var i1 = Mathf.Clamp(ip - 1, 0, _data.Count - 1); 116 | var i2 = Mathf.Clamp(ip, 0, _data.Count - 1); 117 | var i3 = Mathf.Clamp(ip + 1, 0, _data.Count - 1); 118 | if (i1 == i2) 119 | { 120 | return _data[i1].Value; 121 | } 122 | //double ip0 = _data[i1].Value; 123 | //double ip1 = _data[i2].Value; 124 | var ip0 = _data[i1].Key; 125 | var ip1 = _data[i2].Key; 126 | var a = (smv - ip0) / (ip1 - ip0); 127 | return Utils.InterpolateCubic(_data[i0].Value, _data[i1].Value, _data[i2].Value, 128 | _data[i3].Value, a); 129 | } 130 | 131 | #endregion 132 | } 133 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Curve.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: d429892d39ef845f392933debac7bfa9 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Displace.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that uses three source modules to displace each 7 | /// coordinate of the input value before returning the output value from 8 | /// a source module. [OPERATOR] 9 | /// 10 | public class Displace : ModuleBase 11 | { 12 | #region Constructors 13 | 14 | /// 15 | /// Initializes a new instance of Displace. 16 | /// 17 | public Displace() 18 | : base(4) 19 | { 20 | } 21 | 22 | /// 23 | /// Initializes a new instance of Displace. 24 | /// 25 | /// The input module. 26 | /// The displacement module of the x-axis. 27 | /// The displacement module of the y-axis. 28 | /// The displacement module of the z-axis. 29 | public Displace(ModuleBase input, ModuleBase x, ModuleBase y, ModuleBase z) 30 | : base(4) 31 | { 32 | Modules[0] = input; 33 | Modules[1] = x; 34 | Modules[2] = y; 35 | Modules[3] = z; 36 | } 37 | 38 | #endregion 39 | 40 | #region Properties 41 | 42 | /// 43 | /// Gets or sets the controlling module on the x-axis. 44 | /// 45 | public ModuleBase X 46 | { 47 | get { return Modules[1]; } 48 | set 49 | { 50 | Debug.Assert(value != null); 51 | Modules[1] = value; 52 | } 53 | } 54 | 55 | /// 56 | /// Gets or sets the controlling module on the z-axis. 57 | /// 58 | public ModuleBase Y 59 | { 60 | get { return Modules[2]; } 61 | set 62 | { 63 | Debug.Assert(value != null); 64 | Modules[2] = value; 65 | } 66 | } 67 | 68 | /// 69 | /// Gets or sets the controlling module on the z-axis. 70 | /// 71 | public ModuleBase Z 72 | { 73 | get { return Modules[3]; } 74 | set 75 | { 76 | Debug.Assert(value != null); 77 | Modules[3] = value; 78 | } 79 | } 80 | 81 | #endregion 82 | 83 | #region ModuleBase Members 84 | 85 | /// 86 | /// Returns the output value for the given input coordinates. 87 | /// 88 | /// The input coordinate on the x-axis. 89 | /// The input coordinate on the y-axis. 90 | /// The input coordinate on the z-axis. 91 | /// The resulting output value. 92 | public override double GetValue(double x, double y, double z) 93 | { 94 | Debug.Assert(Modules[0] != null); 95 | Debug.Assert(Modules[1] != null); 96 | Debug.Assert(Modules[2] != null); 97 | Debug.Assert(Modules[3] != null); 98 | var dx = x + Modules[1].GetValue(x, y, z); 99 | var dy = y + Modules[2].GetValue(x, y, z); 100 | var dz = z + Modules[3].GetValue(x, y, z); 101 | return Modules[0].GetValue(dx, dy, dz); 102 | } 103 | 104 | #endregion 105 | } 106 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Displace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: ae7f5b41abbf54441933a154a7da8df8 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Exponent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace LibNoise.Operator 5 | { 6 | /// 7 | /// Provides a noise module that maps the output value from a source module onto an 8 | /// exponential curve. [OPERATOR] 9 | /// 10 | public class Exponent : ModuleBase 11 | { 12 | #region Fields 13 | 14 | private double _exponent = 1.0; 15 | 16 | #endregion 17 | 18 | #region Constructors 19 | 20 | /// 21 | /// Initializes a new instance of Exponent. 22 | /// 23 | public Exponent() 24 | : base(1) 25 | { 26 | } 27 | 28 | /// 29 | /// Initializes a new instance of Exponent. 30 | /// 31 | /// The input module. 32 | public Exponent(ModuleBase input) 33 | : base(1) 34 | { 35 | Modules[0] = input; 36 | } 37 | 38 | /// 39 | /// Initializes a new instance of Exponent. 40 | /// 41 | /// The exponent to use. 42 | /// The input module. 43 | public Exponent(double exponent, ModuleBase input) 44 | : base(1) 45 | { 46 | Modules[0] = input; 47 | Value = exponent; 48 | } 49 | 50 | #endregion 51 | 52 | #region Properties 53 | 54 | /// 55 | /// Gets or sets the exponent. 56 | /// 57 | public double Value 58 | { 59 | get { return _exponent; } 60 | set { _exponent = value; } 61 | } 62 | 63 | #endregion 64 | 65 | #region ModuleBase Members 66 | 67 | /// 68 | /// Returns the output value for the given input coordinates. 69 | /// 70 | /// The input coordinate on the x-axis. 71 | /// The input coordinate on the y-axis. 72 | /// The input coordinate on the z-axis. 73 | /// The resulting output value. 74 | public override double GetValue(double x, double y, double z) 75 | { 76 | Debug.Assert(Modules[0] != null); 77 | var v = Modules[0].GetValue(x, y, z); 78 | return (Math.Pow(Math.Abs((v + 1.0) / 2.0), _exponent) * 2.0 - 1.0); 79 | } 80 | 81 | #endregion 82 | } 83 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Exponent.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: c3edd0e0a654443fd92d4418bffa8a5d 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Invert.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that inverts the output value from a source module. [OPERATOR] 7 | /// 8 | public class Invert : ModuleBase 9 | { 10 | #region Constructors 11 | 12 | /// 13 | /// Initializes a new instance of Invert. 14 | /// 15 | public Invert() 16 | : base(1) 17 | { 18 | } 19 | 20 | /// 21 | /// Initializes a new instance of Invert. 22 | /// 23 | /// The input module. 24 | public Invert(ModuleBase input) 25 | : base(1) 26 | { 27 | Modules[0] = input; 28 | } 29 | 30 | #endregion 31 | 32 | #region ModuleBase Members 33 | 34 | /// 35 | /// Returns the output value for the given input coordinates. 36 | /// 37 | /// The input coordinate on the x-axis. 38 | /// The input coordinate on the y-axis. 39 | /// The input coordinate on the z-axis. 40 | /// The resulting output value. 41 | public override double GetValue(double x, double y, double z) 42 | { 43 | Debug.Assert(Modules[0] != null); 44 | return -Modules[0].GetValue(x, y, z); 45 | } 46 | 47 | #endregion 48 | } 49 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Invert.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 32c3770b72d4a4b47b1703ca8240448a 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Max.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace LibNoise.Operator 5 | { 6 | /// 7 | /// Provides a noise module that outputs the larger of the two output values from two 8 | /// source modules. [OPERATOR] 9 | /// 10 | public class Max : ModuleBase 11 | { 12 | #region Constructors 13 | 14 | /// 15 | /// Initializes a new instance of Max. 16 | /// 17 | public Max() 18 | : base(2) 19 | { 20 | } 21 | 22 | /// 23 | /// Initializes a new instance of Max. 24 | /// 25 | /// The left hand input module. 26 | /// The right hand input module. 27 | public Max(ModuleBase lhs, ModuleBase rhs) 28 | : base(2) 29 | { 30 | Modules[0] = lhs; 31 | Modules[1] = rhs; 32 | } 33 | 34 | #endregion 35 | 36 | #region ModuleBase Members 37 | 38 | /// 39 | /// Returns the output value for the given input coordinates. 40 | /// 41 | /// The input coordinate on the x-axis. 42 | /// The input coordinate on the y-axis. 43 | /// The input coordinate on the z-axis. 44 | /// The resulting output value. 45 | public override double GetValue(double x, double y, double z) 46 | { 47 | Debug.Assert(Modules[0] != null); 48 | Debug.Assert(Modules[1] != null); 49 | var a = Modules[0].GetValue(x, y, z); 50 | var b = Modules[1].GetValue(x, y, z); 51 | return Math.Max(a, b); 52 | } 53 | 54 | #endregion 55 | } 56 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Max.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 3d783a2fe1eb44925b1dfca3fccfa3c5 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Min.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace LibNoise.Operator 5 | { 6 | /// 7 | /// Provides a noise module that outputs the smaller of the two output values from two 8 | /// source modules. [OPERATOR] 9 | /// 10 | public class Min : ModuleBase 11 | { 12 | #region Constructors 13 | 14 | /// 15 | /// Initializes a new instance of Min. 16 | /// 17 | public Min() 18 | : base(2) 19 | { 20 | } 21 | 22 | /// 23 | /// Initializes a new instance of Min. 24 | /// 25 | /// The left hand input module. 26 | /// The right hand input module. 27 | public Min(ModuleBase lhs, ModuleBase rhs) 28 | : base(2) 29 | { 30 | Modules[0] = lhs; 31 | Modules[1] = rhs; 32 | } 33 | 34 | #endregion 35 | 36 | #region ModuleBase Members 37 | 38 | /// 39 | /// Returns the output value for the given input coordinates. 40 | /// 41 | /// The input coordinate on the x-axis. 42 | /// The input coordinate on the y-axis. 43 | /// The input coordinate on the z-axis. 44 | /// The resulting output value. 45 | public override double GetValue(double x, double y, double z) 46 | { 47 | Debug.Assert(Modules[0] != null); 48 | Debug.Assert(Modules[1] != null); 49 | var a = Modules[0].GetValue(x, y, z); 50 | var b = Modules[1].GetValue(x, y, z); 51 | return Math.Min(a, b); 52 | } 53 | 54 | #endregion 55 | } 56 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Min.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: e0ff3830dd0434df994555aef62c8b9a 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Multiply.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that outputs the product of the two output values from 7 | /// two source modules. [OPERATOR] 8 | /// 9 | public class Multiply : ModuleBase 10 | { 11 | #region Constructors 12 | 13 | /// 14 | /// Initializes a new instance of Multiply. 15 | /// 16 | public Multiply() 17 | : base(2) 18 | { 19 | } 20 | 21 | /// 22 | /// Initializes a new instance of Multiply. 23 | /// 24 | /// The left hand input module. 25 | /// The right hand input module. 26 | public Multiply(ModuleBase lhs, ModuleBase rhs) 27 | : base(2) 28 | { 29 | Modules[0] = lhs; 30 | Modules[1] = rhs; 31 | } 32 | 33 | #endregion 34 | 35 | #region ModuleBase Members 36 | 37 | /// 38 | /// Returns the output value for the given input coordinates. 39 | /// 40 | /// The input coordinate on the x-axis. 41 | /// The input coordinate on the y-axis. 42 | /// The input coordinate on the z-axis. 43 | /// The resulting output value. 44 | public override double GetValue(double x, double y, double z) 45 | { 46 | Debug.Assert(Modules[0] != null); 47 | Debug.Assert(Modules[1] != null); 48 | return Modules[0].GetValue(x, y, z) * Modules[1].GetValue(x, y, z); 49 | } 50 | 51 | #endregion 52 | } 53 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Multiply.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 70b45911e3d204f82a1b4a9c74b8657c 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Power.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | namespace LibNoise.Operator 5 | { 6 | /// 7 | /// Provides a noise module that outputs value from a first source module 8 | /// to the power of the output value from a second source module. [OPERATOR] 9 | /// 10 | public class Power : ModuleBase 11 | { 12 | #region Constructors 13 | 14 | /// 15 | /// Initializes a new instance of Power. 16 | /// 17 | public Power() 18 | : base(2) 19 | { 20 | } 21 | 22 | /// 23 | /// Initializes a new instance of Power. 24 | /// 25 | /// The left hand input module. 26 | /// The right hand input module. 27 | public Power(ModuleBase lhs, ModuleBase rhs) 28 | : base(2) 29 | { 30 | Modules[0] = lhs; 31 | Modules[1] = rhs; 32 | } 33 | 34 | #endregion 35 | 36 | #region ModuleBase Members 37 | 38 | /// 39 | /// Returns the output value for the given input coordinates. 40 | /// 41 | /// The input coordinate on the x-axis. 42 | /// The input coordinate on the y-axis. 43 | /// The input coordinate on the z-axis. 44 | /// The resulting output value. 45 | public override double GetValue(double x, double y, double z) 46 | { 47 | Debug.Assert(Modules[0] != null); 48 | Debug.Assert(Modules[1] != null); 49 | return Math.Pow(Modules[0].GetValue(x, y, z), Modules[1].GetValue(x, y, z)); 50 | } 51 | 52 | #endregion 53 | } 54 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Power.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: ab5f89d2b3238431891abbc5b670cb9b 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Rotate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using Debug = System.Diagnostics.Debug; 4 | 5 | namespace LibNoise.Operator 6 | { 7 | /// 8 | /// Provides a noise module that rotates the input value around the origin before 9 | /// returning the output value from a source module. [OPERATOR] 10 | /// 11 | public class Rotate : ModuleBase 12 | { 13 | #region Fields 14 | 15 | private double _x; 16 | private double _x1Matrix; 17 | private double _x2Matrix; 18 | private double _x3Matrix; 19 | private double _y; 20 | private double _y1Matrix; 21 | private double _y2Matrix; 22 | private double _y3Matrix; 23 | private double _z; 24 | private double _z1Matrix; 25 | private double _z2Matrix; 26 | private double _z3Matrix; 27 | 28 | #endregion 29 | 30 | #region Constructors 31 | 32 | /// 33 | /// Initializes a new instance of Rotate. 34 | /// 35 | public Rotate() 36 | : base(1) 37 | { 38 | SetAngles(0.0, 0.0, 0.0); 39 | } 40 | 41 | /// 42 | /// Initializes a new instance of Rotate. 43 | /// 44 | /// The input module. 45 | public Rotate(ModuleBase input) 46 | : base(1) 47 | { 48 | Modules[0] = input; 49 | } 50 | 51 | /// 52 | /// Initializes a new instance of Rotate. 53 | /// 54 | /// The rotation around the x-axis. 55 | /// The rotation around the y-axis. 56 | /// The rotation around the z-axis. 57 | /// The input module. 58 | public Rotate(double x, double y, double z, ModuleBase input) 59 | : base(1) 60 | { 61 | Modules[0] = input; 62 | SetAngles(x, y, z); 63 | } 64 | 65 | #endregion 66 | 67 | #region Properties 68 | 69 | /// 70 | /// Gets or sets the rotation around the x-axis in degree. 71 | /// 72 | public double X 73 | { 74 | get { return _x; } 75 | set { SetAngles(value, _y, _z); } 76 | } 77 | 78 | /// 79 | /// Gets or sets the rotation around the y-axis in degree. 80 | /// 81 | public double Y 82 | { 83 | get { return _y; } 84 | set { SetAngles(_x, value, _z); } 85 | } 86 | 87 | /// 88 | /// Gets or sets the rotation around the z-axis in degree. 89 | /// 90 | public double Z 91 | { 92 | get { return _x; } 93 | set { SetAngles(_x, _y, value); } 94 | } 95 | 96 | #endregion 97 | 98 | #region Methods 99 | 100 | /// 101 | /// Sets the rotation angles. 102 | /// 103 | /// The rotation around the x-axis. 104 | /// The rotation around the y-axis. 105 | /// The rotation around the z-axis. 106 | private void SetAngles(double x, double y, double z) 107 | { 108 | var xc = Math.Cos(x * Mathf.Deg2Rad); 109 | var yc = Math.Cos(y * Mathf.Deg2Rad); 110 | var zc = Math.Cos(z * Mathf.Deg2Rad); 111 | var xs = Math.Sin(x * Mathf.Deg2Rad); 112 | var ys = Math.Sin(y * Mathf.Deg2Rad); 113 | var zs = Math.Sin(z * Mathf.Deg2Rad); 114 | _x1Matrix = ys * xs * zs + yc * zc; 115 | _y1Matrix = xc * zs; 116 | _z1Matrix = ys * zc - yc * xs * zs; 117 | _x2Matrix = ys * xs * zc - yc * zs; 118 | _y2Matrix = xc * zc; 119 | _z2Matrix = -yc * xs * zc - ys * zs; 120 | _x3Matrix = -ys * xc; 121 | _y3Matrix = xs; 122 | _z3Matrix = yc * xc; 123 | _x = x; 124 | _y = y; 125 | _z = z; 126 | } 127 | 128 | #endregion 129 | 130 | #region ModuleBase Members 131 | 132 | /// 133 | /// Returns the output value for the given input coordinates. 134 | /// 135 | /// The input coordinate on the x-axis. 136 | /// The input coordinate on the y-axis. 137 | /// The input coordinate on the z-axis. 138 | /// The resulting output value. 139 | public override double GetValue(double x, double y, double z) 140 | { 141 | Debug.Assert(Modules[0] != null); 142 | var nx = (_x1Matrix * x) + (_y1Matrix * y) + (_z1Matrix * z); 143 | var ny = (_x2Matrix * x) + (_y2Matrix * y) + (_z2Matrix * z); 144 | var nz = (_x3Matrix * x) + (_y3Matrix * y) + (_z3Matrix * z); 145 | return Modules[0].GetValue(nx, ny, nz); 146 | } 147 | 148 | #endregion 149 | } 150 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Rotate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 798fa977dd6f54c2e843b49808125267 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Scale.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that scales the coordinates of the input value before 7 | /// returning the output value from a source module. [OPERATOR] 8 | /// 9 | public class Scale : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _x = 1.0; 14 | private double _y = 1.0; 15 | private double _z = 1.0; 16 | 17 | #endregion 18 | 19 | #region Constructors 20 | 21 | /// 22 | /// Initializes a new instance of Scale. 23 | /// 24 | public Scale() 25 | : base(1) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of Scale. 31 | /// 32 | /// The input module. 33 | public Scale(ModuleBase input) 34 | : base(1) 35 | { 36 | Modules[0] = input; 37 | } 38 | 39 | /// 40 | /// Initializes a new instance of Scale. 41 | /// 42 | /// The scaling on the x-axis. 43 | /// The scaling on the y-axis. 44 | /// The scaling on the z-axis. 45 | /// The input module. 46 | public Scale(double x, double y, double z, ModuleBase input) 47 | : base(1) 48 | { 49 | Modules[0] = input; 50 | X = x; 51 | Y = y; 52 | Z = z; 53 | } 54 | 55 | #endregion 56 | 57 | #region Properties 58 | 59 | /// 60 | /// Gets or sets the scaling factor on the x-axis. 61 | /// 62 | public double X 63 | { 64 | get { return _x; } 65 | set { _x = value; } 66 | } 67 | 68 | /// 69 | /// Gets or sets the scaling factor on the y-axis. 70 | /// 71 | public double Y 72 | { 73 | get { return _y; } 74 | set { _y = value; } 75 | } 76 | 77 | /// 78 | /// Gets or sets the scaling factor on the z-axis. 79 | /// 80 | public double Z 81 | { 82 | get { return _z; } 83 | set { _z = value; } 84 | } 85 | 86 | #endregion 87 | 88 | #region ModuleBase Members 89 | 90 | /// 91 | /// Returns the output value for the given input coordinates. 92 | /// 93 | /// The input coordinate on the x-axis. 94 | /// The input coordinate on the y-axis. 95 | /// The input coordinate on the z-axis. 96 | /// The resulting output value. 97 | public override double GetValue(double x, double y, double z) 98 | { 99 | Debug.Assert(Modules[0] != null); 100 | return Modules[0].GetValue(x * _x, y * _y, z * _z); 101 | } 102 | 103 | #endregion 104 | } 105 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Scale.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: d8b3b32e2ea7d4b649e21bb7c8efdfc1 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/ScaleBias.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that applies a scaling factor and a bias to the output 7 | /// value from a source module. [OPERATOR] 8 | /// 9 | public class ScaleBias : ModuleBase 10 | { 11 | #region Constructors 12 | 13 | /// 14 | /// Initializes a new instance of ScaleBias. 15 | /// 16 | public ScaleBias() 17 | : base(1) 18 | { 19 | Scale = 1; 20 | } 21 | 22 | /// 23 | /// Initializes a new instance of ScaleBias. 24 | /// 25 | /// The input module. 26 | public ScaleBias(ModuleBase input) 27 | : base(1) 28 | { 29 | Modules[0] = input; 30 | Scale = 1; 31 | } 32 | 33 | /// 34 | /// Initializes a new instance of ScaleBias. 35 | /// 36 | /// The scaling factor to apply to the output value from the source module. 37 | /// The bias to apply to the scaled output value from the source module. 38 | /// The input module. 39 | public ScaleBias(double scale, double bias, ModuleBase input) 40 | : base(1) 41 | { 42 | Modules[0] = input; 43 | Bias = bias; 44 | Scale = scale; 45 | } 46 | 47 | #endregion 48 | 49 | #region Properties 50 | 51 | /// 52 | /// Gets or sets the bias to apply to the scaled output value from the source module. 53 | /// 54 | public double Bias { get; set; } 55 | 56 | /// 57 | /// Gets or sets the scaling factor to apply to the output value from the source module. 58 | /// 59 | public double Scale { get; set; } 60 | #endregion 61 | 62 | #region ModuleBase Members 63 | 64 | /// 65 | /// Returns the output value for the given input coordinates. 66 | /// 67 | /// The input coordinate on the x-axis. 68 | /// The input coordinate on the y-axis. 69 | /// The input coordinate on the z-axis. 70 | /// The resulting output value. 71 | public override double GetValue(double x, double y, double z) 72 | { 73 | Debug.Assert(Modules[0] != null); 74 | return Modules[0].GetValue(x, y, z) * Scale + Bias; 75 | } 76 | 77 | #endregion 78 | } 79 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/ScaleBias.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 5e791d0bd67434b428188c7342ff8789 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Select.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that outputs the value selected from one of two source 7 | /// modules chosen by the output value from a control module. [OPERATOR] 8 | /// 9 | public class Select : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _fallOff; 14 | private double _raw; 15 | private double _min = -1.0; 16 | private double _max = 1.0; 17 | 18 | #endregion 19 | 20 | #region Constructors 21 | 22 | /// 23 | /// Initializes a new instance of Select. 24 | /// 25 | public Select() 26 | : base(3) 27 | { 28 | } 29 | 30 | /// 31 | /// Initializes a new instance of Select. 32 | /// 33 | /// The first input module. 34 | /// The second input module. 35 | /// The controller module. 36 | public Select(ModuleBase inputA, ModuleBase inputB, ModuleBase controller) 37 | : base(3) 38 | { 39 | Modules[0] = inputA; 40 | Modules[1] = inputB; 41 | Modules[2] = controller; 42 | } 43 | 44 | /// 45 | /// Initializes a new instance of Select. 46 | /// 47 | /// The minimum value. 48 | /// The maximum value. 49 | /// The falloff value at the edge transition. 50 | /// The first input module. 51 | /// The second input module. 52 | public Select(double min, double max, double fallOff, ModuleBase inputA, ModuleBase inputB) 53 | : this(inputA, inputB, null) 54 | { 55 | _min = min; 56 | _max = max; 57 | FallOff = fallOff; 58 | } 59 | 60 | #endregion 61 | 62 | #region Properties 63 | 64 | /// 65 | /// Gets or sets the controlling module. 66 | /// 67 | public ModuleBase Controller 68 | { 69 | get { return Modules[2]; } 70 | set 71 | { 72 | Debug.Assert(value != null); 73 | Modules[2] = value; 74 | } 75 | } 76 | 77 | /// 78 | /// Gets or sets the falloff value at the edge transition. 79 | /// 80 | /// 81 | /// Called SetEdgeFallOff() on the original LibNoise. 82 | /// 83 | public double FallOff 84 | { 85 | get { return _fallOff; } 86 | set 87 | { 88 | var bs = _max - _min; 89 | _raw = value; 90 | _fallOff = (value > bs / 2) ? bs / 2 : value; 91 | } 92 | } 93 | 94 | /// 95 | /// Gets or sets the maximum, and re-calculated the fall-off accordingly. 96 | /// 97 | public double Maximum 98 | { 99 | get { return _max; } 100 | set 101 | { 102 | _max = value; 103 | FallOff = _raw; 104 | } 105 | } 106 | 107 | /// 108 | /// Gets or sets the minimum, and re-calculated the fall-off accordingly. 109 | /// 110 | public double Minimum 111 | { 112 | get { return _min; } 113 | set 114 | { 115 | _min = value; 116 | FallOff = _raw; 117 | } 118 | } 119 | 120 | #endregion 121 | 122 | #region Methods 123 | 124 | /// 125 | /// Sets the bounds. 126 | /// 127 | /// The minimum value. 128 | /// The maximum value. 129 | public void SetBounds(double min, double max) 130 | { 131 | Debug.Assert(min < max); 132 | _min = min; 133 | _max = max; 134 | FallOff = _fallOff; 135 | } 136 | 137 | #endregion 138 | 139 | #region ModuleBase Members 140 | 141 | /// 142 | /// Returns the output value for the given input coordinates. 143 | /// 144 | /// The input coordinate on the x-axis. 145 | /// The input coordinate on the y-axis. 146 | /// The input coordinate on the z-axis. 147 | /// The resulting output value. 148 | public override double GetValue(double x, double y, double z) 149 | { 150 | Debug.Assert(Modules[0] != null); 151 | Debug.Assert(Modules[1] != null); 152 | Debug.Assert(Modules[2] != null); 153 | var cv = Modules[2].GetValue(x, y, z); 154 | if (_fallOff > 0.0) 155 | { 156 | double a; 157 | if (cv < (_min - _fallOff)) 158 | { 159 | return Modules[0].GetValue(x, y, z); 160 | } 161 | if (cv < (_min + _fallOff)) 162 | { 163 | var lc = (_min - _fallOff); 164 | var uc = (_min + _fallOff); 165 | a = Utils.MapCubicSCurve((cv - lc) / (uc - lc)); 166 | return Utils.InterpolateLinear(Modules[0].GetValue(x, y, z), 167 | Modules[1].GetValue(x, y, z), a); 168 | } 169 | if (cv < (_max - _fallOff)) 170 | { 171 | return Modules[1].GetValue(x, y, z); 172 | } 173 | if (cv < (_max + _fallOff)) 174 | { 175 | var lc = (_max - _fallOff); 176 | var uc = (_max + _fallOff); 177 | a = Utils.MapCubicSCurve((cv - lc) / (uc - lc)); 178 | return Utils.InterpolateLinear(Modules[1].GetValue(x, y, z), 179 | Modules[0].GetValue(x, y, z), a); 180 | } 181 | return Modules[0].GetValue(x, y, z); 182 | } 183 | if (cv < _min || cv > _max) 184 | { 185 | return Modules[0].GetValue(x, y, z); 186 | } 187 | return Modules[1].GetValue(x, y, z); 188 | } 189 | 190 | #endregion 191 | } 192 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Select.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 68ae76f31b0c84b0593bf02785ebed7c 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Subtract.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that outputs the difference of the two output values from two 7 | /// source modules. [OPERATOR] 8 | /// 9 | public class Subtract : ModuleBase 10 | { 11 | #region Constructors 12 | 13 | /// 14 | /// Initializes a new instance of Subtract. 15 | /// 16 | public Subtract() 17 | : base(2) 18 | { 19 | } 20 | 21 | /// 22 | /// Initializes a new instance of Subtract. 23 | /// 24 | /// The left hand input module. 25 | /// The right hand input module. 26 | public Subtract(ModuleBase lhs, ModuleBase rhs) 27 | : base(2) 28 | { 29 | Modules[0] = lhs; 30 | Modules[1] = rhs; 31 | } 32 | 33 | #endregion 34 | 35 | #region ModuleBase Members 36 | 37 | /// 38 | /// Returns the output value for the given input coordinates. 39 | /// 40 | /// The input coordinate on the x-axis. 41 | /// The input coordinate on the y-axis. 42 | /// The input coordinate on the z-axis. 43 | /// The resulting output value. 44 | public override double GetValue(double x, double y, double z) 45 | { 46 | Debug.Assert(Modules[0] != null); 47 | Debug.Assert(Modules[1] != null); 48 | return Modules[0].GetValue(x, y, z) - Modules[1].GetValue(x, y, z); 49 | } 50 | 51 | #endregion 52 | } 53 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Subtract.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: babee65c2a2764d2da05db9230dd8a22 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Terrace.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Debug = System.Diagnostics.Debug; 5 | 6 | namespace LibNoise.Operator 7 | { 8 | /// 9 | /// Provides a noise module that maps the output value from a source module onto a 10 | /// terrace-forming curve. [OPERATOR] 11 | /// 12 | public class Terrace : ModuleBase 13 | { 14 | #region Fields 15 | 16 | private readonly List _data = new List(); 17 | private bool _inverted; 18 | 19 | #endregion 20 | 21 | #region Constructors 22 | 23 | /// 24 | /// Initializes a new instance of Terrace. 25 | /// 26 | public Terrace() 27 | : base(1) 28 | { 29 | } 30 | 31 | /// 32 | /// Initializes a new instance of Terrace. 33 | /// 34 | /// The input module. 35 | public Terrace(ModuleBase input) 36 | : base(1) 37 | { 38 | Modules[0] = input; 39 | } 40 | 41 | /// 42 | /// Initializes a new instance of Terrace. 43 | /// 44 | /// Indicates whether the terrace curve is inverted. 45 | /// The input module. 46 | public Terrace(bool inverted, ModuleBase input) 47 | : base(1) 48 | { 49 | Modules[0] = input; 50 | IsInverted = inverted; 51 | } 52 | 53 | #endregion 54 | 55 | #region Properties 56 | 57 | /// 58 | /// Gets the number of control points. 59 | /// 60 | public int ControlPointCount 61 | { 62 | get { return _data.Count; } 63 | } 64 | 65 | /// 66 | /// Gets the list of control points. 67 | /// 68 | public List ControlPoints 69 | { 70 | get { return _data; } 71 | } 72 | 73 | /// 74 | /// Gets or sets a value whether the terrace curve is inverted. 75 | /// 76 | public bool IsInverted 77 | { 78 | get { return _inverted; } 79 | set { _inverted = value; } 80 | } 81 | 82 | #endregion 83 | 84 | #region Methods 85 | 86 | /// 87 | /// Adds a control point to the curve. 88 | /// 89 | /// The curves input value. 90 | public void Add(double input) 91 | { 92 | if (!_data.Contains(input)) 93 | { 94 | _data.Add(input); 95 | } 96 | _data.Sort(delegate(double lhs, double rhs) { return lhs.CompareTo(rhs); }); 97 | } 98 | 99 | /// 100 | /// Clears the control points. 101 | /// 102 | public void Clear() 103 | { 104 | _data.Clear(); 105 | } 106 | 107 | /// 108 | /// Auto-generates a terrace curve. 109 | /// 110 | /// The number of steps. 111 | public void Generate(int steps) 112 | { 113 | if (steps < 2) 114 | { 115 | throw new ArgumentException("Need at least two steps"); 116 | } 117 | Clear(); 118 | var ts = 2.0 / (steps - 1.0); 119 | var cv = -1.0; 120 | for (var i = 0; i < steps; i++) 121 | { 122 | Add(cv); 123 | cv += ts; 124 | } 125 | } 126 | 127 | #endregion 128 | 129 | #region ModuleBase Members 130 | 131 | /// 132 | /// Returns the output value for the given input coordinates. 133 | /// 134 | /// The input coordinate on the x-axis. 135 | /// The input coordinate on the y-axis. 136 | /// The input coordinate on the z-axis. 137 | /// The resulting output value. 138 | public override double GetValue(double x, double y, double z) 139 | { 140 | Debug.Assert(Modules[0] != null); 141 | Debug.Assert(ControlPointCount >= 2); 142 | var smv = Modules[0].GetValue(x, y, z); 143 | int ip; 144 | for (ip = 0; ip < _data.Count; ip++) 145 | { 146 | if (smv < _data[ip]) 147 | { 148 | break; 149 | } 150 | } 151 | var i0 = Mathf.Clamp(ip - 1, 0, _data.Count - 1); 152 | var i1 = Mathf.Clamp(ip, 0, _data.Count - 1); 153 | if (i0 == i1) 154 | { 155 | return _data[i1]; 156 | } 157 | var v0 = _data[i0]; 158 | var v1 = _data[i1]; 159 | var a = (smv - v0) / (v1 - v0); 160 | if (_inverted) 161 | { 162 | a = 1.0 - a; 163 | var t = v0; 164 | v0 = v1; 165 | v1 = t; 166 | } 167 | a *= a; 168 | return Utils.InterpolateLinear(v0, v1, a); 169 | } 170 | 171 | #endregion 172 | } 173 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Terrace.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: adbad148cd4a64869873cc8d85051249 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Translate.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace LibNoise.Operator 4 | { 5 | /// 6 | /// Provides a noise module that moves the coordinates of the input value before 7 | /// returning the output value from a source module. [OPERATOR] 8 | /// 9 | public class Translate : ModuleBase 10 | { 11 | #region Fields 12 | 13 | private double _x = 1.0; 14 | private double _y = 1.0; 15 | private double _z = 1.0; 16 | 17 | #endregion 18 | 19 | #region Constructors 20 | 21 | /// 22 | /// Initializes a new instance of Translate. 23 | /// 24 | public Translate() 25 | : base(1) 26 | { 27 | } 28 | 29 | /// 30 | /// Initializes a new instance of Translate. 31 | /// 32 | /// The input module. 33 | public Translate(ModuleBase input) 34 | : base(1) 35 | { 36 | Modules[0] = input; 37 | } 38 | 39 | /// 40 | /// Initializes a new instance of Translate. 41 | /// 42 | /// The translation on the x-axis. 43 | /// The translation on the y-axis. 44 | /// The translation on the z-axis. 45 | /// The input module. 46 | public Translate(double x, double y, double z, ModuleBase input) 47 | : base(1) 48 | { 49 | Modules[0] = input; 50 | X = x; 51 | Y = y; 52 | Z = z; 53 | } 54 | 55 | #endregion 56 | 57 | #region Properties 58 | 59 | /// 60 | /// Gets or sets the translation on the x-axis. 61 | /// 62 | public double X 63 | { 64 | get { return _x; } 65 | set { _x = value; } 66 | } 67 | 68 | /// 69 | /// Gets or sets the translation on the y-axis. 70 | /// 71 | public double Y 72 | { 73 | get { return _y; } 74 | set { _y = value; } 75 | } 76 | 77 | /// 78 | /// Gets or sets the translation on the z-axis. 79 | /// 80 | public double Z 81 | { 82 | get { return _z; } 83 | set { _z = value; } 84 | } 85 | 86 | #endregion 87 | 88 | #region ModuleBase Members 89 | 90 | /// 91 | /// Returns the output value for the given input coordinates. 92 | /// 93 | /// The input coordinate on the x-axis. 94 | /// The input coordinate on the y-axis. 95 | /// The input coordinate on the z-axis. 96 | /// The resulting output value. 97 | public override double GetValue(double x, double y, double z) 98 | { 99 | Debug.Assert(Modules[0] != null); 100 | return Modules[0].GetValue(x + _x, y + _y, z + _z); 101 | } 102 | 103 | #endregion 104 | } 105 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Translate.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 584b45e999fb2415295c796d01c406d9 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Turbulence.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using LibNoise.Generator; 3 | 4 | namespace LibNoise.Operator 5 | { 6 | /// 7 | /// Provides a noise module that that randomly displaces the input value before 8 | /// returning the output value from a source module. [OPERATOR] 9 | /// 10 | public class Turbulence : ModuleBase 11 | { 12 | #region Constants 13 | 14 | private const double X0 = (12414.0 / 65536.0); 15 | private const double Y0 = (65124.0 / 65536.0); 16 | private const double Z0 = (31337.0 / 65536.0); 17 | private const double X1 = (26519.0 / 65536.0); 18 | private const double Y1 = (18128.0 / 65536.0); 19 | private const double Z1 = (60493.0 / 65536.0); 20 | private const double X2 = (53820.0 / 65536.0); 21 | private const double Y2 = (11213.0 / 65536.0); 22 | private const double Z2 = (44845.0 / 65536.0); 23 | 24 | #endregion 25 | 26 | #region Fields 27 | 28 | private double _power = 1.0; 29 | private readonly Perlin _xDistort; 30 | private readonly Perlin _yDistort; 31 | private readonly Perlin _zDistort; 32 | 33 | #endregion 34 | 35 | #region Constructors 36 | 37 | /// 38 | /// Initializes a new instance of Turbulence. 39 | /// 40 | public Turbulence() 41 | : base(1) 42 | { 43 | _xDistort = new Perlin(); 44 | _yDistort = new Perlin(); 45 | _zDistort = new Perlin(); 46 | } 47 | 48 | /// 49 | /// Initializes a new instance of Turbulence. 50 | /// 51 | /// The input module. 52 | public Turbulence(ModuleBase input) 53 | : base(1) 54 | { 55 | _xDistort = new Perlin(); 56 | _yDistort = new Perlin(); 57 | _zDistort = new Perlin(); 58 | Modules[0] = input; 59 | } 60 | 61 | /// 62 | /// Initializes a new instance of Turbulence. 63 | /// 64 | public Turbulence(double power, ModuleBase input) 65 | : this(new Perlin(), new Perlin(), new Perlin(), power, input) 66 | { 67 | } 68 | 69 | /// 70 | /// Initializes a new instance of Turbulence. 71 | /// 72 | /// The perlin noise to apply on the x-axis. 73 | /// The perlin noise to apply on the y-axis. 74 | /// The perlin noise to apply on the z-axis. 75 | /// The power of the turbulence. 76 | /// The input module. 77 | public Turbulence(Perlin x, Perlin y, Perlin z, double power, ModuleBase input) 78 | : base(1) 79 | { 80 | _xDistort = x; 81 | _yDistort = y; 82 | _zDistort = z; 83 | Modules[0] = input; 84 | Power = power; 85 | } 86 | 87 | #endregion 88 | 89 | #region Properties 90 | 91 | /// 92 | /// Gets or sets the frequency of the turbulence. 93 | /// 94 | public double Frequency 95 | { 96 | get { return _xDistort.Frequency; } 97 | set 98 | { 99 | _xDistort.Frequency = value; 100 | _yDistort.Frequency = value; 101 | _zDistort.Frequency = value; 102 | } 103 | } 104 | 105 | /// 106 | /// Gets or sets the power of the turbulence. 107 | /// 108 | public double Power 109 | { 110 | get { return _power; } 111 | set { _power = value; } 112 | } 113 | 114 | /// 115 | /// Gets or sets the roughness of the turbulence. 116 | /// 117 | public int Roughness 118 | { 119 | get { return _xDistort.OctaveCount; } 120 | set 121 | { 122 | _xDistort.OctaveCount = value; 123 | _yDistort.OctaveCount = value; 124 | _zDistort.OctaveCount = value; 125 | } 126 | } 127 | 128 | /// 129 | /// Gets or sets the seed of the turbulence. 130 | /// 131 | public int Seed 132 | { 133 | get { return _xDistort.Seed; } 134 | set 135 | { 136 | _xDistort.Seed = value; 137 | _yDistort.Seed = value + 1; 138 | _zDistort.Seed = value + 2; 139 | } 140 | } 141 | 142 | #endregion 143 | 144 | #region ModuleBase Members 145 | 146 | /// 147 | /// Returns the output value for the given input coordinates. 148 | /// 149 | /// The input coordinate on the x-axis. 150 | /// The input coordinate on the y-axis. 151 | /// The input coordinate on the z-axis. 152 | /// The resulting output value. 153 | public override double GetValue(double x, double y, double z) 154 | { 155 | Debug.Assert(Modules[0] != null); 156 | var xd = x + (_xDistort.GetValue(x + X0, y + Y0, z + Z0) * _power); 157 | var yd = y + (_yDistort.GetValue(x + X1, y + Y1, z + Z1) * _power); 158 | var zd = z + (_zDistort.GetValue(x + X2, y + Y2, z + Z2) * _power); 159 | return Modules[0].GetValue(xd, yd, zd); 160 | } 161 | 162 | #endregion 163 | } 164 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Operator/Turbulence.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 0fff09f24d7f041909a70459bf281bd6 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Properties.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 49675d30a4ae9442e91c545a7507cd48 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | // General Information about an assembly is controlled through the following 5 | // set of attributes. Change these attribute values to modify the information 6 | // associated with an assembly. 7 | 8 | [assembly: AssemblyTitle("LibNoise.Unity")] 9 | [assembly: AssemblyProduct("LibNoise.Unity")] 10 | [assembly: 11 | AssemblyDescription("C# Unity Port of LibNoise, Ported from BigBlackBlock Gamestudio port of LibNoise to XNA")] 12 | [assembly: AssemblyCompany("None")] 13 | [assembly: 14 | AssemblyCopyright( 15 | "LibUnity.Xna Copyright © Jason Bevins 2003-2007, 2010 BigBlackBlock Gamestudio, LibNoise.Unity Copyright © 2010 Unity Commons, distributed under the terms on the Lesser GPL" 16 | )] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | // Setting ComVisible to false makes the types in this assembly not visible 21 | // to COM components. If you need to access a type in this assembly from 22 | // COM, set the ComVisible attribute to true on that type. 23 | 24 | [assembly: ComVisible(false)] 25 | 26 | // The following GUID is for the ID of the typelib if this project is exposed to COM 27 | 28 | [assembly: Guid("aa606d44-f8c3-47aa-a2b5-9156119ff843")] 29 | 30 | // Version information for an assembly consists of the following four values: 31 | // 32 | // Major Version 33 | // Minor Version 34 | // Build Number 35 | // Revision 36 | // 37 | 38 | [assembly: AssemblyVersion("1.0.0.0")] -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Properties/AssemblyInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 9834969af61da4894b115a330b272bb9 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/README.md: -------------------------------------------------------------------------------- 1 | # LibNoise.Unity 2 | 3 | The main repository for LibNoise.Unity is currently maintained by 4 | [Ricardo J. Méndez](https://github.com/ricardojmendez). Pull requests 5 | are welcome. 6 | 7 | ## License 8 | 9 | LibNoise.Unity is released under the 10 | [LGPL license](https://www.gnu.org/licenses/lgpl.html). See COPYING.txt and 11 | COPYING.LESSER.txt for details. 12 | 13 | ## About 14 | 15 | [LibNoise](http://libnoise.sourceforge.net/) was originally created by 16 | Jason Bevins. The library was later ported to Xna by [Marc André Ueberall](http://www.big-black-block.com/#home), and moved to Unity by Tim Speltz. Speltz’s original development forum thread contains a Unity package with 17 | an example scene, which can be found 18 | [here](http://forum.unity3d.com/threads/68764-LibNoise-Ported-to-Unity). Please note that LibNoise.Unity is only a repository for the library code itself and 19 | contains no example files. 20 | 21 | [You can also see the converted tutorials examples on this repository](https://github.com/ricardojmendez/LibNoiseTutorials). 22 | 23 | Other contributors to LibNoise.Unity include 24 | [Teddy Bradford](https://github.com/teddybradford) who reworked much of the 25 | Noise2D class to improve tiling support for noise maps. 26 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/README.md.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 68ca633e34cae4d52ace312cfc9c6652 3 | -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LibNoise 4 | { 5 | internal static class Utils 6 | { 7 | #region Constants 8 | 9 | internal const double Sqrt3 = 1.7320508075688772935; 10 | internal const int OctavesMaximum = 30; 11 | 12 | #if NOISE_VERSION_1 13 | private const int GeneratorNoiseX = 1; 14 | private const int GeneratorNoiseY = 31337; 15 | private const int GeneratorNoiseZ = 263; 16 | private const int GeneratorSeed = 1013; 17 | private const int GeneratorShift = 13; 18 | #else 19 | private const int GeneratorNoiseX = 1619; 20 | private const int GeneratorNoiseY = 31337; 21 | private const int GeneratorNoiseZ = 6971; 22 | private const int GeneratorSeed = 1013; 23 | private const int GeneratorShift = 8; 24 | #endif 25 | 26 | #endregion 27 | 28 | #region Fields 29 | 30 | internal static readonly double[] Randoms = 31 | { 32 | -0.763874, -0.596439, -0.246489, 0.0, 0.396055, 0.904518, -0.158073, 0.0, 33 | -0.499004, -0.8665, -0.0131631, 0.0, 0.468724, -0.824756, 0.316346, 0.0, 34 | 0.829598, 0.43195, 0.353816, 0.0, -0.454473, 0.629497, -0.630228, 0.0, 35 | -0.162349, -0.869962, -0.465628, 0.0, 0.932805, 0.253451, 0.256198, 0.0, 36 | -0.345419, 0.927299, -0.144227, 0.0, -0.715026, -0.293698, -0.634413, 0.0, 37 | -0.245997, 0.717467, -0.651711, 0.0, -0.967409, -0.250435, -0.037451, 0.0, 38 | 0.901729, 0.397108, -0.170852, 0.0, 0.892657, -0.0720622, -0.444938, 0.0, 39 | 0.0260084, -0.0361701, 0.999007, 0.0, 0.949107, -0.19486, 0.247439, 0.0, 40 | 0.471803, -0.807064, -0.355036, 0.0, 0.879737, 0.141845, 0.453809, 0.0, 41 | 0.570747, 0.696415, 0.435033, 0.0, -0.141751, -0.988233, -0.0574584, 0.0, 42 | -0.58219, -0.0303005, 0.812488, 0.0, -0.60922, 0.239482, -0.755975, 0.0, 43 | 0.299394, -0.197066, -0.933557, 0.0, -0.851615, -0.220702, -0.47544, 0.0, 44 | 0.848886, 0.341829, -0.403169, 0.0, -0.156129, -0.687241, 0.709453, 0.0, 45 | -0.665651, 0.626724, 0.405124, 0.0, 0.595914, -0.674582, 0.43569, 0.0, 46 | 0.171025, -0.509292, 0.843428, 0.0, 0.78605, 0.536414, -0.307222, 0.0, 47 | 0.18905, -0.791613, 0.581042, 0.0, -0.294916, 0.844994, 0.446105, 0.0, 48 | 0.342031, -0.58736, -0.7335, 0.0, 0.57155, 0.7869, 0.232635, 0.0, 49 | 0.885026, -0.408223, 0.223791, 0.0, -0.789518, 0.571645, 0.223347, 0.0, 50 | 0.774571, 0.31566, 0.548087, 0.0, -0.79695, -0.0433603, -0.602487, 0.0, 51 | -0.142425, -0.473249, -0.869339, 0.0, -0.0698838, 0.170442, 0.982886, 0.0, 52 | 0.687815, -0.484748, 0.540306, 0.0, 0.543703, -0.534446, -0.647112, 0.0, 53 | 0.97186, 0.184391, -0.146588, 0.0, 0.707084, 0.485713, -0.513921, 0.0, 54 | 0.942302, 0.331945, 0.043348, 0.0, 0.499084, 0.599922, 0.625307, 0.0, 55 | -0.289203, 0.211107, 0.9337, 0.0, 0.412433, -0.71667, -0.56239, 0.0, 56 | 0.87721, -0.082816, 0.47291, 0.0, -0.420685, -0.214278, 0.881538, 0.0, 57 | 0.752558, -0.0391579, 0.657361, 0.0, 0.0765725, -0.996789, 0.0234082, 0.0, 58 | -0.544312, -0.309435, -0.779727, 0.0, -0.455358, -0.415572, 0.787368, 0.0, 59 | -0.874586, 0.483746, 0.0330131, 0.0, 0.245172, -0.0838623, 0.965846, 0.0, 60 | 0.382293, -0.432813, 0.81641, 0.0, -0.287735, -0.905514, 0.311853, 0.0, 61 | -0.667704, 0.704955, -0.239186, 0.0, 0.717885, -0.464002, -0.518983, 0.0, 62 | 0.976342, -0.214895, 0.0240053, 0.0, -0.0733096, -0.921136, 0.382276, 0.0, 63 | -0.986284, 0.151224, -0.0661379, 0.0, -0.899319, -0.429671, 0.0812908, 0.0, 64 | 0.652102, -0.724625, 0.222893, 0.0, 0.203761, 0.458023, -0.865272, 0.0, 65 | -0.030396, 0.698724, -0.714745, 0.0, -0.460232, 0.839138, 0.289887, 0.0, 66 | -0.0898602, 0.837894, 0.538386, 0.0, -0.731595, 0.0793784, 0.677102, 0.0, 67 | -0.447236, -0.788397, 0.422386, 0.0, 0.186481, 0.645855, -0.740335, 0.0, 68 | -0.259006, 0.935463, 0.240467, 0.0, 0.445839, 0.819655, -0.359712, 0.0, 69 | 0.349962, 0.755022, -0.554499, 0.0, -0.997078, -0.0359577, 0.0673977, 0.0, 70 | -0.431163, -0.147516, -0.890133, 0.0, 0.299648, -0.63914, 0.708316, 0.0, 71 | 0.397043, 0.566526, -0.722084, 0.0, -0.502489, 0.438308, -0.745246, 0.0, 72 | 0.0687235, 0.354097, 0.93268, 0.0, -0.0476651, -0.462597, 0.885286, 0.0, 73 | -0.221934, 0.900739, -0.373383, 0.0, -0.956107, -0.225676, 0.186893, 0.0, 74 | -0.187627, 0.391487, -0.900852, 0.0, -0.224209, -0.315405, 0.92209, 0.0, 75 | -0.730807, -0.537068, 0.421283, 0.0, -0.0353135, -0.816748, 0.575913, 0.0, 76 | -0.941391, 0.176991, -0.287153, 0.0, -0.154174, 0.390458, 0.90762, 0.0, 77 | -0.283847, 0.533842, 0.796519, 0.0, -0.482737, -0.850448, 0.209052, 0.0, 78 | -0.649175, 0.477748, 0.591886, 0.0, 0.885373, -0.405387, -0.227543, 0.0, 79 | -0.147261, 0.181623, -0.972279, 0.0, 0.0959236, -0.115847, -0.988624, 0.0, 80 | -0.89724, -0.191348, 0.397928, 0.0, 0.903553, -0.428461, -0.00350461, 0.0, 81 | 0.849072, -0.295807, -0.437693, 0.0, 0.65551, 0.741754, -0.141804, 0.0, 82 | 0.61598, -0.178669, 0.767232, 0.0, 0.0112967, 0.932256, -0.361623, 0.0, 83 | -0.793031, 0.258012, 0.551845, 0.0, 0.421933, 0.454311, 0.784585, 0.0, 84 | -0.319993, 0.0401618, -0.946568, 0.0, -0.81571, 0.551307, -0.175151, 0.0, 85 | -0.377644, 0.00322313, 0.925945, 0.0, 0.129759, -0.666581, -0.734052, 0.0, 86 | 0.601901, -0.654237, -0.457919, 0.0, -0.927463, -0.0343576, -0.372334, 0.0, 87 | -0.438663, -0.868301, -0.231578, 0.0, -0.648845, -0.749138, -0.133387, 0.0, 88 | 0.507393, -0.588294, 0.629653, 0.0, 0.726958, 0.623665, 0.287358, 0.0, 89 | 0.411159, 0.367614, -0.834151, 0.0, 0.806333, 0.585117, -0.0864016, 0.0, 90 | 0.263935, -0.880876, 0.392932, 0.0, 0.421546, -0.201336, 0.884174, 0.0, 91 | -0.683198, -0.569557, -0.456996, 0.0, -0.117116, -0.0406654, -0.992285, 0.0, 92 | -0.643679, -0.109196, -0.757465, 0.0, -0.561559, -0.62989, 0.536554, 0.0, 93 | 0.0628422, 0.104677, -0.992519, 0.0, 0.480759, -0.2867, -0.828658, 0.0, 94 | -0.228559, -0.228965, -0.946222, 0.0, -0.10194, -0.65706, -0.746914, 0.0, 95 | 0.0689193, -0.678236, 0.731605, 0.0, 0.401019, -0.754026, 0.52022, 0.0, 96 | -0.742141, 0.547083, -0.387203, 0.0, -0.00210603, -0.796417, -0.604745, 0.0, 97 | 0.296725, -0.409909, -0.862513, 0.0, -0.260932, -0.798201, 0.542945, 0.0, 98 | -0.641628, 0.742379, 0.192838, 0.0, -0.186009, -0.101514, 0.97729, 0.0, 99 | 0.106711, -0.962067, 0.251079, 0.0, -0.743499, 0.30988, -0.592607, 0.0, 100 | -0.795853, -0.605066, -0.0226607, 0.0, -0.828661, -0.419471, -0.370628, 0.0, 101 | 0.0847218, -0.489815, -0.8677, 0.0, -0.381405, 0.788019, -0.483276, 0.0, 102 | 0.282042, -0.953394, 0.107205, 0.0, 0.530774, 0.847413, 0.0130696, 0.0, 103 | 0.0515397, 0.922524, 0.382484, 0.0, -0.631467, -0.709046, 0.313852, 0.0, 104 | 0.688248, 0.517273, 0.508668, 0.0, 0.646689, -0.333782, -0.685845, 0.0, 105 | -0.932528, -0.247532, -0.262906, 0.0, 0.630609, 0.68757, -0.359973, 0.0, 106 | 0.577805, -0.394189, 0.714673, 0.0, -0.887833, -0.437301, -0.14325, 0.0, 107 | 0.690982, 0.174003, 0.701617, 0.0, -0.866701, 0.0118182, 0.498689, 0.0, 108 | -0.482876, 0.727143, 0.487949, 0.0, -0.577567, 0.682593, -0.447752, 0.0, 109 | 0.373768, 0.0982991, 0.922299, 0.0, 0.170744, 0.964243, -0.202687, 0.0, 110 | 0.993654, -0.035791, -0.106632, 0.0, 0.587065, 0.4143, -0.695493, 0.0, 111 | -0.396509, 0.26509, -0.878924, 0.0, -0.0866853, 0.83553, -0.542563, 0.0, 112 | 0.923193, 0.133398, -0.360443, 0.0, 0.00379108, -0.258618, 0.965972, 0.0, 113 | 0.239144, 0.245154, -0.939526, 0.0, 0.758731, -0.555871, 0.33961, 0.0, 114 | 0.295355, 0.309513, 0.903862, 0.0, 0.0531222, -0.91003, -0.411124, 0.0, 115 | 0.270452, 0.0229439, -0.96246, 0.0, 0.563634, 0.0324352, 0.825387, 0.0, 116 | 0.156326, 0.147392, 0.976646, 0.0, -0.0410141, 0.981824, 0.185309, 0.0, 117 | -0.385562, -0.576343, -0.720535, 0.0, 0.388281, 0.904441, 0.176702, 0.0, 118 | 0.945561, -0.192859, -0.262146, 0.0, 0.844504, 0.520193, 0.127325, 0.0, 119 | 0.0330893, 0.999121, -0.0257505, 0.0, -0.592616, -0.482475, -0.644999, 0.0, 120 | 0.539471, 0.631024, -0.557476, 0.0, 0.655851, -0.027319, -0.754396, 0.0, 121 | 0.274465, 0.887659, 0.369772, 0.0, -0.123419, 0.975177, -0.183842, 0.0, 122 | -0.223429, 0.708045, 0.66989, 0.0, -0.908654, 0.196302, 0.368528, 0.0, 123 | -0.95759, -0.00863708, 0.288005, 0.0, 0.960535, 0.030592, 0.276472, 0.0, 124 | -0.413146, 0.907537, 0.0754161, 0.0, -0.847992, 0.350849, -0.397259, 0.0, 125 | 0.614736, 0.395841, 0.68221, 0.0, -0.503504, -0.666128, -0.550234, 0.0, 126 | -0.268833, -0.738524, -0.618314, 0.0, 0.792737, -0.60001, -0.107502, 0.0, 127 | -0.637582, 0.508144, -0.579032, 0.0, 0.750105, 0.282165, -0.598101, 0.0, 128 | -0.351199, -0.392294, -0.850155, 0.0, 0.250126, -0.960993, -0.118025, 0.0, 129 | -0.732341, 0.680909, -0.0063274, 0.0, -0.760674, -0.141009, 0.633634, 0.0, 130 | 0.222823, -0.304012, 0.926243, 0.0, 0.209178, 0.505671, 0.836984, 0.0, 131 | 0.757914, -0.56629, -0.323857, 0.0, -0.782926, -0.339196, 0.52151, 0.0, 132 | -0.462952, 0.585565, 0.665424, 0.0, 0.61879, 0.194119, -0.761194, 0.0, 133 | 0.741388, -0.276743, 0.611357, 0.0, 0.707571, 0.702621, 0.0752872, 0.0, 134 | 0.156562, 0.819977, 0.550569, 0.0, -0.793606, 0.440216, 0.42, 0.0, 135 | 0.234547, 0.885309, -0.401517, 0.0, 0.132598, 0.80115, -0.58359, 0.0, 136 | -0.377899, -0.639179, 0.669808, 0.0, -0.865993, -0.396465, 0.304748, 0.0, 137 | -0.624815, -0.44283, 0.643046, 0.0, -0.485705, 0.825614, -0.287146, 0.0, 138 | -0.971788, 0.175535, 0.157529, 0.0, -0.456027, 0.392629, 0.798675, 0.0, 139 | -0.0104443, 0.521623, -0.853112, 0.0, -0.660575, -0.74519, 0.091282, 0.0, 140 | -0.0157698, -0.307475, -0.951425, 0.0, -0.603467, -0.250192, 0.757121, 0.0, 141 | 0.506876, 0.25006, 0.824952, 0.0, 0.255404, 0.966794, 0.00884498, 0.0, 142 | 0.466764, -0.874228, -0.133625, 0.0, 0.475077, -0.0682351, -0.877295, 0.0, 143 | -0.224967, -0.938972, -0.260233, 0.0, -0.377929, -0.814757, -0.439705, 0.0, 144 | -0.305847, 0.542333, -0.782517, 0.0, 0.26658, -0.902905, -0.337191, 0.0, 145 | 0.0275773, 0.322158, -0.946284, 0.0, 0.0185422, 0.716349, 0.697496, 0.0, 146 | -0.20483, 0.978416, 0.0273371, 0.0, -0.898276, 0.373969, 0.230752, 0.0, 147 | -0.00909378, 0.546594, 0.837349, 0.0, 0.6602, -0.751089, 0.000959236, 0.0, 148 | 0.855301, -0.303056, 0.420259, 0.0, 0.797138, 0.0623013, -0.600574, 0.0, 149 | 0.48947, -0.866813, 0.0951509, 0.0, 0.251142, 0.674531, 0.694216, 0.0, 150 | -0.578422, -0.737373, -0.348867, 0.0, -0.254689, -0.514807, 0.818601, 0.0, 151 | 0.374972, 0.761612, 0.528529, 0.0, 0.640303, -0.734271, -0.225517, 0.0, 152 | -0.638076, 0.285527, 0.715075, 0.0, 0.772956, -0.15984, -0.613995, 0.0, 153 | 0.798217, -0.590628, 0.118356, 0.0, -0.986276, -0.0578337, -0.154644, 0.0, 154 | -0.312988, -0.94549, 0.0899272, 0.0, -0.497338, 0.178325, 0.849032, 0.0, 155 | -0.101136, -0.981014, 0.165477, 0.0, -0.521688, 0.0553434, -0.851339, 0.0, 156 | -0.786182, -0.583814, 0.202678, 0.0, -0.565191, 0.821858, -0.0714658, 0.0, 157 | 0.437895, 0.152598, -0.885981, 0.0, -0.92394, 0.353436, -0.14635, 0.0, 158 | 0.212189, -0.815162, -0.538969, 0.0, -0.859262, 0.143405, -0.491024, 0.0, 159 | 0.991353, 0.112814, 0.0670273, 0.0, 0.0337884, -0.979891, -0.196654, 0.0 160 | }; 161 | 162 | #endregion 163 | 164 | #region Methods 165 | 166 | internal static double GradientCoherentNoise3D(double x, double y, double z, long seed, QualityMode quality) 167 | { 168 | var x0 = x > 0.0 ? (int) x : (int) x - 1; 169 | var x1 = x0 + 1; 170 | var y0 = y > 0.0 ? (int) y : (int) y - 1; 171 | var y1 = y0 + 1; 172 | var z0 = z > 0.0 ? (int) z : (int) z - 1; 173 | var z1 = z0 + 1; 174 | double xs = 0, ys = 0, zs = 0; 175 | switch (quality) 176 | { 177 | case QualityMode.Low: 178 | { 179 | xs = (x - x0); 180 | ys = (y - y0); 181 | zs = (z - z0); 182 | break; 183 | } 184 | case QualityMode.Medium: 185 | { 186 | xs = MapCubicSCurve(x - x0); 187 | ys = MapCubicSCurve(y - y0); 188 | zs = MapCubicSCurve(z - z0); 189 | break; 190 | } 191 | case QualityMode.High: 192 | { 193 | xs = MapQuinticSCurve(x - x0); 194 | ys = MapQuinticSCurve(y - y0); 195 | zs = MapQuinticSCurve(z - z0); 196 | break; 197 | } 198 | } 199 | var n0 = GradientNoise3D(x, y, z, x0, y0, z0, seed); 200 | var n1 = GradientNoise3D(x, y, z, x1, y0, z0, seed); 201 | var ix0 = InterpolateLinear(n0, n1, xs); 202 | n0 = GradientNoise3D(x, y, z, x0, y1, z0, seed); 203 | n1 = GradientNoise3D(x, y, z, x1, y1, z0, seed); 204 | var ix1 = InterpolateLinear(n0, n1, xs); 205 | var iy0 = InterpolateLinear(ix0, ix1, ys); 206 | n0 = GradientNoise3D(x, y, z, x0, y0, z1, seed); 207 | n1 = GradientNoise3D(x, y, z, x1, y0, z1, seed); 208 | ix0 = InterpolateLinear(n0, n1, xs); 209 | n0 = GradientNoise3D(x, y, z, x0, y1, z1, seed); 210 | n1 = GradientNoise3D(x, y, z, x1, y1, z1, seed); 211 | ix1 = InterpolateLinear(n0, n1, xs); 212 | var iy1 = InterpolateLinear(ix0, ix1, ys); 213 | return InterpolateLinear(iy0, iy1, zs); 214 | } 215 | 216 | internal static double GradientNoise3D(double fx, double fy, double fz, int ix, int iy, int iz, long seed) 217 | { 218 | var i = (GeneratorNoiseX * ix + GeneratorNoiseY * iy + GeneratorNoiseZ * iz + 219 | GeneratorSeed * seed) & 0xffffffff; 220 | i ^= (i >> GeneratorShift); 221 | i &= 0xff; 222 | var xvg = Randoms[(i << 2)]; 223 | var yvg = Randoms[(i << 2) + 1]; 224 | var zvg = Randoms[(i << 2) + 2]; 225 | var xvp = (fx - ix); 226 | var yvp = (fy - iy); 227 | var zvp = (fz - iz); 228 | return ((xvg * xvp) + (yvg * yvp) + (zvg * zvp)) * 2.12; 229 | } 230 | 231 | internal static double InterpolateCubic(double a, double b, double c, double d, double position) 232 | { 233 | var p = (d - c) - (a - b); 234 | var q = (a - b) - p; 235 | var r = c - a; 236 | var s = b; 237 | return p * position * position * position + q * position * position + r * position + s; 238 | } 239 | 240 | internal static double InterpolateLinear(double a, double b, double position) 241 | { 242 | return ((1.0 - position) * a) + (position * b); 243 | } 244 | 245 | internal static double MakeInt32Range(double value) 246 | { 247 | if (value >= 1073741824.0) 248 | { 249 | return (2.0 * Math.IEEERemainder(value, 1073741824.0)) - 1073741824.0; 250 | } 251 | if (value <= -1073741824.0) 252 | { 253 | return (2.0 * Math.IEEERemainder(value, 1073741824.0)) + 1073741824.0; 254 | } 255 | return value; 256 | } 257 | 258 | internal static double MapCubicSCurve(double value) 259 | { 260 | return (value * value * (3.0 - 2.0 * value)); 261 | } 262 | 263 | internal static double MapQuinticSCurve(double value) 264 | { 265 | var a3 = value * value * value; 266 | var a4 = a3 * value; 267 | var a5 = a4 * value; 268 | return (6.0 * a5) - (15.0 * a4) + (10.0 * a3); 269 | } 270 | 271 | internal static double ValueNoise3D(int x, int y, int z, int seed) 272 | { 273 | return 1.0 - (ValueNoise3DInt(x, y, z, seed) / 1073741824.0); 274 | } 275 | 276 | internal static long ValueNoise3DInt(int x, int y, int z, int seed) 277 | { 278 | long n = (GeneratorNoiseX * x + GeneratorNoiseY * y + GeneratorNoiseZ * z + 279 | GeneratorSeed * seed) & 0x7fffffff; 280 | n = (n >> 13) ^ n; 281 | return (n * (n * n * 60493 + 19990303) + 1376312589) & 0x7fffffff; 282 | } 283 | 284 | #endregion 285 | } 286 | } -------------------------------------------------------------------------------- /Assets/Resources/LibNoise/Utils.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 1 2 | guid: 32fa019161d9a4cd3b1a9173943428f3 3 | -------------------------------------------------------------------------------- /Assets/Scenes/NoiseGenerator.unity: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Scenes/NoiseGenerator.unity -------------------------------------------------------------------------------- /Assets/Scenes/NoiseGeneratorSettings.lighting: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/Scenes/NoiseGeneratorSettings.lighting -------------------------------------------------------------------------------- /Assets/Scripts/DemoController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class DemoController : MonoBehaviour { 6 | 7 | private GameObject planet; 8 | private GameObject sunLight; 9 | private MapGenerator mapGen; 10 | 11 | void Awake() { 12 | planet = GameObject.FindGameObjectWithTag("GGPlanet"); 13 | sunLight = GameObject.FindGameObjectWithTag("SunLight"); 14 | mapGen = FindObjectOfType(); 15 | mapGen.GenerateMap(); 16 | } 17 | 18 | // Update is called once per frame 19 | void Update () { 20 | planet.transform.Rotate(Vector3.down * Time.deltaTime); 21 | sunLight.transform.Rotate(Vector3.up * Time.deltaTime *1.3f); 22 | 23 | } 24 | 25 | private void OnApplicationQuit() 26 | { 27 | mapGen.HaltThreads(); 28 | } 29 | 30 | private void OnDestroy() 31 | { 32 | mapGen.HaltThreads(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Assets/Scripts/FlatMeshGenerator.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using LibNoise; 5 | using LibNoise.Generator; 6 | /// 7 | /// Eventual goal with this class is to be able to construct it 8 | /// such that it will render a panel of the planet 9 | /// at differing resolutions to generate zoomed in LOD maps 10 | /// for gameplay all the way down to the ground. 11 | /// 12 | public static class FlatMeshGenerator { 13 | 14 | //function to take a noisemap and adjust a flat terrainmesh according to that map. 15 | public static MeshData GenerateTerrainMesh(Noise2D noisemap, float multiplier, AnimationCurve adjustment) 16 | { 17 | 18 | float topLeftX = (noisemap.Width - 1) / 2f; 19 | float topLeftZ = (noisemap.Height - 1) / 2f; 20 | MeshData meshData = new MeshData(noisemap.Width, noisemap.Height); 21 | int vertexIndex = 0; 22 | 23 | for (int y = 0; y < noisemap.Height; y++) 24 | { 25 | for (int x = 0; x < noisemap.Width; x++) 26 | { 27 | meshData.vertices[vertexIndex] = new Vector3(x - topLeftX, adjustment.Evaluate(noisemap[x, y]) * multiplier*1000, topLeftZ - y); 28 | meshData.uvs[vertexIndex] = new Vector2(x / (float)noisemap.Width, y / (float)noisemap.Height); 29 | if (x < noisemap.Width - 1 && y < noisemap.Height - 1) 30 | { 31 | meshData.AddTriangle(vertexIndex, vertexIndex + noisemap.Width + 1, vertexIndex + noisemap.Width); 32 | meshData.AddTriangle(vertexIndex+noisemap.Width+1, vertexIndex, vertexIndex + 1); 33 | } 34 | vertexIndex++; 35 | } 36 | 37 | } 38 | 39 | return meshData; 40 | 41 | } 42 | } 43 | 44 | public class MeshData 45 | { 46 | public Vector3[] vertices; 47 | public int[] triangles; 48 | public Vector2[] uvs; 49 | 50 | 51 | int triangleIndex; 52 | 53 | public MeshData(int meshWidth, int meshHeight) 54 | { 55 | vertices = new Vector3[meshWidth * meshHeight]; 56 | uvs = new Vector2[meshWidth * meshHeight]; 57 | triangles = new int[(meshWidth - 1) * (meshHeight - 1) * 6]; 58 | 59 | } 60 | public void AddTriangle (int a, int b, int c) 61 | { 62 | triangles[triangleIndex] = a; 63 | triangles[triangleIndex+1] = b; 64 | triangles[triangleIndex+2] = c; 65 | triangleIndex += 3; 66 | } 67 | 68 | public Mesh CreateMesh() 69 | { 70 | Mesh mesh = new Mesh(); 71 | mesh.vertices = vertices; 72 | mesh.triangles = triangles; 73 | mesh.uv = uvs; 74 | mesh.RecalculateNormals(); 75 | return mesh; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Assets/Scripts/MapDisplay.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class MapDisplay : MonoBehaviour { 6 | 7 | public Renderer TextureRender; 8 | public MeshFilter meshFilter; 9 | public MeshRenderer meshRenderer; 10 | 11 | //used for the flat map generator 12 | public void DrawMesh(MeshData meshData, Texture2D texture) 13 | { 14 | meshFilter.sharedMesh = meshData.CreateMesh(); 15 | meshRenderer.sharedMaterial.mainTexture = texture; 16 | meshRenderer.sharedMaterial.mainTextureOffset = new Vector2(-0.0f, 0); 17 | TextureRender.transform.localScale = new Vector3(texture.height, texture.height, texture.height); 18 | 19 | } 20 | 21 | public void SetTexture(Texture2D texture) 22 | { 23 | meshRenderer.sharedMaterial.mainTexture = texture; 24 | } 25 | 26 | public void DrawMesh(Mesh mesh, Texture2D texture) 27 | { 28 | meshFilter.sharedMesh = mesh; 29 | meshRenderer.sharedMaterial.mainTexture = texture; 30 | //noisemap texture is off by a quarter left on it's axis versus the mesh. 31 | meshRenderer.sharedMaterial.mainTextureOffset = new Vector2(-0.25f,0); 32 | TextureRender.transform.localScale = new Vector3(1, 1, 1); 33 | 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /Assets/Scripts/MiscStatics.cs: -------------------------------------------------------------------------------- 1 | public static class MiscStatics 2 | { 3 | public static T[] RemoveAt(this T[] source, int index) 4 | { 5 | 6 | T[] dest = new T[source.Length - 1]; 7 | if (index > 0) 8 | System.Array.Copy(source, 0, dest, 0, index); 9 | 10 | if (index < source.Length - 1) 11 | System.Array.Copy(source, index + 1, dest, index, source.Length - index - 1); 12 | 13 | return dest; 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /Assets/Scripts/SphereMagic.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using LibNoise.Generator; 3 | using LibNoise.Operator; 4 | using LibNoise; 5 | 6 | /// 7 | /// This is the class to use for generating an entire planet that 8 | /// needs to be rotated etc. 9 | /// 10 | 11 | public static class SphereMagic 12 | { 13 | 14 | private static Vector3[] directions = { 15 | Vector3.left, 16 | Vector3.back, 17 | Vector3.right, 18 | Vector3.forward 19 | }; 20 | 21 | public static Mesh CreatePlanet(int subdivisions, float radius, ModuleBase noiseModule, float adjustment, TerrainType[] regions) 22 | { 23 | if (subdivisions < 0) 24 | { 25 | subdivisions = 0; 26 | Debug.LogWarning("LOD set to 0."); 27 | } 28 | else if (subdivisions > 6) 29 | { 30 | subdivisions = 6; 31 | Debug.LogWarning("LOD set to 6."); 32 | } 33 | 34 | int resolution = 1 << subdivisions; 35 | Vector3[] vertices = new Vector3[(resolution + 1) * (resolution + 1) * 4 - (resolution * 2 - 1) * 3]; 36 | int[] triangles = new int[(1 << (subdivisions * 2 + 3)) * 3]; 37 | CreateOctahedron(vertices, triangles, resolution); 38 | 39 | Vector3[] normals = new Vector3[vertices.Length]; 40 | Normalize(vertices, normals); 41 | 42 | Vector2[] uv = new Vector2[vertices.Length]; 43 | CreateUV(vertices, uv); 44 | 45 | double[] heightadjustments = new double[vertices.Length]; 46 | CreateHeightArray(vertices, heightadjustments, noiseModule); 47 | 48 | 49 | Vector4[] tangents = new Vector4[vertices.Length]; 50 | CreateTangents(vertices, tangents); 51 | //heightmap adjustment here 52 | 53 | for (int i = 0; i < vertices.Length; i++) 54 | { 55 | vertices[i] *= radius + (float)heightadjustments[i]*adjustment * radius; 56 | } 57 | 58 | 59 | Mesh mesh = new Mesh 60 | { 61 | name = "Planet", 62 | vertices = vertices, 63 | normals = normals, 64 | uv = uv, 65 | tangents = tangents, 66 | triangles = triangles 67 | }; 68 | return mesh; 69 | } 70 | 71 | private static void CreateOctahedron(Vector3[] vertices, int[] triangles, int resolution) 72 | { 73 | int v = 0, vBottom = 0, t = 0; 74 | 75 | for (int i = 0; i < 4; i++) 76 | { 77 | vertices[v++] = Vector3.down; 78 | } 79 | 80 | for (int i = 1; i <= resolution; i++) 81 | { 82 | float progress = (float)i / resolution; 83 | Vector3 from, to; 84 | vertices[v++] = to = Vector3.Lerp(Vector3.down, Vector3.forward, progress); 85 | for (int d = 0; d < 4; d++) 86 | { 87 | from = to; 88 | to = Vector3.Lerp(Vector3.down, directions[d], progress); 89 | t = CreateLowerStrip(i, v, vBottom, t, triangles); 90 | v = CreateVertexLine(from, to, i, v, vertices); 91 | vBottom += i > 1 ? (i - 1) : 1; 92 | } 93 | vBottom = v - 1 - i * 4; 94 | } 95 | 96 | for (int i = resolution - 1; i >= 1; i--) 97 | { 98 | float progress = (float)i / resolution; 99 | Vector3 from, to; 100 | vertices[v++] = to = Vector3.Lerp(Vector3.up, Vector3.forward, progress); 101 | for (int d = 0; d < 4; d++) 102 | { 103 | from = to; 104 | to = Vector3.Lerp(Vector3.up, directions[d], progress); 105 | t = CreateUpperStrip(i, v, vBottom, t, triangles); 106 | v = CreateVertexLine(from, to, i, v, vertices); 107 | vBottom += i + 1; 108 | } 109 | vBottom = v - 1 - i * 4; 110 | } 111 | 112 | for (int i = 0; i < 4; i++) 113 | { 114 | triangles[t++] = vBottom; 115 | triangles[t++] = v; 116 | triangles[t++] = ++vBottom; 117 | vertices[v++] = Vector3.up; 118 | } 119 | } 120 | 121 | private static int CreateVertexLine(Vector3 from, Vector3 to, int steps, int v, Vector3[] vertices) 122 | { 123 | for (int i = 1; i <= steps; i++) 124 | { 125 | vertices[v++] = Vector3.Lerp(from, to, (float)i / steps); 126 | } 127 | return v; 128 | } 129 | 130 | private static int CreateLowerStrip(int steps, int vTop, int vBottom, int t, int[] triangles) 131 | { 132 | for (int i = 1; i < steps; i++) 133 | { 134 | triangles[t++] = vBottom; 135 | triangles[t++] = vTop - 1; 136 | triangles[t++] = vTop; 137 | 138 | triangles[t++] = vBottom++; 139 | triangles[t++] = vTop++; 140 | triangles[t++] = vBottom; 141 | } 142 | triangles[t++] = vBottom; 143 | triangles[t++] = vTop - 1; 144 | triangles[t++] = vTop; 145 | return t; 146 | } 147 | 148 | private static int CreateUpperStrip(int steps, int vTop, int vBottom, int t, int[] triangles) 149 | { 150 | triangles[t++] = vBottom; 151 | triangles[t++] = vTop - 1; 152 | triangles[t++] = ++vBottom; 153 | for (int i = 1; i <= steps; i++) 154 | { 155 | triangles[t++] = vTop - 1; 156 | triangles[t++] = vTop; 157 | triangles[t++] = vBottom; 158 | 159 | triangles[t++] = vBottom; 160 | triangles[t++] = vTop++; 161 | triangles[t++] = ++vBottom; 162 | } 163 | return t; 164 | } 165 | 166 | private static void Normalize(Vector3[] vertices, Vector3[] normals) 167 | { 168 | for (int i = 0; i < vertices.Length; i++) 169 | { 170 | normals[i] = vertices[i] = vertices[i].normalized; 171 | } 172 | } 173 | 174 | 175 | private static void CreateHeightArray(Vector3[] verts, double[] heightarray, ModuleBase baseModule) 176 | { 177 | for (int i = 0; i < verts.Length; i++) 178 | { 179 | heightarray[i] = baseModule.GetValue(verts[i]); 180 | } 181 | 182 | } 183 | 184 | private static void CreateUV(Vector3[] vertices, Vector2[] uv) 185 | { 186 | float previousX = 1f; 187 | for (int i = 0; i < vertices.Length; i++) 188 | { 189 | Vector3 v = vertices[i]; 190 | if (v.x == previousX) 191 | { 192 | uv[i - 1].x = 1f; 193 | } 194 | previousX = v.x; 195 | Vector2 textureCoordinates; 196 | textureCoordinates.x = Mathf.Atan2(v.x, v.z) / (-2f * Mathf.PI); 197 | if (textureCoordinates.x < 0f) 198 | { 199 | textureCoordinates.x += 1f; 200 | } 201 | textureCoordinates.y = Mathf.Asin(v.y) / Mathf.PI + 0.5f; 202 | uv[i] = textureCoordinates; 203 | } 204 | 205 | uv[vertices.Length - 4].x = uv[0].x = 0.125f; 206 | uv[vertices.Length - 3].x = uv[1].x = 0.375f; 207 | uv[vertices.Length - 2].x = uv[2].x = 0.625f; 208 | uv[vertices.Length - 1].x = uv[3].x = 0.875f; 209 | } 210 | 211 | private static void CreateTangents(Vector3[] vertices, Vector4[] tangents) 212 | { 213 | for (int i = 0; i < vertices.Length; i++) 214 | { 215 | Vector3 v = vertices[i]; 216 | v.y = 0f; 217 | v = v.normalized; 218 | Vector4 tangent; 219 | tangent.x = -v.z; 220 | tangent.y = 0f; 221 | tangent.z = v.x; 222 | tangent.w = -1f; 223 | tangents[i] = tangent; 224 | } 225 | 226 | tangents[vertices.Length - 4] = tangents[0] = new Vector3(-1f, 0, -1f).normalized; 227 | tangents[vertices.Length - 3] = tangents[1] = new Vector3(1f, 0f, -1f).normalized; 228 | tangents[vertices.Length - 2] = tangents[2] = new Vector3(1f, 0f, 1f).normalized; 229 | tangents[vertices.Length - 1] = tangents[3] = new Vector3(-1f, 0f, 1f).normalized; 230 | for (int i = 0; i < 4; i++) 231 | { 232 | tangents[vertices.Length - 1 - i].w = tangents[i].w = -1f; 233 | } 234 | } 235 | } -------------------------------------------------------------------------------- /Assets/better.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/better.png -------------------------------------------------------------------------------- /Assets/coolnoisecombo.npr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/coolnoisecombo.npr -------------------------------------------------------------------------------- /Assets/coool.npr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/coool.npr -------------------------------------------------------------------------------- /Assets/default.tpr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/default.tpr -------------------------------------------------------------------------------- /Assets/good planet.npr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/good planet.npr -------------------------------------------------------------------------------- /Assets/goodwithseedtackos.npr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/goodwithseedtackos.npr -------------------------------------------------------------------------------- /Assets/hideous.tpr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/hideous.tpr -------------------------------------------------------------------------------- /Assets/mapimage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/mapimage.png -------------------------------------------------------------------------------- /Assets/neat.npr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/neat.npr -------------------------------------------------------------------------------- /Assets/neat.tpr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/neat.tpr -------------------------------------------------------------------------------- /Assets/newMap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/newMap.png -------------------------------------------------------------------------------- /Assets/planet egg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/planet egg.png -------------------------------------------------------------------------------- /Assets/spherenoise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/spherenoise.png -------------------------------------------------------------------------------- /Assets/wat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/Assets/wat.png -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Richard Schmidt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.2d.sprite": "1.0.0", 4 | "com.unity.2d.tilemap": "1.0.0", 5 | "com.unity.ads": "3.7.5", 6 | "com.unity.analytics": "3.6.12", 7 | "com.unity.collab-proxy": "1.15.18", 8 | "com.unity.ide.rider": "3.0.15", 9 | "com.unity.ide.visualstudio": "2.0.16", 10 | "com.unity.ide.vscode": "1.2.5", 11 | "com.unity.purchasing": "4.1.5", 12 | "com.unity.test-framework": "1.1.31", 13 | "com.unity.textmeshpro": "3.0.6", 14 | "com.unity.timeline": "1.6.4", 15 | "com.unity.ugui": "1.0.0", 16 | "com.unity.xr.legacyinputhelpers": "2.1.9", 17 | "com.unity.modules.ai": "1.0.0", 18 | "com.unity.modules.androidjni": "1.0.0", 19 | "com.unity.modules.animation": "1.0.0", 20 | "com.unity.modules.assetbundle": "1.0.0", 21 | "com.unity.modules.audio": "1.0.0", 22 | "com.unity.modules.cloth": "1.0.0", 23 | "com.unity.modules.director": "1.0.0", 24 | "com.unity.modules.imageconversion": "1.0.0", 25 | "com.unity.modules.imgui": "1.0.0", 26 | "com.unity.modules.jsonserialize": "1.0.0", 27 | "com.unity.modules.particlesystem": "1.0.0", 28 | "com.unity.modules.physics": "1.0.0", 29 | "com.unity.modules.physics2d": "1.0.0", 30 | "com.unity.modules.screencapture": "1.0.0", 31 | "com.unity.modules.terrain": "1.0.0", 32 | "com.unity.modules.terrainphysics": "1.0.0", 33 | "com.unity.modules.tilemap": "1.0.0", 34 | "com.unity.modules.ui": "1.0.0", 35 | "com.unity.modules.uielements": "1.0.0", 36 | "com.unity.modules.umbra": "1.0.0", 37 | "com.unity.modules.unityanalytics": "1.0.0", 38 | "com.unity.modules.unitywebrequest": "1.0.0", 39 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 40 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 41 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 42 | "com.unity.modules.unitywebrequestwww": "1.0.0", 43 | "com.unity.modules.vehicles": "1.0.0", 44 | "com.unity.modules.video": "1.0.0", 45 | "com.unity.modules.vr": "1.0.0", 46 | "com.unity.modules.wind": "1.0.0", 47 | "com.unity.modules.xr": "1.0.0" 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Packages/packages-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.2d.sprite": { 4 | "version": "1.0.0", 5 | "depth": 0, 6 | "source": "builtin", 7 | "dependencies": {} 8 | }, 9 | "com.unity.2d.tilemap": { 10 | "version": "1.0.0", 11 | "depth": 0, 12 | "source": "builtin", 13 | "dependencies": {} 14 | }, 15 | "com.unity.ads": { 16 | "version": "3.7.5", 17 | "depth": 0, 18 | "source": "registry", 19 | "dependencies": { 20 | "com.unity.ugui": "1.0.0" 21 | }, 22 | "url": "https://packages.unity.com" 23 | }, 24 | "com.unity.analytics": { 25 | "version": "3.6.12", 26 | "depth": 0, 27 | "source": "registry", 28 | "dependencies": { 29 | "com.unity.ugui": "1.0.0" 30 | }, 31 | "url": "https://packages.unity.com" 32 | }, 33 | "com.unity.collab-proxy": { 34 | "version": "1.15.18", 35 | "depth": 0, 36 | "source": "registry", 37 | "dependencies": { 38 | "com.unity.services.core": "1.0.1" 39 | }, 40 | "url": "https://packages.unity.com" 41 | }, 42 | "com.unity.ext.nunit": { 43 | "version": "1.0.6", 44 | "depth": 1, 45 | "source": "registry", 46 | "dependencies": {}, 47 | "url": "https://packages.unity.com" 48 | }, 49 | "com.unity.ide.rider": { 50 | "version": "3.0.15", 51 | "depth": 0, 52 | "source": "registry", 53 | "dependencies": { 54 | "com.unity.ext.nunit": "1.0.6" 55 | }, 56 | "url": "https://packages.unity.com" 57 | }, 58 | "com.unity.ide.visualstudio": { 59 | "version": "2.0.16", 60 | "depth": 0, 61 | "source": "registry", 62 | "dependencies": { 63 | "com.unity.test-framework": "1.1.9" 64 | }, 65 | "url": "https://packages.unity.com" 66 | }, 67 | "com.unity.ide.vscode": { 68 | "version": "1.2.5", 69 | "depth": 0, 70 | "source": "registry", 71 | "dependencies": {}, 72 | "url": "https://packages.unity.com" 73 | }, 74 | "com.unity.nuget.newtonsoft-json": { 75 | "version": "3.0.2", 76 | "depth": 2, 77 | "source": "registry", 78 | "dependencies": {}, 79 | "url": "https://packages.unity.com" 80 | }, 81 | "com.unity.purchasing": { 82 | "version": "4.1.5", 83 | "depth": 0, 84 | "source": "registry", 85 | "dependencies": { 86 | "com.unity.ugui": "1.0.0", 87 | "com.unity.modules.unityanalytics": "1.0.0", 88 | "com.unity.modules.unitywebrequest": "1.0.0", 89 | "com.unity.modules.jsonserialize": "1.0.0", 90 | "com.unity.modules.androidjni": "1.0.0", 91 | "com.unity.services.core": "1.0.1" 92 | }, 93 | "url": "https://packages.unity.com" 94 | }, 95 | "com.unity.services.core": { 96 | "version": "1.4.0", 97 | "depth": 1, 98 | "source": "registry", 99 | "dependencies": { 100 | "com.unity.modules.unitywebrequest": "1.0.0", 101 | "com.unity.nuget.newtonsoft-json": "3.0.2", 102 | "com.unity.modules.androidjni": "1.0.0" 103 | }, 104 | "url": "https://packages.unity.com" 105 | }, 106 | "com.unity.test-framework": { 107 | "version": "1.1.31", 108 | "depth": 0, 109 | "source": "registry", 110 | "dependencies": { 111 | "com.unity.ext.nunit": "1.0.6", 112 | "com.unity.modules.imgui": "1.0.0", 113 | "com.unity.modules.jsonserialize": "1.0.0" 114 | }, 115 | "url": "https://packages.unity.com" 116 | }, 117 | "com.unity.textmeshpro": { 118 | "version": "3.0.6", 119 | "depth": 0, 120 | "source": "registry", 121 | "dependencies": { 122 | "com.unity.ugui": "1.0.0" 123 | }, 124 | "url": "https://packages.unity.com" 125 | }, 126 | "com.unity.timeline": { 127 | "version": "1.6.4", 128 | "depth": 0, 129 | "source": "registry", 130 | "dependencies": { 131 | "com.unity.modules.director": "1.0.0", 132 | "com.unity.modules.animation": "1.0.0", 133 | "com.unity.modules.audio": "1.0.0", 134 | "com.unity.modules.particlesystem": "1.0.0" 135 | }, 136 | "url": "https://packages.unity.com" 137 | }, 138 | "com.unity.ugui": { 139 | "version": "1.0.0", 140 | "depth": 0, 141 | "source": "builtin", 142 | "dependencies": { 143 | "com.unity.modules.ui": "1.0.0", 144 | "com.unity.modules.imgui": "1.0.0" 145 | } 146 | }, 147 | "com.unity.xr.legacyinputhelpers": { 148 | "version": "2.1.9", 149 | "depth": 0, 150 | "source": "registry", 151 | "dependencies": { 152 | "com.unity.modules.vr": "1.0.0", 153 | "com.unity.modules.xr": "1.0.0" 154 | }, 155 | "url": "https://packages.unity.com" 156 | }, 157 | "com.unity.modules.ai": { 158 | "version": "1.0.0", 159 | "depth": 0, 160 | "source": "builtin", 161 | "dependencies": {} 162 | }, 163 | "com.unity.modules.androidjni": { 164 | "version": "1.0.0", 165 | "depth": 0, 166 | "source": "builtin", 167 | "dependencies": {} 168 | }, 169 | "com.unity.modules.animation": { 170 | "version": "1.0.0", 171 | "depth": 0, 172 | "source": "builtin", 173 | "dependencies": {} 174 | }, 175 | "com.unity.modules.assetbundle": { 176 | "version": "1.0.0", 177 | "depth": 0, 178 | "source": "builtin", 179 | "dependencies": {} 180 | }, 181 | "com.unity.modules.audio": { 182 | "version": "1.0.0", 183 | "depth": 0, 184 | "source": "builtin", 185 | "dependencies": {} 186 | }, 187 | "com.unity.modules.cloth": { 188 | "version": "1.0.0", 189 | "depth": 0, 190 | "source": "builtin", 191 | "dependencies": { 192 | "com.unity.modules.physics": "1.0.0" 193 | } 194 | }, 195 | "com.unity.modules.director": { 196 | "version": "1.0.0", 197 | "depth": 0, 198 | "source": "builtin", 199 | "dependencies": { 200 | "com.unity.modules.audio": "1.0.0", 201 | "com.unity.modules.animation": "1.0.0" 202 | } 203 | }, 204 | "com.unity.modules.imageconversion": { 205 | "version": "1.0.0", 206 | "depth": 0, 207 | "source": "builtin", 208 | "dependencies": {} 209 | }, 210 | "com.unity.modules.imgui": { 211 | "version": "1.0.0", 212 | "depth": 0, 213 | "source": "builtin", 214 | "dependencies": {} 215 | }, 216 | "com.unity.modules.jsonserialize": { 217 | "version": "1.0.0", 218 | "depth": 0, 219 | "source": "builtin", 220 | "dependencies": {} 221 | }, 222 | "com.unity.modules.particlesystem": { 223 | "version": "1.0.0", 224 | "depth": 0, 225 | "source": "builtin", 226 | "dependencies": {} 227 | }, 228 | "com.unity.modules.physics": { 229 | "version": "1.0.0", 230 | "depth": 0, 231 | "source": "builtin", 232 | "dependencies": {} 233 | }, 234 | "com.unity.modules.physics2d": { 235 | "version": "1.0.0", 236 | "depth": 0, 237 | "source": "builtin", 238 | "dependencies": {} 239 | }, 240 | "com.unity.modules.screencapture": { 241 | "version": "1.0.0", 242 | "depth": 0, 243 | "source": "builtin", 244 | "dependencies": { 245 | "com.unity.modules.imageconversion": "1.0.0" 246 | } 247 | }, 248 | "com.unity.modules.subsystems": { 249 | "version": "1.0.0", 250 | "depth": 1, 251 | "source": "builtin", 252 | "dependencies": { 253 | "com.unity.modules.jsonserialize": "1.0.0" 254 | } 255 | }, 256 | "com.unity.modules.terrain": { 257 | "version": "1.0.0", 258 | "depth": 0, 259 | "source": "builtin", 260 | "dependencies": {} 261 | }, 262 | "com.unity.modules.terrainphysics": { 263 | "version": "1.0.0", 264 | "depth": 0, 265 | "source": "builtin", 266 | "dependencies": { 267 | "com.unity.modules.physics": "1.0.0", 268 | "com.unity.modules.terrain": "1.0.0" 269 | } 270 | }, 271 | "com.unity.modules.tilemap": { 272 | "version": "1.0.0", 273 | "depth": 0, 274 | "source": "builtin", 275 | "dependencies": { 276 | "com.unity.modules.physics2d": "1.0.0" 277 | } 278 | }, 279 | "com.unity.modules.ui": { 280 | "version": "1.0.0", 281 | "depth": 0, 282 | "source": "builtin", 283 | "dependencies": {} 284 | }, 285 | "com.unity.modules.uielements": { 286 | "version": "1.0.0", 287 | "depth": 0, 288 | "source": "builtin", 289 | "dependencies": { 290 | "com.unity.modules.ui": "1.0.0", 291 | "com.unity.modules.imgui": "1.0.0", 292 | "com.unity.modules.jsonserialize": "1.0.0", 293 | "com.unity.modules.uielementsnative": "1.0.0" 294 | } 295 | }, 296 | "com.unity.modules.uielementsnative": { 297 | "version": "1.0.0", 298 | "depth": 1, 299 | "source": "builtin", 300 | "dependencies": { 301 | "com.unity.modules.ui": "1.0.0", 302 | "com.unity.modules.imgui": "1.0.0", 303 | "com.unity.modules.jsonserialize": "1.0.0" 304 | } 305 | }, 306 | "com.unity.modules.umbra": { 307 | "version": "1.0.0", 308 | "depth": 0, 309 | "source": "builtin", 310 | "dependencies": {} 311 | }, 312 | "com.unity.modules.unityanalytics": { 313 | "version": "1.0.0", 314 | "depth": 0, 315 | "source": "builtin", 316 | "dependencies": { 317 | "com.unity.modules.unitywebrequest": "1.0.0", 318 | "com.unity.modules.jsonserialize": "1.0.0" 319 | } 320 | }, 321 | "com.unity.modules.unitywebrequest": { 322 | "version": "1.0.0", 323 | "depth": 0, 324 | "source": "builtin", 325 | "dependencies": {} 326 | }, 327 | "com.unity.modules.unitywebrequestassetbundle": { 328 | "version": "1.0.0", 329 | "depth": 0, 330 | "source": "builtin", 331 | "dependencies": { 332 | "com.unity.modules.assetbundle": "1.0.0", 333 | "com.unity.modules.unitywebrequest": "1.0.0" 334 | } 335 | }, 336 | "com.unity.modules.unitywebrequestaudio": { 337 | "version": "1.0.0", 338 | "depth": 0, 339 | "source": "builtin", 340 | "dependencies": { 341 | "com.unity.modules.unitywebrequest": "1.0.0", 342 | "com.unity.modules.audio": "1.0.0" 343 | } 344 | }, 345 | "com.unity.modules.unitywebrequesttexture": { 346 | "version": "1.0.0", 347 | "depth": 0, 348 | "source": "builtin", 349 | "dependencies": { 350 | "com.unity.modules.unitywebrequest": "1.0.0", 351 | "com.unity.modules.imageconversion": "1.0.0" 352 | } 353 | }, 354 | "com.unity.modules.unitywebrequestwww": { 355 | "version": "1.0.0", 356 | "depth": 0, 357 | "source": "builtin", 358 | "dependencies": { 359 | "com.unity.modules.unitywebrequest": "1.0.0", 360 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 361 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 362 | "com.unity.modules.audio": "1.0.0", 363 | "com.unity.modules.assetbundle": "1.0.0", 364 | "com.unity.modules.imageconversion": "1.0.0" 365 | } 366 | }, 367 | "com.unity.modules.vehicles": { 368 | "version": "1.0.0", 369 | "depth": 0, 370 | "source": "builtin", 371 | "dependencies": { 372 | "com.unity.modules.physics": "1.0.0" 373 | } 374 | }, 375 | "com.unity.modules.video": { 376 | "version": "1.0.0", 377 | "depth": 0, 378 | "source": "builtin", 379 | "dependencies": { 380 | "com.unity.modules.audio": "1.0.0", 381 | "com.unity.modules.ui": "1.0.0", 382 | "com.unity.modules.unitywebrequest": "1.0.0" 383 | } 384 | }, 385 | "com.unity.modules.vr": { 386 | "version": "1.0.0", 387 | "depth": 0, 388 | "source": "builtin", 389 | "dependencies": { 390 | "com.unity.modules.jsonserialize": "1.0.0", 391 | "com.unity.modules.physics": "1.0.0", 392 | "com.unity.modules.xr": "1.0.0" 393 | } 394 | }, 395 | "com.unity.modules.wind": { 396 | "version": "1.0.0", 397 | "depth": 0, 398 | "source": "builtin", 399 | "dependencies": {} 400 | }, 401 | "com.unity.modules.xr": { 402 | "version": "1.0.0", 403 | "depth": 0, 404 | "source": "builtin", 405 | "dependencies": { 406 | "com.unity.modules.physics": "1.0.0", 407 | "com.unity.modules.jsonserialize": "1.0.0", 408 | "com.unity.modules.subsystems": "1.0.0" 409 | } 410 | } 411 | } 412 | } 413 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/AudioManager.asset -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/ClusterInputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/DynamicsManager.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/EditorBuildSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/EditorSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/GraphicsSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/InputManager.asset -------------------------------------------------------------------------------- /ProjectSettings/MemorySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!387306366 &1 4 | MemorySettings: 5 | m_ObjectHideFlags: 0 6 | m_EditorMemorySettings: 7 | m_MainAllocatorBlockSize: -1 8 | m_ThreadAllocatorBlockSize: -1 9 | m_MainGfxBlockSize: -1 10 | m_ThreadGfxBlockSize: -1 11 | m_CacheBlockSize: -1 12 | m_TypetreeBlockSize: -1 13 | m_ProfilerBlockSize: -1 14 | m_ProfilerEditorBlockSize: -1 15 | m_BucketAllocatorGranularity: -1 16 | m_BucketAllocatorBucketsCount: -1 17 | m_BucketAllocatorBlockSize: -1 18 | m_BucketAllocatorBlockCount: -1 19 | m_ProfilerBucketAllocatorGranularity: -1 20 | m_ProfilerBucketAllocatorBucketsCount: -1 21 | m_ProfilerBucketAllocatorBlockSize: -1 22 | m_ProfilerBucketAllocatorBlockCount: -1 23 | m_TempAllocatorSizeMain: -1 24 | m_JobTempAllocatorBlockSize: -1 25 | m_BackgroundJobTempAllocatorBlockSize: -1 26 | m_JobTempAllocatorReducedBlockSize: -1 27 | m_TempAllocatorSizeGIBakingWorker: -1 28 | m_TempAllocatorSizeNavMeshWorker: -1 29 | m_TempAllocatorSizeAudioWorker: -1 30 | m_TempAllocatorSizeCloudWorker: -1 31 | m_TempAllocatorSizeGfx: -1 32 | m_TempAllocatorSizeJobWorker: -1 33 | m_TempAllocatorSizeBackgroundWorker: -1 34 | m_TempAllocatorSizePreloadManager: -1 35 | m_PlatformMemorySettings: {} 36 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/NavMeshAreas.asset -------------------------------------------------------------------------------- /ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/NetworkManager.asset -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreReleasePackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | m_SeeAllPackageVersions: 0 20 | oneTimeWarningShown: 0 21 | m_Registries: 22 | - m_Id: main 23 | m_Name: 24 | m_Url: https://packages.unity.com 25 | m_Scopes: [] 26 | m_IsDefault: 1 27 | m_Capabilities: 7 28 | m_UserSelectedRegistryName: 29 | m_UserAddingNewScopedRegistry: 0 30 | m_RegistryInfoDraft: 31 | m_Modified: 0 32 | m_ErrorMessage: 33 | m_UserModificationsInstanceId: -856 34 | m_OriginalInstanceId: -858 35 | m_LoadAssets: 0 36 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/Physics2DSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_DefaultPresets: {} 8 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/ProjectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2021.3.6f1 2 | m_EditorVersionWithRevision: 2021.3.6f1 (7da38d85baf6) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/QualitySettings.asset -------------------------------------------------------------------------------- /ProjectSettings/SceneTemplateSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "templatePinStates": [], 3 | "dependencyTypeInfos": [ 4 | { 5 | "userAdded": false, 6 | "type": "UnityEngine.AnimationClip", 7 | "ignore": false, 8 | "defaultInstantiationMode": 0, 9 | "supportsModification": true 10 | }, 11 | { 12 | "userAdded": false, 13 | "type": "UnityEditor.Animations.AnimatorController", 14 | "ignore": false, 15 | "defaultInstantiationMode": 0, 16 | "supportsModification": true 17 | }, 18 | { 19 | "userAdded": false, 20 | "type": "UnityEngine.AnimatorOverrideController", 21 | "ignore": false, 22 | "defaultInstantiationMode": 0, 23 | "supportsModification": true 24 | }, 25 | { 26 | "userAdded": false, 27 | "type": "UnityEditor.Audio.AudioMixerController", 28 | "ignore": false, 29 | "defaultInstantiationMode": 0, 30 | "supportsModification": true 31 | }, 32 | { 33 | "userAdded": false, 34 | "type": "UnityEngine.ComputeShader", 35 | "ignore": true, 36 | "defaultInstantiationMode": 1, 37 | "supportsModification": true 38 | }, 39 | { 40 | "userAdded": false, 41 | "type": "UnityEngine.Cubemap", 42 | "ignore": false, 43 | "defaultInstantiationMode": 0, 44 | "supportsModification": true 45 | }, 46 | { 47 | "userAdded": false, 48 | "type": "UnityEngine.GameObject", 49 | "ignore": false, 50 | "defaultInstantiationMode": 0, 51 | "supportsModification": true 52 | }, 53 | { 54 | "userAdded": false, 55 | "type": "UnityEditor.LightingDataAsset", 56 | "ignore": false, 57 | "defaultInstantiationMode": 0, 58 | "supportsModification": false 59 | }, 60 | { 61 | "userAdded": false, 62 | "type": "UnityEngine.LightingSettings", 63 | "ignore": false, 64 | "defaultInstantiationMode": 0, 65 | "supportsModification": true 66 | }, 67 | { 68 | "userAdded": false, 69 | "type": "UnityEngine.Material", 70 | "ignore": false, 71 | "defaultInstantiationMode": 0, 72 | "supportsModification": true 73 | }, 74 | { 75 | "userAdded": false, 76 | "type": "UnityEditor.MonoScript", 77 | "ignore": true, 78 | "defaultInstantiationMode": 1, 79 | "supportsModification": true 80 | }, 81 | { 82 | "userAdded": false, 83 | "type": "UnityEngine.PhysicMaterial", 84 | "ignore": false, 85 | "defaultInstantiationMode": 0, 86 | "supportsModification": true 87 | }, 88 | { 89 | "userAdded": false, 90 | "type": "UnityEngine.PhysicsMaterial2D", 91 | "ignore": false, 92 | "defaultInstantiationMode": 0, 93 | "supportsModification": true 94 | }, 95 | { 96 | "userAdded": false, 97 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessProfile", 98 | "ignore": false, 99 | "defaultInstantiationMode": 0, 100 | "supportsModification": true 101 | }, 102 | { 103 | "userAdded": false, 104 | "type": "UnityEngine.Rendering.PostProcessing.PostProcessResources", 105 | "ignore": false, 106 | "defaultInstantiationMode": 0, 107 | "supportsModification": true 108 | }, 109 | { 110 | "userAdded": false, 111 | "type": "UnityEngine.Rendering.VolumeProfile", 112 | "ignore": false, 113 | "defaultInstantiationMode": 0, 114 | "supportsModification": true 115 | }, 116 | { 117 | "userAdded": false, 118 | "type": "UnityEditor.SceneAsset", 119 | "ignore": false, 120 | "defaultInstantiationMode": 0, 121 | "supportsModification": false 122 | }, 123 | { 124 | "userAdded": false, 125 | "type": "UnityEngine.Shader", 126 | "ignore": true, 127 | "defaultInstantiationMode": 1, 128 | "supportsModification": true 129 | }, 130 | { 131 | "userAdded": false, 132 | "type": "UnityEngine.ShaderVariantCollection", 133 | "ignore": true, 134 | "defaultInstantiationMode": 1, 135 | "supportsModification": true 136 | }, 137 | { 138 | "userAdded": false, 139 | "type": "UnityEngine.Texture", 140 | "ignore": false, 141 | "defaultInstantiationMode": 0, 142 | "supportsModification": true 143 | }, 144 | { 145 | "userAdded": false, 146 | "type": "UnityEngine.Texture2D", 147 | "ignore": false, 148 | "defaultInstantiationMode": 0, 149 | "supportsModification": true 150 | }, 151 | { 152 | "userAdded": false, 153 | "type": "UnityEngine.Timeline.TimelineAsset", 154 | "ignore": false, 155 | "defaultInstantiationMode": 0, 156 | "supportsModification": true 157 | } 158 | ], 159 | "defaultDependencyTypeInfo": { 160 | "userAdded": false, 161 | "type": "", 162 | "ignore": false, 163 | "defaultInstantiationMode": 1, 164 | "supportsModification": true 165 | }, 166 | "newSceneOverride": 0 167 | } -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/TagManager.asset -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/TimeManager.asset -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/UnityConnectSettings.asset -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_StripUpdateShader: {fileID: 0} 10 | m_RenderPipeSettingsPath: 11 | m_FixedTimeStep: 0.016666668 12 | m_MaxDeltaTime: 0.05 13 | m_CompiledVersion: 0 14 | m_RuntimeVersion: 0 15 | m_RuntimeResources: {fileID: 0} 16 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/boot.config: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RichardGSchmidt/GroundGrowing/43cbb2c3780ca2dc6178c63a7741e82db90a0b44/ProjectSettings/boot.config -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GroundGrowing 2 | **An Open Source Unity3d Planetary Terrain Generator and Editor Extension** 3 | 4 | This project is built as an extension to the editor, it is meant as a build tool for designers looking to generate content rapidly on the fly. The generation functions can also be exported and called inside other applications. It is multithreaded in both the inspector and during runtime so it can update and generate without slowing down either the player's or the designer's user experience. It updates in incrementally increasing resolutions start with low res in order to provide modes rapidly to the user while higher resolution models are processed in the background. 5 | 6 | **Video Demonstration (out of date):** 7 | 8 | [![An Example Planet](https://i.imgur.com/8zgkg4y.png?2)](http://www.youtube.com/watch?v=trL7Wph3noE)] 9 | 10 | 11 | 12 | 13 | **To Start** 14 | 1. Open the NoiseGenerator scene inside the assets/scripts folder. 15 | 2. Double-Click the planet in the scene hierachy to center your view on the planet object. Adjust your view as desired. 16 | 3. Click the MapGenerator object in the scene hierarcy. The controls will be located in the inspector window under the MapGenerator script. 17 | 4. The noise stack's behavior can be modified in the **Noise Stack** dropdown in the editor. Coloring based on height maps is under the **Regions** dropdown in the editor. 18 | 5. The generator will reprocess every time you change the noise stack or hit the generate button automatically. 19 | 20 | **Noise Stack** 21 | * The noise stack is made of noise functions that can be either added or subtracted from each other in order to blend them. 22 | * Supported noise types are: Perlin, Billow, Ridged Multifractal, and Voronoi. I recommend experimenting with all of them independently before you start blending, so you have some idea of what they look like. 23 | * You can load or save presets to file for later use. 24 | 25 | **Regions** 26 | * Height relative to the approximate floor value and ceiling values is used to determine the map color at a given location. 27 | * Presets can be loaded or saved to file. 28 | 29 | 30 | You can export the mesh's and the textures manually. 31 | 32 | Currently updated to version 2021.3.6f1 of Unity3d. 33 | 34 | Enjoy. 35 | 36 | 37 | Feel free to ask me any questions if you have them. 38 | I'm easiest to reach via email: [Richard.G.Schmidt.Jr@gmail.com]. If you do happen to 39 | use this in a project, please let me know and credit me. 40 | 41 | Thanks and have fun! 42 | -Richard 43 | -------------------------------------------------------------------------------- /UserSettings/EditorUserSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!162 &1 4 | EditorUserSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_ConfigSettings: 8 | RecentlyUsedSceneGuid-0: 9 | value: 5708075601050f5908085a7341760e4414154c7a292d25657f2b4a6bbbb26460 10 | flags: 0 11 | vcSharedLogLevel: 12 | value: 0d5e400f0650 13 | flags: 0 14 | m_VCAutomaticAdd: 1 15 | m_VCDebugCom: 0 16 | m_VCDebugCmd: 0 17 | m_VCDebugOut: 0 18 | m_SemanticMergeMode: 2 19 | m_DesiredImportWorkerCount: 2 20 | m_StandbyImportWorkerCount: 2 21 | m_IdleImportWorkerShutdownDelay: 60000 22 | m_VCShowFailedCheckout: 1 23 | m_VCOverwriteFailedCheckoutAssets: 1 24 | m_VCProjectOverlayIcons: 1 25 | m_VCHierarchyOverlayIcons: 1 26 | m_VCOtherOverlayIcons: 1 27 | m_VCAllowAsyncUpdate: 1 28 | m_ArtifactGarbageCollection: 1 29 | --------------------------------------------------------------------------------