├── Assets ├── Chunk.prefab ├── Chunk.prefab.meta ├── Scenes.meta ├── Scenes │ ├── SampleScene.unity │ └── SampleScene.unity.meta ├── SimpleCameraController.cs ├── SimpleCameraController.cs.meta ├── Terrain Generation.meta └── Terrain Generation │ ├── TerrainDeformer.cs │ ├── TerrainDeformer.cs.meta │ ├── Utils.meta │ ├── Utils │ ├── ChunkData.cs │ ├── ChunkData.cs.meta │ ├── Counter.cs │ ├── Counter.cs.meta │ ├── InfiniteWorld.cs │ ├── InfiniteWorld.cs.meta │ ├── VertexList.cs │ ├── VertexList.cs.meta │ ├── VoxelCorners.cs │ ├── VoxelCorners.cs.meta │ ├── WorldBase.cs │ └── WorldBase.cs.meta │ ├── WorldMat.mat │ └── WorldMat.mat.meta ├── LICENSE ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── UnityConnectSettings.asset ├── VFXManager.asset └── XRSettings.asset └── README.md /Assets/Chunk.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5333817436453212684 4 | GameObject: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | serializedVersion: 6 10 | m_Component: 11 | - component: {fileID: 526268385163062065} 12 | - component: {fileID: 4359368787637040929} 13 | - component: {fileID: 3049516052090538217} 14 | - component: {fileID: 9024246742337314528} 15 | - component: {fileID: 4062369563302791805} 16 | m_Layer: 0 17 | m_Name: Chunk 18 | m_TagString: Untagged 19 | m_Icon: {fileID: 0} 20 | m_NavMeshLayer: 0 21 | m_StaticEditorFlags: 0 22 | m_IsActive: 1 23 | --- !u!4 &526268385163062065 24 | Transform: 25 | m_ObjectHideFlags: 0 26 | m_CorrespondingSourceObject: {fileID: 0} 27 | m_PrefabInstance: {fileID: 0} 28 | m_PrefabAsset: {fileID: 0} 29 | m_GameObject: {fileID: 5333817436453212684} 30 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 31 | m_LocalPosition: {x: 0, y: 0, z: 0} 32 | m_LocalScale: {x: 1, y: 1, z: 1} 33 | m_Children: [] 34 | m_Father: {fileID: 0} 35 | m_RootOrder: 0 36 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 37 | --- !u!33 &4359368787637040929 38 | MeshFilter: 39 | m_ObjectHideFlags: 0 40 | m_CorrespondingSourceObject: {fileID: 0} 41 | m_PrefabInstance: {fileID: 0} 42 | m_PrefabAsset: {fileID: 0} 43 | m_GameObject: {fileID: 5333817436453212684} 44 | m_Mesh: {fileID: 0} 45 | --- !u!23 &3049516052090538217 46 | MeshRenderer: 47 | m_ObjectHideFlags: 0 48 | m_CorrespondingSourceObject: {fileID: 0} 49 | m_PrefabInstance: {fileID: 0} 50 | m_PrefabAsset: {fileID: 0} 51 | m_GameObject: {fileID: 5333817436453212684} 52 | m_Enabled: 1 53 | m_CastShadows: 1 54 | m_ReceiveShadows: 1 55 | m_DynamicOccludee: 1 56 | m_MotionVectors: 1 57 | m_LightProbeUsage: 1 58 | m_ReflectionProbeUsage: 1 59 | m_RayTracingMode: 2 60 | m_RenderingLayerMask: 1 61 | m_RendererPriority: 0 62 | m_Materials: 63 | - {fileID: 2100000, guid: 27178c7fa1d86eb41b535327d6674cf6, type: 2} 64 | m_StaticBatchInfo: 65 | firstSubMesh: 0 66 | subMeshCount: 0 67 | m_StaticBatchRoot: {fileID: 0} 68 | m_ProbeAnchor: {fileID: 0} 69 | m_LightProbeVolumeOverride: {fileID: 0} 70 | m_ScaleInLightmap: 1 71 | m_ReceiveGI: 1 72 | m_PreserveUVs: 0 73 | m_IgnoreNormalsForChartDetection: 0 74 | m_ImportantGI: 0 75 | m_StitchLightmapSeams: 1 76 | m_SelectedEditorRenderState: 3 77 | m_MinimumChartSize: 4 78 | m_AutoUVMaxDistance: 0.5 79 | m_AutoUVMaxAngle: 89 80 | m_LightmapParameters: {fileID: 0} 81 | m_SortingLayerID: 0 82 | m_SortingLayer: 0 83 | m_SortingOrder: 0 84 | --- !u!64 &9024246742337314528 85 | MeshCollider: 86 | m_ObjectHideFlags: 0 87 | m_CorrespondingSourceObject: {fileID: 0} 88 | m_PrefabInstance: {fileID: 0} 89 | m_PrefabAsset: {fileID: 0} 90 | m_GameObject: {fileID: 5333817436453212684} 91 | m_Material: {fileID: 0} 92 | m_IsTrigger: 0 93 | m_Enabled: 1 94 | serializedVersion: 4 95 | m_Convex: 0 96 | m_CookingOptions: 30 97 | m_Mesh: {fileID: 0} 98 | --- !u!114 &4062369563302791805 99 | MonoBehaviour: 100 | m_ObjectHideFlags: 0 101 | m_CorrespondingSourceObject: {fileID: 0} 102 | m_PrefabInstance: {fileID: 0} 103 | m_PrefabAsset: {fileID: 0} 104 | m_GameObject: {fileID: 5333817436453212684} 105 | m_Enabled: 1 106 | m_EditorHideFlags: 0 107 | m_Script: {fileID: 11500000, guid: 3a04036cd9b3c8040a66b20b56f6b26f, type: 3} 108 | m_Name: 109 | m_EditorClassIdentifier: 110 | size: 25 111 | -------------------------------------------------------------------------------- /Assets/Chunk.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9e9d80ee6f36225499b17ac62f21d0b5 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f56fca310cb224a428cc195c5d3dd6f8 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 705507994} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 12 58 | m_Resolution: 2 59 | m_BakeResolution: 40 60 | m_AtlasSize: 1024 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_ExtractAmbientOcclusion: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 500 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 2 83 | m_PVRDenoiserTypeDirect: 0 84 | m_PVRDenoiserTypeIndirect: 0 85 | m_PVRDenoiserTypeAO: 0 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 0 90 | m_PVRCulling: 1 91 | m_PVRFilteringGaussRadiusDirect: 1 92 | m_PVRFilteringGaussRadiusIndirect: 5 93 | m_PVRFilteringGaussRadiusAO: 2 94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 96 | m_PVRFilteringAtrousPositionSigmaAO: 1 97 | m_ExportTrainingData: 0 98 | m_TrainingDataDestination: TrainingData 99 | m_LightProbeSampleCountMultiplier: 4 100 | m_LightingDataAsset: {fileID: 0} 101 | m_UseShadowmask: 1 102 | --- !u!196 &4 103 | NavMeshSettings: 104 | serializedVersion: 2 105 | m_ObjectHideFlags: 0 106 | m_BuildSettings: 107 | serializedVersion: 2 108 | agentTypeID: 0 109 | agentRadius: 0.5 110 | agentHeight: 2 111 | agentSlope: 45 112 | agentClimb: 0.4 113 | ledgeDropHeight: 0 114 | maxJumpAcrossDistance: 0 115 | minRegionArea: 2 116 | manualCellSize: 0 117 | cellSize: 0.16666667 118 | manualTileSize: 0 119 | tileSize: 256 120 | accuratePlacement: 0 121 | debug: 122 | m_Flags: 0 123 | m_NavMeshData: {fileID: 0} 124 | --- !u!1 &705507993 125 | GameObject: 126 | m_ObjectHideFlags: 0 127 | m_CorrespondingSourceObject: {fileID: 0} 128 | m_PrefabInstance: {fileID: 0} 129 | m_PrefabAsset: {fileID: 0} 130 | serializedVersion: 6 131 | m_Component: 132 | - component: {fileID: 705507995} 133 | - component: {fileID: 705507994} 134 | m_Layer: 0 135 | m_Name: Directional Light 136 | m_TagString: Untagged 137 | m_Icon: {fileID: 0} 138 | m_NavMeshLayer: 0 139 | m_StaticEditorFlags: 0 140 | m_IsActive: 1 141 | --- !u!108 &705507994 142 | Light: 143 | m_ObjectHideFlags: 0 144 | m_CorrespondingSourceObject: {fileID: 0} 145 | m_PrefabInstance: {fileID: 0} 146 | m_PrefabAsset: {fileID: 0} 147 | m_GameObject: {fileID: 705507993} 148 | m_Enabled: 1 149 | serializedVersion: 10 150 | m_Type: 1 151 | m_Shape: 0 152 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 153 | m_Intensity: 1 154 | m_Range: 10 155 | m_SpotAngle: 30 156 | m_InnerSpotAngle: 21.80208 157 | m_CookieSize: 10 158 | m_Shadows: 159 | m_Type: 2 160 | m_Resolution: -1 161 | m_CustomResolution: -1 162 | m_Strength: 1 163 | m_Bias: 0.05 164 | m_NormalBias: 0.4 165 | m_NearPlane: 0.2 166 | m_CullingMatrixOverride: 167 | e00: 1 168 | e01: 0 169 | e02: 0 170 | e03: 0 171 | e10: 0 172 | e11: 1 173 | e12: 0 174 | e13: 0 175 | e20: 0 176 | e21: 0 177 | e22: 1 178 | e23: 0 179 | e30: 0 180 | e31: 0 181 | e32: 0 182 | e33: 1 183 | m_UseCullingMatrixOverride: 0 184 | m_Cookie: {fileID: 0} 185 | m_DrawHalo: 0 186 | m_Flare: {fileID: 0} 187 | m_RenderMode: 0 188 | m_CullingMask: 189 | serializedVersion: 2 190 | m_Bits: 4294967295 191 | m_RenderingLayerMask: 1 192 | m_Lightmapping: 1 193 | m_LightShadowCasterMode: 0 194 | m_AreaSize: {x: 1, y: 1} 195 | m_BounceIntensity: 1 196 | m_ColorTemperature: 6570 197 | m_UseColorTemperature: 0 198 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 199 | m_UseBoundingSphereOverride: 0 200 | m_ShadowRadius: 0 201 | m_ShadowAngle: 0 202 | --- !u!4 &705507995 203 | Transform: 204 | m_ObjectHideFlags: 0 205 | m_CorrespondingSourceObject: {fileID: 0} 206 | m_PrefabInstance: {fileID: 0} 207 | m_PrefabAsset: {fileID: 0} 208 | m_GameObject: {fileID: 705507993} 209 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 210 | m_LocalPosition: {x: 0, y: 3, z: 0} 211 | m_LocalScale: {x: 1, y: 1, z: 1} 212 | m_Children: [] 213 | m_Father: {fileID: 0} 214 | m_RootOrder: 1 215 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 216 | --- !u!1 &963194225 217 | GameObject: 218 | m_ObjectHideFlags: 0 219 | m_CorrespondingSourceObject: {fileID: 0} 220 | m_PrefabInstance: {fileID: 0} 221 | m_PrefabAsset: {fileID: 0} 222 | serializedVersion: 6 223 | m_Component: 224 | - component: {fileID: 963194228} 225 | - component: {fileID: 963194227} 226 | - component: {fileID: 963194226} 227 | - component: {fileID: 963194230} 228 | - component: {fileID: 963194229} 229 | m_Layer: 0 230 | m_Name: Main Camera 231 | m_TagString: MainCamera 232 | m_Icon: {fileID: 0} 233 | m_NavMeshLayer: 0 234 | m_StaticEditorFlags: 0 235 | m_IsActive: 1 236 | --- !u!81 &963194226 237 | AudioListener: 238 | m_ObjectHideFlags: 0 239 | m_CorrespondingSourceObject: {fileID: 0} 240 | m_PrefabInstance: {fileID: 0} 241 | m_PrefabAsset: {fileID: 0} 242 | m_GameObject: {fileID: 963194225} 243 | m_Enabled: 1 244 | --- !u!20 &963194227 245 | Camera: 246 | m_ObjectHideFlags: 0 247 | m_CorrespondingSourceObject: {fileID: 0} 248 | m_PrefabInstance: {fileID: 0} 249 | m_PrefabAsset: {fileID: 0} 250 | m_GameObject: {fileID: 963194225} 251 | m_Enabled: 1 252 | serializedVersion: 2 253 | m_ClearFlags: 1 254 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 255 | m_projectionMatrixMode: 1 256 | m_GateFitMode: 2 257 | m_FOVAxisMode: 0 258 | m_SensorSize: {x: 36, y: 24} 259 | m_LensShift: {x: 0, y: 0} 260 | m_FocalLength: 50 261 | m_NormalizedViewPortRect: 262 | serializedVersion: 2 263 | x: 0 264 | y: 0 265 | width: 1 266 | height: 1 267 | near clip plane: 0.3 268 | far clip plane: 1000 269 | field of view: 60 270 | orthographic: 0 271 | orthographic size: 5 272 | m_Depth: -1 273 | m_CullingMask: 274 | serializedVersion: 2 275 | m_Bits: 4294967295 276 | m_RenderingPath: -1 277 | m_TargetTexture: {fileID: 0} 278 | m_TargetDisplay: 0 279 | m_TargetEye: 3 280 | m_HDR: 1 281 | m_AllowMSAA: 1 282 | m_AllowDynamicResolution: 0 283 | m_ForceIntoRT: 0 284 | m_OcclusionCulling: 1 285 | m_StereoConvergence: 10 286 | m_StereoSeparation: 0.022 287 | --- !u!4 &963194228 288 | Transform: 289 | m_ObjectHideFlags: 0 290 | m_CorrespondingSourceObject: {fileID: 0} 291 | m_PrefabInstance: {fileID: 0} 292 | m_PrefabAsset: {fileID: 0} 293 | m_GameObject: {fileID: 963194225} 294 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 295 | m_LocalPosition: {x: 0, y: 60, z: -10} 296 | m_LocalScale: {x: 1, y: 1, z: 1} 297 | m_Children: [] 298 | m_Father: {fileID: 0} 299 | m_RootOrder: 0 300 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 301 | --- !u!114 &963194229 302 | MonoBehaviour: 303 | m_ObjectHideFlags: 0 304 | m_CorrespondingSourceObject: {fileID: 0} 305 | m_PrefabInstance: {fileID: 0} 306 | m_PrefabAsset: {fileID: 0} 307 | m_GameObject: {fileID: 963194225} 308 | m_Enabled: 1 309 | m_EditorHideFlags: 0 310 | m_Script: {fileID: 11500000, guid: 01e548d240889144691a41b5a7c6f11e, type: 3} 311 | m_Name: 312 | m_EditorClassIdentifier: 313 | boost: 3.5 314 | positionLerpTime: 0.2 315 | mouseSensitivityCurve: 316 | serializedVersion: 2 317 | m_Curve: 318 | - serializedVersion: 3 319 | time: 0 320 | value: 0.5 321 | inSlope: 0 322 | outSlope: 5 323 | tangentMode: 0 324 | weightedMode: 0 325 | inWeight: 0 326 | outWeight: 0 327 | - serializedVersion: 3 328 | time: 1 329 | value: 2.5 330 | inSlope: 0 331 | outSlope: 0 332 | tangentMode: 0 333 | weightedMode: 0 334 | inWeight: 0 335 | outWeight: 0 336 | m_PreInfinity: 2 337 | m_PostInfinity: 2 338 | m_RotationOrder: 4 339 | rotationLerpTime: 0.01 340 | invertY: 0 341 | --- !u!114 &963194230 342 | MonoBehaviour: 343 | m_ObjectHideFlags: 0 344 | m_CorrespondingSourceObject: {fileID: 0} 345 | m_PrefabInstance: {fileID: 0} 346 | m_PrefabAsset: {fileID: 0} 347 | m_GameObject: {fileID: 963194225} 348 | m_Enabled: 1 349 | m_EditorHideFlags: 0 350 | m_Script: {fileID: 11500000, guid: 27ca3171cd73831459ec6ed02f90fc2d, type: 3} 351 | m_Name: 352 | m_EditorClassIdentifier: 353 | worldSetup: {fileID: 1730994060} 354 | deformRadius: 30 355 | --- !u!1 &1730994059 356 | GameObject: 357 | m_ObjectHideFlags: 0 358 | m_CorrespondingSourceObject: {fileID: 0} 359 | m_PrefabInstance: {fileID: 0} 360 | m_PrefabAsset: {fileID: 0} 361 | serializedVersion: 6 362 | m_Component: 363 | - component: {fileID: 1730994061} 364 | - component: {fileID: 1730994060} 365 | m_Layer: 0 366 | m_Name: World 367 | m_TagString: Untagged 368 | m_Icon: {fileID: 0} 369 | m_NavMeshLayer: 0 370 | m_StaticEditorFlags: 0 371 | m_IsActive: 1 372 | --- !u!114 &1730994060 373 | MonoBehaviour: 374 | m_ObjectHideFlags: 0 375 | m_CorrespondingSourceObject: {fileID: 0} 376 | m_PrefabInstance: {fileID: 0} 377 | m_PrefabAsset: {fileID: 0} 378 | m_GameObject: {fileID: 1730994059} 379 | m_Enabled: 1 380 | m_EditorHideFlags: 0 381 | m_Script: {fileID: 11500000, guid: 94e02631dd45ad34a8dece297f85f9f0, type: 3} 382 | m_Name: 383 | m_EditorClassIdentifier: 384 | voxelMaterial: {fileID: 2100000, guid: 27178c7fa1d86eb41b535327d6674cf6, type: 2} 385 | chunkPrefab: {fileID: 5333817436453212684, guid: 9e9d80ee6f36225499b17ac62f21d0b5, 386 | type: 3} 387 | player: {fileID: 963194228} 388 | _noiseData: 389 | surfaceLevel: 50 390 | freq: 0.01 391 | ampl: 1.5 392 | oct: 6 393 | offset: 138 394 | chunkDrawDistance: 400 395 | --- !u!4 &1730994061 396 | Transform: 397 | m_ObjectHideFlags: 0 398 | m_CorrespondingSourceObject: {fileID: 0} 399 | m_PrefabInstance: {fileID: 0} 400 | m_PrefabAsset: {fileID: 0} 401 | m_GameObject: {fileID: 1730994059} 402 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 403 | m_LocalPosition: {x: 0, y: 0, z: 0} 404 | m_LocalScale: {x: 1, y: 1, z: 1} 405 | m_Children: [] 406 | m_Father: {fileID: 0} 407 | m_RootOrder: 2 408 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 409 | -------------------------------------------------------------------------------- /Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/SimpleCameraController.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace UnityTemplateProjects 4 | { 5 | public class SimpleCameraController : MonoBehaviour 6 | { 7 | class CameraState 8 | { 9 | public float yaw; 10 | public float pitch; 11 | public float roll; 12 | public float x; 13 | public float y; 14 | public float z; 15 | 16 | public void SetFromTransform(Transform t) 17 | { 18 | pitch = t.eulerAngles.x; 19 | yaw = t.eulerAngles.y; 20 | roll = t.eulerAngles.z; 21 | x = t.position.x; 22 | y = t.position.y; 23 | z = t.position.z; 24 | } 25 | 26 | public void Translate(Vector3 translation) 27 | { 28 | Vector3 rotatedTranslation = Quaternion.Euler(pitch, yaw, roll) * translation; 29 | 30 | x += rotatedTranslation.x; 31 | y += rotatedTranslation.y; 32 | z += rotatedTranslation.z; 33 | } 34 | 35 | public void LerpTowards(CameraState target, float positionLerpPct, float rotationLerpPct) 36 | { 37 | yaw = Mathf.Lerp(yaw, target.yaw, rotationLerpPct); 38 | pitch = Mathf.Lerp(pitch, target.pitch, rotationLerpPct); 39 | roll = Mathf.Lerp(roll, target.roll, rotationLerpPct); 40 | 41 | x = Mathf.Lerp(x, target.x, positionLerpPct); 42 | y = Mathf.Lerp(y, target.y, positionLerpPct); 43 | z = Mathf.Lerp(z, target.z, positionLerpPct); 44 | } 45 | 46 | public void UpdateTransform(Transform t) 47 | { 48 | t.eulerAngles = new Vector3(pitch, yaw, roll); 49 | t.position = new Vector3(x, y, z); 50 | } 51 | } 52 | 53 | CameraState m_TargetCameraState = new CameraState(); 54 | CameraState m_InterpolatingCameraState = new CameraState(); 55 | 56 | [Header("Movement Settings")] 57 | [Tooltip("Exponential boost factor on translation, controllable by mouse wheel.")] 58 | public float boost = 3.5f; 59 | 60 | [Tooltip("Time it takes to interpolate camera position 99% of the way to the target."), Range(0.001f, 1f)] 61 | public float positionLerpTime = 0.2f; 62 | 63 | [Header("Rotation Settings")] 64 | [Tooltip("X = Change in mouse position.\nY = Multiplicative factor for camera rotation.")] 65 | public AnimationCurve mouseSensitivityCurve = new AnimationCurve(new Keyframe(0f, 0.5f, 0f, 5f), new Keyframe(1f, 2.5f, 0f, 0f)); 66 | 67 | [Tooltip("Time it takes to interpolate camera rotation 99% of the way to the target."), Range(0.001f, 1f)] 68 | public float rotationLerpTime = 0.01f; 69 | 70 | [Tooltip("Whether or not to invert our Y axis for mouse input to rotation.")] 71 | public bool invertY = false; 72 | 73 | void OnEnable() 74 | { 75 | m_TargetCameraState.SetFromTransform(transform); 76 | m_InterpolatingCameraState.SetFromTransform(transform); 77 | } 78 | 79 | Vector3 GetInputTranslationDirection() 80 | { 81 | Vector3 direction = new Vector3(); 82 | if (Input.GetKey(KeyCode.W)) 83 | { 84 | direction += Vector3.forward; 85 | } 86 | if (Input.GetKey(KeyCode.S)) 87 | { 88 | direction += Vector3.back; 89 | } 90 | if (Input.GetKey(KeyCode.A)) 91 | { 92 | direction += Vector3.left; 93 | } 94 | if (Input.GetKey(KeyCode.D)) 95 | { 96 | direction += Vector3.right; 97 | } 98 | if (Input.GetKey(KeyCode.Q)) 99 | { 100 | direction += Vector3.down; 101 | } 102 | if (Input.GetKey(KeyCode.E)) 103 | { 104 | direction += Vector3.up; 105 | } 106 | return direction; 107 | } 108 | 109 | void Update() 110 | { 111 | // Exit Sample 112 | if (Input.GetKey(KeyCode.Escape)) 113 | { 114 | Application.Quit(); 115 | #if UNITY_EDITOR 116 | UnityEditor.EditorApplication.isPlaying = false; 117 | #endif 118 | } 119 | 120 | // Hide and lock cursor when right mouse button pressed 121 | if (Input.GetMouseButtonDown(1)) 122 | { 123 | Cursor.lockState = CursorLockMode.Locked; 124 | } 125 | 126 | // Unlock and show cursor when right mouse button released 127 | if (Input.GetMouseButtonUp(1)) 128 | { 129 | Cursor.visible = true; 130 | Cursor.lockState = CursorLockMode.None; 131 | } 132 | 133 | // Rotation 134 | if (Input.GetMouseButton(1)) 135 | { 136 | var mouseMovement = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y") * (invertY ? 1 : -1)); 137 | 138 | var mouseSensitivityFactor = mouseSensitivityCurve.Evaluate(mouseMovement.magnitude); 139 | 140 | m_TargetCameraState.yaw += mouseMovement.x * mouseSensitivityFactor; 141 | m_TargetCameraState.pitch += mouseMovement.y * mouseSensitivityFactor; 142 | } 143 | 144 | // Translation 145 | var translation = GetInputTranslationDirection() * Time.deltaTime; 146 | 147 | // Speed up movement when shift key held 148 | if (Input.GetKey(KeyCode.LeftShift)) 149 | { 150 | translation *= 10.0f; 151 | } 152 | 153 | // Modify movement by a boost factor (defined in Inspector and modified in play mode through the mouse scroll wheel) 154 | boost += Input.mouseScrollDelta.y * 0.2f; 155 | translation *= Mathf.Pow(2.0f, boost); 156 | 157 | m_TargetCameraState.Translate(translation); 158 | 159 | // Framerate-independent interpolation 160 | // Calculate the lerp amount, such that we get 99% of the way to our target in the specified time 161 | var positionLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / positionLerpTime) * Time.deltaTime); 162 | var rotationLerpPct = 1f - Mathf.Exp((Mathf.Log(1f - 0.99f) / rotationLerpTime) * Time.deltaTime); 163 | m_InterpolatingCameraState.LerpTowards(m_TargetCameraState, positionLerpPct, rotationLerpPct); 164 | 165 | m_InterpolatingCameraState.UpdateTransform(transform); 166 | } 167 | } 168 | 169 | } -------------------------------------------------------------------------------- /Assets/SimpleCameraController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 01e548d240889144691a41b5a7c6f11e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa92877b976f17746b18f5237a82f324 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/TerrainDeformer.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public class TerrainDeformer : MonoBehaviour 6 | { 7 | public WorldGeneration.WorldBase worldSetup; 8 | public float deformRadius; 9 | Camera _camera; 10 | 11 | private void Start() 12 | { 13 | _camera = Camera.main; 14 | } 15 | 16 | private void Update() 17 | { 18 | if (Input.GetKeyDown(KeyCode.C)) 19 | { 20 | var ray = new Ray(_camera.transform.position, _camera.transform.forward); 21 | if(Physics.Raycast(ray, out RaycastHit hit, 100f)) 22 | { 23 | worldSetup.ModifyTerrainBallShape(hit.point, deformRadius, 1f); 24 | } 25 | } 26 | else if (Input.GetKeyDown(KeyCode.F)) 27 | { 28 | var ray = new Ray(_camera.transform.position, _camera.transform.forward); 29 | if (Physics.Raycast(ray, out RaycastHit hit, 100f)) 30 | { 31 | worldSetup.ModifyTerrainBallShape(hit.point, deformRadius, -1f); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/TerrainDeformer.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27ca3171cd73831459ec6ed02f90fc2d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d14475ce4d79dbb49aebb649699bd57d 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/ChunkData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Collections; 4 | using Unity.Mathematics; 5 | using UnityEngine; 6 | using Unity.Jobs; 7 | using UnityEngine.Rendering; 8 | using System; 9 | using Unity.Collections.LowLevel.Unsafe; 10 | 11 | namespace WorldGeneration 12 | { 13 | public class ChunkData : MonoBehaviour 14 | { 15 | //Native collections for mesh and density data used in jobs. 16 | NativeArray buffer; 17 | NativeArray indexes; 18 | NativeArray noiseMap; 19 | 20 | //Chunk's position 21 | float3 pos; 22 | 23 | //Marching cubes job handle 24 | JobHandle myHandle; 25 | //Is marching cubes job currently running 26 | bool isBeingProcessed; 27 | 28 | //Collider baking handle 29 | JobHandle colliderHandle; 30 | //Is a collider being currently baked 31 | bool meshBaking = false; 32 | 33 | //This chunk's mesh 34 | Mesh myMesh; 35 | //This chunk's mesh filter 36 | MeshFilter filter; 37 | 38 | //Thread safe counter to keep track of vertex index from https://github.com/Eldemarkki/Marching-Cubes-Terrain 39 | Counter _counter; 40 | 41 | //Chunk's size 42 | public int size; 43 | //This is needed after mesh.SetIndexBuffer data to make the mesh visible, for some reason 44 | SubMeshDescriptor desc = new SubMeshDescriptor(); 45 | 46 | bool isNewChunk = true; 47 | //Has chunk been modified since last frame 48 | bool needsUpdate = false; 49 | 50 | //Variables passed chunk modify job 51 | int3 newExplosionSpot; 52 | float explosionRange; 53 | float explosionValue; 54 | 55 | //Simulate an explosion at a point for this chunk 56 | public void Explode(int3 worldPos, float explosionRange, float explosionValue) 57 | { 58 | newExplosionSpot = worldPos - (int3)pos;//(worldPos - (int3)pos).Mod(size + 1); 59 | this.explosionRange = explosionRange; 60 | this.explosionValue = explosionValue; 61 | needsUpdate = true; 62 | } 63 | //Set density at given index immediatly. Chunk will start an update at LateUpdate after possible current jobs are done. 64 | public void SetDensity(int3 localPos, float density) 65 | { 66 | var size = this.size + 1; 67 | noiseMap[localPos.z + localPos.y * size + localPos.x * size * size] = density; 68 | needsUpdate = true; 69 | } 70 | private void OnEnable() 71 | { 72 | if (isNewChunk) 73 | { 74 | NewChunk(size, transform.position); 75 | isNewChunk = false; 76 | } 77 | else 78 | { 79 | myHandle.Complete(); 80 | myMesh.Clear(); 81 | ChunkUpdate(transform.position); 82 | } 83 | WorldBase.currentChunks.Add(pos, this); 84 | } 85 | private void OnDisable() 86 | { 87 | //myHandle.Complete(); 88 | isBeingProcessed = false; 89 | 90 | WorldBase.currentChunks.Remove(pos); 91 | WorldBase.freeChunks.Enqueue(this); 92 | } 93 | private void OnApplicationQuit() 94 | { 95 | buffer.Dispose(); 96 | indexes.Dispose(); 97 | noiseMap.Dispose(); 98 | } 99 | 100 | private void LateUpdate() 101 | { 102 | if (isBeingProcessed) 103 | { 104 | if (myHandle.IsCompleted) 105 | { 106 | isBeingProcessed = false; 107 | myHandle.Complete(); 108 | UpdateChunk(); 109 | } 110 | } 111 | else if(needsUpdate) 112 | { 113 | NoiseMapExplosion(); 114 | needsUpdate = false; 115 | } 116 | else if(colliderHandle.IsCompleted && meshBaking) 117 | { 118 | colliderHandle.Complete(); 119 | ApplyCollider(); 120 | meshBaking = false; 121 | } 122 | } 123 | 124 | void NewChunk(int size, Vector3 pos) 125 | { 126 | this.size = size; 127 | transform.position = (float3)pos; 128 | this.pos = pos; 129 | var arraySize = size * size * size; 130 | buffer = new NativeArray(arraySize * 3 * 5, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); 131 | indexes = new NativeArray(arraySize * 3 * 5, Allocator.Persistent, NativeArrayOptions.UninitializedMemory); 132 | noiseMap = new NativeArray((size + 1) * (size + 1) * (size + 1), Allocator.Persistent, NativeArrayOptions.UninitializedMemory); 133 | myMesh = new Mesh(); 134 | filter = GetComponent(); 135 | filter.sharedMesh = myMesh; 136 | 137 | desc.topology = MeshTopology.Triangles; 138 | MarchChunk(); 139 | } 140 | 141 | void ChunkUpdate(float3 pos) 142 | { 143 | this.pos = pos; 144 | MarchChunk(); 145 | } 146 | 147 | void UpdateChunk() 148 | { 149 | var layout = new[] 150 | { 151 | new VertexAttributeDescriptor(VertexAttribute.Position, VertexAttributeFormat.Float32, 3), 152 | }; 153 | var vertexCount = _counter.Count * 3; 154 | if (vertexCount > 0) 155 | { 156 | var boundsSize = size / 2; 157 | myMesh.bounds = new Bounds(new Vector3(boundsSize, boundsSize, boundsSize), new Vector3(size, size, size)); 158 | //Set vertices and indices 159 | myMesh.SetVertexBufferParams(vertexCount, layout); 160 | myMesh.SetVertexBufferData(buffer, 0, 0, vertexCount, 0, MeshUpdateFlags.DontValidateIndices); 161 | myMesh.SetIndexBufferParams(vertexCount, IndexFormat.UInt32); 162 | myMesh.SetIndexBufferData(indexes, 0, 0, vertexCount, MeshUpdateFlags.DontValidateIndices); 163 | 164 | desc.indexCount = vertexCount; 165 | myMesh.SetSubMesh(0, desc, MeshUpdateFlags.DontValidateIndices); 166 | 167 | myMesh.RecalculateNormals(); 168 | filter.sharedMesh = myMesh; 169 | //Start collider baking 170 | var colliderJob = new ChunkColliderBakeJob() 171 | { 172 | meshId = myMesh.GetInstanceID() 173 | }; 174 | colliderHandle = colliderJob.Schedule(); 175 | meshBaking = true; 176 | } 177 | else 178 | { 179 | myMesh.Clear(); 180 | } 181 | transform.position = pos; 182 | 183 | _counter.Dispose(); 184 | } 185 | //Collider baked, set it to the chunk 186 | void ApplyCollider() 187 | { 188 | GetComponent().sharedMesh = myMesh; 189 | } 190 | void MarchChunk() 191 | { 192 | _counter = new Counter(Allocator.Persistent); 193 | var arraySize = size * size * size; 194 | 195 | var noiseJob = new NoiseJob() 196 | { 197 | ampl = WorldBase.noiseData.ampl, 198 | freq = WorldBase.noiseData.freq, 199 | oct = WorldBase.noiseData.oct, 200 | offset = pos, 201 | seed = WorldBase.noiseData.offset, 202 | surfaceLevel = WorldBase.noiseData.surfaceLevel, 203 | noiseMap = noiseMap, 204 | size = size + 1 205 | //pos = WorldSetup.positions 206 | }; 207 | var noiseHandle = noiseJob.Schedule((size + 1) * (size + 1) * (size + 1), 64); 208 | 209 | 210 | 211 | var marchingJob = new MarchingJob() 212 | { 213 | densities = noiseMap, 214 | isolevel = 0f, 215 | chunkSize = size, 216 | triangles = indexes, 217 | vertices = buffer, 218 | counter = _counter 219 | 220 | }; 221 | var marchinJob = marchingJob.Schedule(arraySize, 32, noiseHandle); 222 | myHandle = marchinJob; 223 | isBeingProcessed = true; 224 | } 225 | void RefreshChunkMesh() 226 | { 227 | _counter = new Counter(Allocator.Persistent); 228 | var marchingJob = new MarchingJob() 229 | { 230 | densities = noiseMap, 231 | isolevel = 0f, 232 | chunkSize = size, 233 | triangles = indexes, 234 | vertices = buffer, 235 | counter = _counter 236 | 237 | }; 238 | var marchinJob = marchingJob.Schedule(size * size * size, 32); 239 | myHandle = marchinJob; 240 | isBeingProcessed = true; 241 | } 242 | void NoiseMapExplosion() 243 | { 244 | _counter = new Counter(Allocator.Persistent); 245 | var noiseUpdateJob = new ChunkExplodeJob() 246 | { 247 | size = size + 1, 248 | explosionOrigin = newExplosionSpot, 249 | explosionRange = explosionRange, 250 | newDensity = explosionValue, 251 | noiseMap = noiseMap 252 | }; 253 | var handl = noiseUpdateJob.Schedule((size + 1) * (size + 1) * (size + 1), 64); 254 | 255 | var marchingJob = new MarchingJob() 256 | { 257 | densities = noiseMap, 258 | isolevel = 0f, 259 | chunkSize = size, 260 | triangles = indexes, 261 | vertices = buffer, 262 | counter = _counter 263 | 264 | }; 265 | var marchinJob = marchingJob.Schedule(size * size * size, 32, handl); 266 | myHandle = marchinJob; 267 | isBeingProcessed = true; 268 | } 269 | } 270 | } 271 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/ChunkData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3a04036cd9b3c8040a66b20b56f6b26f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/Counter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.InteropServices; 3 | using System.Threading; 4 | using Unity.Collections; 5 | using Unity.Collections.LowLevel.Unsafe; 6 | using Unity.Mathematics; 7 | 8 | namespace WorldGeneration 9 | { 10 | public unsafe struct Counter : IDisposable 11 | { 12 | /// 13 | /// The allocator for the counter 14 | /// 15 | private Allocator allocator; 16 | 17 | /// 18 | /// The pointer to the value 19 | /// 20 | [NativeDisableUnsafePtrRestriction] private int* _counter; 21 | 22 | /// 23 | /// The counter's value 24 | /// 25 | public int Count 26 | { 27 | get => *_counter; 28 | set => (*_counter) = value; 29 | } 30 | 31 | /// 32 | /// The constructor 33 | /// 34 | /// What type of allocator to use 35 | public Counter(Allocator allocator) 36 | { 37 | this.allocator = allocator; 38 | _counter = (int*)UnsafeUtility.Malloc(sizeof(int), 4, allocator); 39 | Count = 0; 40 | } 41 | 42 | /// 43 | /// Increments the count by 1 44 | /// 45 | /// The original count 46 | public int Increment() 47 | { 48 | return Interlocked.Increment(ref *_counter) - 1; 49 | } 50 | 51 | /// 52 | /// Disposes the counter 53 | /// 54 | public void Dispose() 55 | { 56 | UnsafeUtility.Free(_counter, allocator); 57 | } 58 | } 59 | public static class Utils 60 | { 61 | public static unsafe void CopyToFast(this NativeSlice source, T[] target) where T : struct 62 | { 63 | if (target == null) 64 | { 65 | throw new NullReferenceException(nameof(target) + " is null"); 66 | } 67 | 68 | int nativeArrayLength = source.Length; 69 | if (target.Length < nativeArrayLength) 70 | { 71 | throw new IndexOutOfRangeException(nameof(target) + " is shorter than " + nameof(source)); 72 | } 73 | 74 | int byteLength = source.Length * Marshal.SizeOf(default(T)); 75 | void* managedBuffer = UnsafeUtility.AddressOf(ref target[0]); 76 | void* nativeBuffer = source.GetUnsafePtr(); 77 | Buffer.MemoryCopy(nativeBuffer, managedBuffer, byteLength, byteLength); 78 | } 79 | public static int3 FloorToMultipleOfX(this float3 n, int x) 80 | { 81 | return (int3)(math.floor(n / x) * x); 82 | } 83 | public static int3 Mod(this int3 n, int x) 84 | { 85 | return (n % x + x) % x; 86 | } 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/Counter.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b8e0d20544428704a84d4c2a45db0ec8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/InfiniteWorld.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using Unity.Mathematics; 4 | using UnityEngine; 5 | 6 | namespace WorldGeneration 7 | { 8 | //Infinite world logic 9 | public class InfiniteWorld : WorldBase 10 | { 11 | //How far should chunks be spawned. 12 | public float chunkDrawDistance; 13 | //Because foreach, we cant remove chunks from currentChunks straight away. Need to store the values to this list and remove after the loop 14 | List toRemove = new List(); 15 | 16 | private void Start() 17 | { 18 | StartGenerate(); 19 | } 20 | //Create new chunk objects at startup 21 | void StartGenerate() 22 | { 23 | int amount = Mathf.RoundToInt(chunkDrawDistance / (chunkSize)); 24 | float rootPosX = Mathf.RoundToInt(player.position.x / (chunkSize)) * (chunkSize); 25 | float rootPosY = Mathf.RoundToInt(player.position.y / (chunkSize)) * (chunkSize); 26 | float rootPosZ = Mathf.RoundToInt(player.position.z / (chunkSize)) * (chunkSize); 27 | for (int x = -amount / 2; x < amount / 2; x++) 28 | { 29 | for (int y = -amount / 2; y < amount / 2; y++) 30 | { 31 | for (int z = -amount / 2; z < amount / 2; z++) 32 | { 33 | var pos = new float3(rootPosX + x * (chunkSize), rootPosY + y * (chunkSize), rootPosZ + z * (chunkSize)); 34 | if (Vector3.Distance(pos, player.position + Vector3.up) < chunkDrawDistance / 2) 35 | GenerateChunk(pos); 36 | } 37 | } 38 | } 39 | } 40 | public override void UpdateChunks() 41 | { 42 | toRemove.Clear(); 43 | 44 | foreach(var pos in currentChunks.Keys) 45 | { 46 | if (Vector3.Distance(pos, player.position + Vector3.up) > chunkDrawDistance / 2) 47 | { 48 | toRemove.Add(pos); 49 | } 50 | } 51 | toRemove.ForEach(x => currentChunks[x].gameObject.SetActive(false)); 52 | int amount = Mathf.RoundToInt(chunkDrawDistance / (chunkSize)); 53 | float rootPosX = Mathf.RoundToInt(player.position.x / (chunkSize)) * (chunkSize); 54 | float rootPosY = Mathf.RoundToInt(player.position.y / (chunkSize)) * (chunkSize); 55 | float rootPosZ = Mathf.RoundToInt(player.position.z / (chunkSize)) * (chunkSize); 56 | for (int x = -amount / 2; x < amount / 2; x++) 57 | { 58 | for (int y = -amount / 2; y < amount / 2; y++) 59 | { 60 | for (int z = -amount / 2; z < amount / 2; z++) 61 | { 62 | //If no chunks are pooled, don't do anything and wait for next frame instead. Could also be set to spawn new chunks, but that wasn't necessary 63 | if (freeChunks.Count == 0) 64 | return; 65 | var pos = new float3(rootPosX + x * (chunkSize), rootPosY + y * (chunkSize), rootPosZ + z * (chunkSize)); 66 | //If there is a chunk at this position already, don't do anything 67 | if (currentChunks.ContainsKey(pos)) 68 | continue; 69 | //Check if chunk is close enough. 70 | if (Vector3.Distance(pos, player.position + Vector3.up) < chunkDrawDistance / 2) 71 | { 72 | //Get pooled chunk from the queue. 73 | var chumk = freeChunks.Dequeue(); 74 | chumk.gameObject.transform.position = pos; 75 | chumk.gameObject.SetActive(true); 76 | } 77 | } 78 | } 79 | } 80 | } 81 | } 82 | } -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/InfiniteWorld.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 94e02631dd45ad34a8dece297f85f9f0 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/VertexList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Unity.Mathematics; 5 | 6 | namespace WorldGeneration 7 | { 8 | public struct VertexList 9 | { 10 | /// 11 | /// The first vertex 12 | /// 13 | private float3 _c1; 14 | 15 | /// 16 | /// The second vertex 17 | /// 18 | private float3 _c2; 19 | 20 | /// 21 | /// The third vertex 22 | /// 23 | private float3 _c3; 24 | 25 | /// 26 | /// The fourth vertex 27 | /// 28 | private float3 _c4; 29 | 30 | /// 31 | /// The fifth vertex 32 | /// 33 | private float3 _c5; 34 | 35 | /// 36 | /// The sixth vertex 37 | /// 38 | private float3 _c6; 39 | 40 | /// 41 | /// The seventh vertex 42 | /// 43 | private float3 _c7; 44 | 45 | /// 46 | /// The eighth vertex 47 | /// 48 | private float3 _c8; 49 | 50 | /// 51 | /// The ninth vertex 52 | /// 53 | private float3 _c9; 54 | 55 | /// 56 | /// The tenth vertex 57 | /// 58 | private float3 _c10; 59 | 60 | /// 61 | /// The eleventh vertex 62 | /// 63 | private float3 _c11; 64 | 65 | /// 66 | /// The twelfth vertex 67 | /// 68 | private float3 _c12; 69 | 70 | /// 71 | /// The indexer for the vertex list 72 | /// 73 | /// The vertex's index 74 | /// Thrown when the index is more than 11. 75 | public float3 this[int index] 76 | { 77 | get 78 | { 79 | switch (index) 80 | { 81 | case 0: return _c1; 82 | case 1: return _c2; 83 | case 2: return _c3; 84 | case 3: return _c4; 85 | case 4: return _c5; 86 | case 5: return _c6; 87 | case 6: return _c7; 88 | case 7: return _c8; 89 | case 8: return _c9; 90 | case 9: return _c10; 91 | case 10: return _c11; 92 | case 11: return _c12; 93 | default: throw new System.IndexOutOfRangeException(); 94 | } 95 | } 96 | set 97 | { 98 | switch (index) 99 | { 100 | case 0: 101 | _c1 = value; 102 | break; 103 | case 1: 104 | _c2 = value; 105 | break; 106 | case 2: 107 | _c3 = value; 108 | break; 109 | case 3: 110 | _c4 = value; 111 | break; 112 | case 4: 113 | _c5 = value; 114 | break; 115 | case 5: 116 | _c6 = value; 117 | break; 118 | case 6: 119 | _c7 = value; 120 | break; 121 | case 7: 122 | _c8 = value; 123 | break; 124 | case 8: 125 | _c9 = value; 126 | break; 127 | case 9: 128 | _c10 = value; 129 | break; 130 | case 10: 131 | _c11 = value; 132 | break; 133 | case 11: 134 | _c12 = value; 135 | break; 136 | default: 137 | throw new System.IndexOutOfRangeException(); 138 | } 139 | } 140 | } 141 | } 142 | } -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/VertexList.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2e3538536126f0748930169ab8dcbd22 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/VoxelCorners.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace WorldGeneration 6 | { 7 | public struct VoxelCorners 8 | { 9 | /// 10 | /// The first corner 11 | /// 12 | public T Corner1 { get; set; } 13 | 14 | /// 15 | /// The second corner 16 | /// 17 | public T Corner2 { get; set; } 18 | 19 | /// 20 | /// The third corner 21 | /// 22 | public T Corner3 { get; set; } 23 | 24 | /// 25 | /// The fourth corner 26 | /// 27 | public T Corner4 { get; set; } 28 | 29 | /// 30 | /// The fifth corner 31 | /// 32 | public T Corner5 { get; set; } 33 | 34 | /// 35 | /// The sixth corner 36 | /// 37 | public T Corner6 { get; set; } 38 | 39 | /// 40 | /// The seventh corner 41 | /// 42 | public T Corner7 { get; set; } 43 | 44 | /// 45 | /// The eighth corner 46 | /// 47 | public T Corner8 { get; set; } 48 | 49 | /// 50 | /// The indexer for the voxel corners 51 | /// 52 | /// The corner's index 53 | /// Thrown when index is more than 7. 54 | public T this[int index] 55 | { 56 | get 57 | { 58 | switch (index) 59 | { 60 | case 0: return Corner1; 61 | case 1: return Corner2; 62 | case 2: return Corner3; 63 | case 3: return Corner4; 64 | case 4: return Corner5; 65 | case 5: return Corner6; 66 | case 6: return Corner7; 67 | case 7: return Corner8; 68 | default: throw new System.IndexOutOfRangeException(); 69 | } 70 | } 71 | set 72 | { 73 | switch (index) 74 | { 75 | case 0: 76 | Corner1 = value; 77 | break; 78 | case 1: 79 | Corner2 = value; 80 | break; 81 | case 2: 82 | Corner3 = value; 83 | break; 84 | case 3: 85 | Corner4 = value; 86 | break; 87 | case 4: 88 | Corner5 = value; 89 | break; 90 | case 5: 91 | Corner6 = value; 92 | break; 93 | case 6: 94 | Corner7 = value; 95 | break; 96 | case 7: 97 | Corner8 = value; 98 | break; 99 | default: throw new System.IndexOutOfRangeException(); 100 | } 101 | } 102 | } 103 | } 104 | } -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/VoxelCorners.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b4b38475e9545ef42a0fcca3485e36ee 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/WorldBase.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Unity.Jobs; 5 | using Unity.Collections; 6 | using Unity.Mathematics; 7 | using Unity.Burst; 8 | using System.Runtime.CompilerServices; 9 | using System; 10 | using Unity.Collections.LowLevel.Unsafe; 11 | 12 | namespace WorldGeneration 13 | { 14 | [Serializable] 15 | public class NoiseData 16 | { 17 | public float surfaceLevel; 18 | public float freq; 19 | public float ampl; 20 | public int oct; 21 | public float offset; 22 | } 23 | public class WorldBase : MonoBehaviour 24 | { 25 | public Material voxelMaterial; 26 | public GameObject chunkPrefab; 27 | internal int chunkSize = 0; 28 | 29 | public Transform player; 30 | Vector3 lastPos; 31 | 32 | [SerializeField] 33 | NoiseData _noiseData; 34 | public static NoiseData noiseData; 35 | 36 | //Currently visible chunks 37 | public static Dictionary currentChunks = new Dictionary(); 38 | //Pooled chunks free for use 39 | public static Queue freeChunks = new Queue(); 40 | 41 | 42 | void Init() 43 | { 44 | chunkSize = chunkPrefab.GetComponent().size; 45 | noiseData = _noiseData; 46 | } 47 | //Efficient way of modifying terrain in a ball shape 48 | public void ModifyTerrainBallShape(float3 point, float range, float newDensityValue) 49 | { 50 | int3 hitChunkPos = PositionToChunkCoord(point); 51 | int intRange = Mathf.CeilToInt(range / chunkSize); 52 | 53 | for (int x = -intRange; x <= intRange; x++) 54 | { 55 | for (int y = -intRange; y <= intRange; y++) 56 | { 57 | for (int z = -intRange; z <= intRange; z++) 58 | { 59 | int3 chunkPos = new int3(hitChunkPos.x + x * chunkSize, hitChunkPos.y + y * chunkSize, hitChunkPos.z + z * chunkSize); 60 | if (currentChunks.TryGetValue(chunkPos, out ChunkData chunk)) 61 | { 62 | chunk.Explode((int3)point, range, newDensityValue); 63 | } 64 | } 65 | } 66 | } 67 | } 68 | void SetDensity(int3 worldPos, float density) 69 | { 70 | //Set invidual densities. Not good for large amounts of points. Originally from https://github.com/Eldemarkki/Marching-Cubes-Terrain 71 | int3 chunkPos = PositionToChunkCoord(worldPos); 72 | 73 | //TODO: Right now if chunk is not visible neighbouring chunk borders don't get fixed, leaves weird strips. 74 | if (!currentChunks.TryGetValue(chunkPos, out ChunkData chunk)) 75 | return; 76 | 77 | int3 localPos = (worldPos - chunkPos).Mod(chunkSize + 1); 78 | 79 | 80 | chunk.SetDensity(localPos, 1f); 81 | 82 | //Fix chunk edges 83 | int3 neighbourChunkPos; 84 | int3 neighbourLocalPos; 85 | 86 | if (localPos.x == 0) 87 | { 88 | if (localPos.z == 0) 89 | { 90 | if (localPos.y == 0) 91 | { 92 | neighbourChunkPos = chunkPos - new int3(chunkSize, chunkSize, chunkSize); 93 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 94 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 95 | chunk.SetDensity(neighbourLocalPos, 1f); 96 | } 97 | neighbourChunkPos = chunkPos - new int3(chunkSize, 0, chunkSize); 98 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 99 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 100 | chunk.SetDensity(neighbourLocalPos, 1f); 101 | } 102 | else if(localPos.y == 0) 103 | { 104 | neighbourChunkPos = chunkPos - new int3(chunkSize, chunkSize, 0); 105 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 106 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 107 | chunk.SetDensity(neighbourLocalPos, 1f); 108 | } 109 | neighbourChunkPos = chunkPos - new int3(chunkSize, 0, 0); 110 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 111 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 112 | chunk.SetDensity(neighbourLocalPos, 1f); 113 | } 114 | if (localPos.y == 0) 115 | { 116 | if (localPos.z == 0) 117 | { 118 | neighbourChunkPos = chunkPos - new int3(0, chunkSize, chunkSize); 119 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 120 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 121 | chunk.SetDensity(neighbourLocalPos, 1f); 122 | } 123 | neighbourChunkPos = chunkPos - new int3(0, chunkSize, 0); 124 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 125 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 126 | chunk.SetDensity(neighbourLocalPos, 1f); 127 | } 128 | if (localPos.z == 0) 129 | { 130 | neighbourChunkPos = chunkPos - new int3(0, 0, chunkSize); 131 | neighbourLocalPos = (worldPos - neighbourChunkPos).Mod(chunkSize + 1); 132 | if (currentChunks.TryGetValue(neighbourChunkPos, out chunk)) 133 | chunk.SetDensity(neighbourLocalPos, 1f); 134 | } 135 | } 136 | int3 PositionToChunkCoord(float3 pos) 137 | { 138 | return pos.FloorToMultipleOfX(chunkSize); 139 | } 140 | private void Awake() 141 | { 142 | Init(); 143 | } 144 | //Creates new chunk objects at startup. 145 | public void GenerateChunk(float3 pos) 146 | { 147 | GameObject go = Instantiate(chunkPrefab, pos, Quaternion.identity, transform); 148 | } 149 | 150 | public virtual void UpdateChunks() { } 151 | 152 | private void Update() 153 | { 154 | //Check if player has moved enough to require an update 155 | if (Vector3.Distance(lastPos, player.position) > chunkSize) 156 | { 157 | UpdateChunks(); 158 | lastPos = player.position; 159 | return; 160 | } 161 | } 162 | } 163 | //Marching cubes job from https://github.com/Eldemarkki/Marching-Cubes-Terrain 164 | [BurstCompile] 165 | public struct MarchingJob : IJobParallelFor 166 | { 167 | /// 168 | /// The densities to generate the mesh off of 169 | /// 170 | [ReadOnly, NativeDisableContainerSafetyRestriction] public NativeArray densities; 171 | 172 | /// 173 | /// The density level where a surface will be created. Densities below this will be inside the surface (solid), 174 | /// and densities above this will be outside the surface (air) 175 | /// 176 | [ReadOnly] public float isolevel; 177 | 178 | /// 179 | /// The chunk's size. This represents the width, height and depth in Unity units. 180 | /// 181 | [ReadOnly] public int chunkSize; 182 | 183 | /// 184 | /// The counter to keep track of the triangle index 185 | /// 186 | [WriteOnly] public Counter counter; 187 | 188 | 189 | /// 190 | /// The generated vertices 191 | /// 192 | [NativeDisableParallelForRestriction, WriteOnly] public NativeArray vertices; 193 | 194 | /// 195 | /// The generated triangles 196 | /// 197 | [NativeDisableParallelForRestriction, WriteOnly] public NativeArray triangles; 198 | 199 | /// 200 | /// The execute method required by the Unity Job System's IJobParallelFor 201 | /// 202 | /// The iteration index 203 | public void Execute(int index) 204 | { 205 | // Voxel's position inside the chunk. Goes from (0, 0, 0) to (chunkSize-1, chunkSize-1, chunkSize-1) 206 | int3 voxelLocalPosition = new int3( 207 | index / (chunkSize * chunkSize), 208 | index / chunkSize % chunkSize, 209 | index % chunkSize); 210 | 211 | VoxelCorners densities = GetDensities(voxelLocalPosition); 212 | 213 | int cubeIndex = CalculateCubeIndex(densities, isolevel); 214 | if (cubeIndex == 0 || cubeIndex == 255) 215 | { 216 | return; 217 | } 218 | 219 | VoxelCorners corners = GetCorners(voxelLocalPosition); 220 | 221 | int edgeIndex = Tables.EdgeTable[cubeIndex]; 222 | 223 | VertexList vertexList = GenerateVertexList(densities, corners, edgeIndex, isolevel); 224 | 225 | // Index at the beginning of the row 226 | int rowIndex = 15 * cubeIndex; 227 | 228 | for (int i = 0; Tables.TriangleTable[rowIndex + i] != -1 && i < 15; i += 3) 229 | { 230 | int triangleIndex = counter.Increment() * 3; 231 | 232 | vertices[triangleIndex + 0] = vertexList[Tables.TriangleTable[rowIndex + i + 0]]; 233 | triangles[triangleIndex + 0] = triangleIndex + 0; 234 | 235 | vertices[triangleIndex + 1] = vertexList[Tables.TriangleTable[rowIndex + i + 1]]; 236 | triangles[triangleIndex + 1] = triangleIndex + 1; 237 | 238 | vertices[triangleIndex + 2] = vertexList[Tables.TriangleTable[rowIndex + i + 2]]; 239 | triangles[triangleIndex + 2] = triangleIndex + 2; 240 | } 241 | } 242 | 243 | /// 244 | /// Gets the densities for the voxel at a position 245 | /// 246 | /// Voxel's local position 247 | /// The densities of that voxel 248 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 249 | private VoxelCorners GetDensities(int3 localPosition) 250 | { 251 | VoxelCorners densities = new VoxelCorners(); 252 | for (int i = 0; i < 8; i++) 253 | { 254 | int3 voxelCorner = localPosition + Tables.CubeCorners[i]; 255 | int densityIndex = voxelCorner.x * (chunkSize + 1) * (chunkSize + 1) + voxelCorner.y * (chunkSize + 1) + voxelCorner.z; 256 | densities[i] = this.densities[densityIndex]; 257 | } 258 | 259 | return densities; 260 | } 261 | 262 | /// 263 | /// Gets the corners for the voxel at a position 264 | /// 265 | /// The voxel's position 266 | /// The voxel's corners 267 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 268 | private VoxelCorners GetCorners(int3 position) 269 | { 270 | VoxelCorners corners = new VoxelCorners(); 271 | for (int i = 0; i < 8; i++) 272 | { 273 | corners[i] = position + Tables.CubeCorners[i]; 274 | } 275 | 276 | return corners; 277 | } 278 | 279 | /// 280 | /// Interpolates the vertex's position 281 | /// 282 | /// The first corner's position 283 | /// The second corner's position 284 | /// The first corner's density 285 | /// The second corner's density 286 | /// The density level where a surface will be created. Densities below this will be inside the surface (solid), 287 | /// and densities above this will be outside the surface (air) 288 | /// The interpolated vertex's position 289 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 290 | private float3 VertexInterpolate(float3 p1, float3 p2, float v1, float v2, float isolevel) 291 | { 292 | return p1 + (isolevel - v1) * (p2 - p1) / (v2 - v1); 293 | } 294 | 295 | /// 296 | /// Generates the vertex list for a single voxel 297 | /// 298 | /// The voxel's densities 299 | /// The voxel's corners 300 | /// The edge index 301 | /// The density level where a surface will be created. Densities below this will be inside the surface (solid), 302 | /// and densities above this will be outside the surface (air) 303 | /// The generated vertex list for the voxel 304 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 305 | private VertexList GenerateVertexList(VoxelCorners voxelDensities, VoxelCorners voxelCorners, 306 | int edgeIndex, float isolevel) 307 | { 308 | var vertexList = new VertexList(); 309 | 310 | for (int i = 0; i < 12; i++) 311 | { 312 | if ((edgeIndex & (1 << i)) == 0) { continue; } 313 | 314 | int edgeStartIndex = Tables.EdgeIndexTable[2 * i + 0]; 315 | int edgeEndIndex = Tables.EdgeIndexTable[2 * i + 1]; 316 | 317 | int3 corner1 = voxelCorners[edgeStartIndex]; 318 | int3 corner2 = voxelCorners[edgeEndIndex]; 319 | 320 | float density1 = voxelDensities[edgeStartIndex]; 321 | float density2 = voxelDensities[edgeEndIndex]; 322 | 323 | vertexList[i] = VertexInterpolate(corner1, corner2, density1, density2, isolevel); 324 | } 325 | 326 | return vertexList; 327 | } 328 | 329 | /// 330 | /// Calculates the cube index of a single voxel 331 | /// 332 | /// The voxel's densities 333 | /// The density level where a surface will be created. Densities below this will be inside the surface (solid), 334 | /// and densities above this will be outside the surface (air) 335 | /// The calculated cube index 336 | [MethodImpl(MethodImplOptions.AggressiveInlining)] 337 | private int CalculateCubeIndex(VoxelCorners voxelDensities, float isolevel) 338 | { 339 | int cubeIndex = 0; 340 | 341 | if (voxelDensities.Corner1 < isolevel) { cubeIndex |= 1; } 342 | if (voxelDensities.Corner2 < isolevel) { cubeIndex |= 2; } 343 | if (voxelDensities.Corner3 < isolevel) { cubeIndex |= 4; } 344 | if (voxelDensities.Corner4 < isolevel) { cubeIndex |= 8; } 345 | if (voxelDensities.Corner5 < isolevel) { cubeIndex |= 16; } 346 | if (voxelDensities.Corner6 < isolevel) { cubeIndex |= 32; } 347 | if (voxelDensities.Corner7 < isolevel) { cubeIndex |= 64; } 348 | if (voxelDensities.Corner8 < isolevel) { cubeIndex |= 128; } 349 | 350 | return cubeIndex; 351 | } 352 | } 353 | //Chunk noisemap update job, in a ball shape. Could implement more complex logic for this as well. 354 | [BurstCompile] 355 | public struct ChunkExplodeJob : IJobParallelFor 356 | { 357 | //Chunk's noisemap to edit. 358 | [WriteOnly] public NativeArray noiseMap; 359 | //Chunk size + 1 to account for borders 360 | [ReadOnly] public int size; 361 | //New density value 362 | [ReadOnly] public float newDensity; 363 | //Where the "explosion" happens, in local coordinates relative to chunk 364 | [ReadOnly] public int3 explosionOrigin; 365 | //How big of an explosion should happen 366 | [ReadOnly] public float explosionRange; 367 | 368 | public void Execute(int index) 369 | { 370 | var pos = new float3(index / (size * size), index / size % size, index % size); 371 | if(math.distance(pos, explosionOrigin) < explosionRange) 372 | { 373 | noiseMap[index] = newDensity; 374 | } 375 | 376 | } 377 | } 378 | //A job to bake chunk colliders 379 | public struct ChunkColliderBakeJob : IJob 380 | { 381 | [ReadOnly] public int meshId; 382 | public void Execute() 383 | { 384 | Physics.BakeMesh(meshId, false); 385 | } 386 | } 387 | //Vertex data 388 | //TODO: Add UVs and normals 389 | [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)] 390 | public struct Vertex 391 | { 392 | public float3 pos; 393 | } 394 | //Calculate noise in jobs 395 | [BurstCompile] 396 | public struct NoiseJob : IJobParallelFor 397 | { 398 | [ReadOnly] public float surfaceLevel; 399 | [ReadOnly] public float3 offset; 400 | [ReadOnly] public float3 seed; 401 | [ReadOnly] public float ampl; 402 | [ReadOnly] public float freq; 403 | [ReadOnly] public int oct; 404 | 405 | [NativeDisableParallelForRestriction, WriteOnly] 406 | public NativeArray noiseMap; 407 | [ReadOnly] public int size; 408 | 409 | 410 | 411 | public void Execute(int index) 412 | { 413 | noiseMap[index] = FinalNoise(new float3(index / (size * size), index / size % size, index % size)); 414 | } 415 | float FinalNoise(float3 pos) 416 | { 417 | float value = 0f; 418 | if (SurfaceNoise2D(pos.x, pos.z) > pos.y + offset.y - surfaceLevel && SurfaceNoise2D(pos.x + seed.x, pos.z + seed.z) > -pos.y - offset.y - surfaceLevel) 419 | { 420 | value = 1f; 421 | value -= PerlinNoise3D(pos.x, pos.y, pos.z); 422 | if (value < 1f) 423 | { 424 | value += PerlinNoise3DSnake(pos.x, pos.y, pos.z); 425 | } 426 | } 427 | value = -value; 428 | return value; 429 | } 430 | float PerlinNoise3D(float x, float y, float z) 431 | { 432 | float total = 0; 433 | var ampl = this.ampl; 434 | var freq = this.freq; 435 | for (int i = 0; i < oct; i++) 436 | { 437 | total += noise.snoise(math.float3((x + offset.x + seed.x) * freq, (y + offset.y + seed.y) * freq, (z + offset.z + seed.z) * freq) * ampl); 438 | 439 | ampl *= 2; 440 | freq *= 0.5f; 441 | } 442 | total -= total % 2.5f; 443 | return total; 444 | } 445 | float PerlinNoise3DSnake(float x, float y, float z) 446 | { 447 | float total = 0; 448 | var ampl = this.ampl; 449 | var freq = this.freq + 0.03f; 450 | for (int i = 0; i < oct; i++) 451 | { 452 | total += noise.snoise(math.float3((x + offset.x + seed.x) * freq, (y + offset.y + seed.y) * freq, (z + offset.z + seed.z) * freq) * ampl); 453 | 454 | ampl *= 2; 455 | freq *= 0.5f; 456 | } 457 | total -= total % 2.5f; 458 | return total; 459 | } 460 | float SurfaceNoise2D(float x, float z) 461 | { 462 | float total = 0; 463 | var ampl = this.ampl; 464 | var freq = this.freq; 465 | for (int i = 0; i < oct; i++) 466 | { 467 | total += noise.snoise(math.float2((x + offset.x + seed.x) * freq, (z + offset.z + seed.z) * freq) * ampl); 468 | 469 | ampl *= 2; 470 | freq *= 0.5f; 471 | } 472 | total = total % 5f; 473 | return total; 474 | } 475 | } 476 | //Tables used for marching cubes. Taken from https://github.com/Eldemarkki/Marching-Cubes-Terrain 477 | internal class Tables 478 | { 479 | /// 480 | /// Lookup table for how the edges should be connected 481 | /// 482 | public static readonly int[] EdgeIndexTable = 483 | { 484 | 0, 1, 485 | 1, 2, 486 | 2, 3, 487 | 3, 0, 488 | 4, 5, 489 | 5, 6, 490 | 6, 7, 491 | 7, 4, 492 | 0, 4, 493 | 1, 5, 494 | 2, 6, 495 | 3, 7 496 | }; 497 | 498 | /// 499 | /// The corners of a voxel 500 | /// 501 | public static readonly int3[] CubeCorners = 502 | { 503 | new int3(0, 0, 0), 504 | new int3(1, 0, 0), 505 | new int3(1, 0, 1), 506 | new int3(0, 0, 1), 507 | new int3(0, 1, 0), 508 | new int3(1, 1, 0), 509 | new int3(1, 1, 1), 510 | new int3(0, 1, 1) 511 | }; 512 | 513 | /// 514 | /// The edge table for the marching cubes. Used to determine which edges are intersected by the isosurface 515 | /// 516 | public static readonly int[] EdgeTable = 517 | { 518 | 0x0, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 519 | 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 520 | 0x190, 0x99, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 521 | 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 522 | 0x230, 0x339, 0x33, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 523 | 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 524 | 0x3a0, 0x2a9, 0x1a3, 0xaa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 525 | 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 526 | 0x460, 0x569, 0x663, 0x76a, 0x66, 0x16f, 0x265, 0x36c, 527 | 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 528 | 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0xff, 0x3f5, 0x2fc, 529 | 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 530 | 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x55, 0x15c, 531 | 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 532 | 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0xcc, 533 | 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 534 | 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 535 | 0xcc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 536 | 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 537 | 0x15c, 0x55, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 538 | 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 539 | 0x2fc, 0x3f5, 0xff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 540 | 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 541 | 0x36c, 0x265, 0x16f, 0x66, 0x76a, 0x663, 0x569, 0x460, 542 | 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 543 | 0x4ac, 0x5a5, 0x6af, 0x7a6, 0xaa, 0x1a3, 0x2a9, 0x3a0, 544 | 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 545 | 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x33, 0x339, 0x230, 546 | 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 547 | 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x99, 0x190, 548 | 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 549 | 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x0 550 | }; 551 | 552 | /// 553 | /// The triangle table for the marching cubes algorithm. Used to determine how the faces should be connected. 554 | /// 555 | public static readonly int[] TriangleTable = 556 | { 557 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 558 | 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 559 | 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 560 | 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 561 | 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 562 | 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 563 | 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, 564 | 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, 565 | 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 566 | 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567 | 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 568 | 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, 569 | 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 570 | 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, 571 | 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, 572 | 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 573 | 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 574 | 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 575 | 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 576 | 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, 577 | 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 578 | 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, 579 | 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, 580 | 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, 581 | 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 582 | 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, 583 | 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, 584 | 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, 585 | 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, 586 | 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, 587 | 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, 588 | 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, 589 | 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 590 | 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 591 | 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 592 | 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, 593 | 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 594 | 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, 595 | 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, 596 | 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, 597 | 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 598 | 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, 599 | 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, 600 | 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, 601 | 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, 602 | 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, 603 | 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, 604 | 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, 605 | 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, 606 | 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, 607 | 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, 608 | 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 609 | 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, 610 | 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, 611 | 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, 612 | 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, 613 | 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, 614 | 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, 615 | 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, 616 | 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, 617 | 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, 618 | 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, 619 | 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, 620 | 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 621 | 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 622 | 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 623 | 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 624 | 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, 625 | 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 626 | 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, 627 | 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, 628 | 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, 629 | 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 630 | 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, 631 | 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, 632 | 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, 633 | 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, 634 | 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, 635 | 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, 636 | 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, 637 | 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, 638 | 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, 639 | 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, 640 | 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, 641 | 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, 642 | 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, 643 | 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, 644 | 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, 645 | 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, 646 | 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, 647 | 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, 648 | 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, 649 | 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, 650 | 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, 651 | 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, 652 | 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, 653 | 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 654 | 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, 655 | 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, 656 | 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, 657 | 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, 658 | 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, 659 | 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 660 | 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, 661 | 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, 662 | 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, 663 | 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, 664 | 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, 665 | 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, 666 | 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, 667 | 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, 668 | 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, 669 | 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, 670 | 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, 671 | 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, 672 | 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, 673 | 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, 674 | 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, 675 | 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, 676 | 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 677 | 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, 678 | 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, 679 | 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, 680 | 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, 681 | 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, 682 | 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 683 | 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, 684 | 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 685 | 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 686 | 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 687 | 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 688 | 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, 689 | 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 690 | 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, 691 | 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, 692 | 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, 693 | 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 694 | 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, 695 | 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, 696 | 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, 697 | 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, 698 | 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, 699 | 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, 700 | 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, 701 | 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 702 | 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, 703 | 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, 704 | 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, 705 | 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, 706 | 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, 707 | 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, 708 | 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, 709 | 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, 710 | 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 711 | 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, 712 | 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, 713 | 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, 714 | 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, 715 | 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, 716 | 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 717 | 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 718 | 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, 719 | 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, 720 | 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, 721 | 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, 722 | 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, 723 | 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, 724 | 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, 725 | 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, 726 | 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, 727 | 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, 728 | 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, 729 | 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, 730 | 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, 731 | 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, 732 | 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, 733 | 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, 734 | 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, 735 | 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, 736 | 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, 737 | 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, 738 | 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, 739 | 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, 740 | 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, 741 | 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, 742 | 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, 743 | 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, 744 | 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, 745 | 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, 746 | 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, 747 | 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 748 | 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 749 | 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 750 | 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, 751 | 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, 752 | 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, 753 | 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, 754 | 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, 755 | 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, 756 | 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, 757 | 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, 758 | 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, 759 | 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, 760 | 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, 761 | 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 762 | 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, 763 | 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, 764 | 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 765 | 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, 766 | 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, 767 | 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, 768 | 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, 769 | 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, 770 | 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, 771 | 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, 772 | 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 773 | 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, 774 | 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, 775 | 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, 776 | 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, 777 | 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, 778 | 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, 779 | 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, 780 | 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 781 | 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, 782 | 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, 783 | 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, 784 | 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, 785 | 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, 786 | 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, 787 | 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, 788 | 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, 789 | 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, 790 | 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, 791 | 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, 792 | 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 793 | 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, 794 | 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, 795 | 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, 796 | 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 797 | 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, 798 | 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, 799 | 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, 800 | 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, 801 | 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, 802 | 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, 803 | 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, 804 | 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 805 | 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, 806 | 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 807 | 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, 808 | 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 809 | 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, 810 | 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 811 | 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 812 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 813 | }; 814 | } 815 | } 816 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/Utils/WorldBase.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e25549ee90b4baf45a2fd74823e98e63 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/WorldMat.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: WorldMat 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _BumpScale: 1 60 | - _Cutoff: 0.5 61 | - _DetailNormalMapScale: 1 62 | - _DstBlend: 0 63 | - _GlossMapScale: 1 64 | - _Glossiness: 0.5 65 | - _GlossyReflections: 1 66 | - _Metallic: 0 67 | - _Mode: 0 68 | - _OcclusionStrength: 1 69 | - _Parallax: 0.02 70 | - _SmoothnessTextureChannel: 0 71 | - _SpecularHighlights: 1 72 | - _SrcBlend: 1 73 | - _UVSec: 0 74 | - _ZWrite: 1 75 | m_Colors: 76 | - _Color: {r: 0.42087683, g: 0.5754717, b: 0.3990299, a: 1} 77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 78 | -------------------------------------------------------------------------------- /Assets/Terrain Generation/WorldMat.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27178c7fa1d86eb41b535327d6674cf6 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Fobri 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.collab-proxy": "1.2.16", 4 | "com.unity.ide.rider": "1.1.4", 5 | "com.unity.ide.vscode": "1.2.0", 6 | "com.unity.jobs": "0.2.9-preview.15", 7 | "com.unity.test-framework": "1.1.14", 8 | "com.unity.textmeshpro": "2.0.1", 9 | "com.unity.timeline": "1.2.6", 10 | "com.unity.ugui": "1.0.0", 11 | "com.unity.modules.ai": "1.0.0", 12 | "com.unity.modules.androidjni": "1.0.0", 13 | "com.unity.modules.animation": "1.0.0", 14 | "com.unity.modules.assetbundle": "1.0.0", 15 | "com.unity.modules.audio": "1.0.0", 16 | "com.unity.modules.cloth": "1.0.0", 17 | "com.unity.modules.director": "1.0.0", 18 | "com.unity.modules.imageconversion": "1.0.0", 19 | "com.unity.modules.imgui": "1.0.0", 20 | "com.unity.modules.jsonserialize": "1.0.0", 21 | "com.unity.modules.particlesystem": "1.0.0", 22 | "com.unity.modules.physics": "1.0.0", 23 | "com.unity.modules.physics2d": "1.0.0", 24 | "com.unity.modules.screencapture": "1.0.0", 25 | "com.unity.modules.terrain": "1.0.0", 26 | "com.unity.modules.terrainphysics": "1.0.0", 27 | "com.unity.modules.tilemap": "1.0.0", 28 | "com.unity.modules.ui": "1.0.0", 29 | "com.unity.modules.uielements": "1.0.0", 30 | "com.unity.modules.umbra": "1.0.0", 31 | "com.unity.modules.unityanalytics": "1.0.0", 32 | "com.unity.modules.unitywebrequest": "1.0.0", 33 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 34 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 35 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 36 | "com.unity.modules.unitywebrequestwww": "1.0.0", 37 | "com.unity.modules.vehicles": "1.0.0", 38 | "com.unity.modules.video": "1.0.0", 39 | "com.unity.modules.vr": "1.0.0", 40 | "com.unity.modules.wind": "1.0.0", 41 | "com.unity.modules.xr": "1.0.0" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 1024 20 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 11 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | m_FrictionType: 0 32 | m_EnableEnhancedDeterminism: 0 33 | m_EnableUnifiedHeightmaps: 1 34 | m_DefaultMaxAngluarSpeed: 7 35 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: [] 8 | m_configObjects: {} 9 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 9 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_PrefabRegularEnvironment: {fileID: 0} 12 | m_PrefabUIEnvironment: {fileID: 0} 13 | m_SpritePackerMode: 0 14 | m_SpritePackerPaddingPower: 1 15 | m_EtcTextureCompressorBehavior: 1 16 | m_EtcTextureFastCompressor: 1 17 | m_EtcTextureNormalCompressor: 2 18 | m_EtcTextureBestCompressor: 4 19 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref 20 | m_ProjectGenerationRootNamespace: 21 | m_CollabEditorSettings: 22 | inProgressEnabled: 1 23 | m_EnableTextureStreamingInEditMode: 1 24 | m_EnableTextureStreamingInPlayMode: 1 25 | m_AsyncShaderCompilation: 1 26 | m_EnterPlayModeOptionsEnabled: 0 27 | m_EnterPlayModeOptions: 3 28 | m_ShowLightmapResolutionOverlay: 1 29 | m_UseLegacyProbeSampleCount: 1 30 | m_AssetPipelineMode: 1 31 | m_CacheServerMode: 0 32 | m_CacheServerEndpoint: 33 | m_CacheServerNamespacePrefix: default 34 | m_CacheServerEnableDownload: 1 35 | m_CacheServerEnableUpload: 1 36 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_AlwaysIncludedShaders: 32 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 33 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 38 | m_PreloadedShaders: [] 39 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 40 | type: 0} 41 | m_CustomRenderPipeline: {fileID: 0} 42 | m_TransparencySortMode: 0 43 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 44 | m_DefaultRenderingPath: 1 45 | m_DefaultMobileRenderingPath: 1 46 | m_TierSettings: [] 47 | m_LightmapStripping: 0 48 | m_FogStripping: 0 49 | m_InstancingStripping: 0 50 | m_LightmapKeepPlain: 1 51 | m_LightmapKeepDirCombined: 1 52 | m_LightmapKeepDynamicPlain: 1 53 | m_LightmapKeepDynamicDirCombined: 1 54 | m_LightmapKeepShadowMask: 1 55 | m_LightmapKeepSubtractive: 1 56 | m_FogKeepLinear: 1 57 | m_FogKeepExp: 1 58 | m_FogKeepExp2: 1 59 | m_AlbedoSwatchInfos: [] 60 | m_LightsUseLinearIntensity: 0 61 | m_LightsUseColorTemperature: 0 62 | m_LogWhenShaderIsCompiled: 0 63 | m_AllowEnlightenSupportForUpgradedProject: 0 64 | -------------------------------------------------------------------------------- /ProjectSettings/InputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!13 &1 4 | InputManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Axes: 8 | - serializedVersion: 3 9 | m_Name: Horizontal 10 | descriptiveName: 11 | descriptiveNegativeName: 12 | negativeButton: left 13 | positiveButton: right 14 | altNegativeButton: a 15 | altPositiveButton: d 16 | gravity: 3 17 | dead: 0.001 18 | sensitivity: 3 19 | snap: 1 20 | invert: 0 21 | type: 0 22 | axis: 0 23 | joyNum: 0 24 | - serializedVersion: 3 25 | m_Name: Vertical 26 | descriptiveName: 27 | descriptiveNegativeName: 28 | negativeButton: down 29 | positiveButton: up 30 | altNegativeButton: s 31 | altPositiveButton: w 32 | gravity: 3 33 | dead: 0.001 34 | sensitivity: 3 35 | snap: 1 36 | invert: 0 37 | type: 0 38 | axis: 0 39 | joyNum: 0 40 | - serializedVersion: 3 41 | m_Name: Fire1 42 | descriptiveName: 43 | descriptiveNegativeName: 44 | negativeButton: 45 | positiveButton: left ctrl 46 | altNegativeButton: 47 | altPositiveButton: mouse 0 48 | gravity: 1000 49 | dead: 0.001 50 | sensitivity: 1000 51 | snap: 0 52 | invert: 0 53 | type: 0 54 | axis: 0 55 | joyNum: 0 56 | - serializedVersion: 3 57 | m_Name: Fire2 58 | descriptiveName: 59 | descriptiveNegativeName: 60 | negativeButton: 61 | positiveButton: left alt 62 | altNegativeButton: 63 | altPositiveButton: mouse 1 64 | gravity: 1000 65 | dead: 0.001 66 | sensitivity: 1000 67 | snap: 0 68 | invert: 0 69 | type: 0 70 | axis: 0 71 | joyNum: 0 72 | - serializedVersion: 3 73 | m_Name: Fire3 74 | descriptiveName: 75 | descriptiveNegativeName: 76 | negativeButton: 77 | positiveButton: left shift 78 | altNegativeButton: 79 | altPositiveButton: mouse 2 80 | gravity: 1000 81 | dead: 0.001 82 | sensitivity: 1000 83 | snap: 0 84 | invert: 0 85 | type: 0 86 | axis: 0 87 | joyNum: 0 88 | - serializedVersion: 3 89 | m_Name: Jump 90 | descriptiveName: 91 | descriptiveNegativeName: 92 | negativeButton: 93 | positiveButton: space 94 | altNegativeButton: 95 | altPositiveButton: 96 | gravity: 1000 97 | dead: 0.001 98 | sensitivity: 1000 99 | snap: 0 100 | invert: 0 101 | type: 0 102 | axis: 0 103 | joyNum: 0 104 | - serializedVersion: 3 105 | m_Name: Mouse X 106 | descriptiveName: 107 | descriptiveNegativeName: 108 | negativeButton: 109 | positiveButton: 110 | altNegativeButton: 111 | altPositiveButton: 112 | gravity: 0 113 | dead: 0 114 | sensitivity: 0.1 115 | snap: 0 116 | invert: 0 117 | type: 1 118 | axis: 0 119 | joyNum: 0 120 | - serializedVersion: 3 121 | m_Name: Mouse Y 122 | descriptiveName: 123 | descriptiveNegativeName: 124 | negativeButton: 125 | positiveButton: 126 | altNegativeButton: 127 | altPositiveButton: 128 | gravity: 0 129 | dead: 0 130 | sensitivity: 0.1 131 | snap: 0 132 | invert: 0 133 | type: 1 134 | axis: 1 135 | joyNum: 0 136 | - serializedVersion: 3 137 | m_Name: Mouse ScrollWheel 138 | descriptiveName: 139 | descriptiveNegativeName: 140 | negativeButton: 141 | positiveButton: 142 | altNegativeButton: 143 | altPositiveButton: 144 | gravity: 0 145 | dead: 0 146 | sensitivity: 0.1 147 | snap: 0 148 | invert: 0 149 | type: 1 150 | axis: 2 151 | joyNum: 0 152 | - serializedVersion: 3 153 | m_Name: Horizontal 154 | descriptiveName: 155 | descriptiveNegativeName: 156 | negativeButton: 157 | positiveButton: 158 | altNegativeButton: 159 | altPositiveButton: 160 | gravity: 0 161 | dead: 0.19 162 | sensitivity: 1 163 | snap: 0 164 | invert: 0 165 | type: 2 166 | axis: 0 167 | joyNum: 0 168 | - serializedVersion: 3 169 | m_Name: Vertical 170 | descriptiveName: 171 | descriptiveNegativeName: 172 | negativeButton: 173 | positiveButton: 174 | altNegativeButton: 175 | altPositiveButton: 176 | gravity: 0 177 | dead: 0.19 178 | sensitivity: 1 179 | snap: 0 180 | invert: 1 181 | type: 2 182 | axis: 1 183 | joyNum: 0 184 | - serializedVersion: 3 185 | m_Name: Fire1 186 | descriptiveName: 187 | descriptiveNegativeName: 188 | negativeButton: 189 | positiveButton: joystick button 0 190 | altNegativeButton: 191 | altPositiveButton: 192 | gravity: 1000 193 | dead: 0.001 194 | sensitivity: 1000 195 | snap: 0 196 | invert: 0 197 | type: 0 198 | axis: 0 199 | joyNum: 0 200 | - serializedVersion: 3 201 | m_Name: Fire2 202 | descriptiveName: 203 | descriptiveNegativeName: 204 | negativeButton: 205 | positiveButton: joystick button 1 206 | altNegativeButton: 207 | altPositiveButton: 208 | gravity: 1000 209 | dead: 0.001 210 | sensitivity: 1000 211 | snap: 0 212 | invert: 0 213 | type: 0 214 | axis: 0 215 | joyNum: 0 216 | - serializedVersion: 3 217 | m_Name: Fire3 218 | descriptiveName: 219 | descriptiveNegativeName: 220 | negativeButton: 221 | positiveButton: joystick button 2 222 | altNegativeButton: 223 | altPositiveButton: 224 | gravity: 1000 225 | dead: 0.001 226 | sensitivity: 1000 227 | snap: 0 228 | invert: 0 229 | type: 0 230 | axis: 0 231 | joyNum: 0 232 | - serializedVersion: 3 233 | m_Name: Jump 234 | descriptiveName: 235 | descriptiveNegativeName: 236 | negativeButton: 237 | positiveButton: joystick button 3 238 | altNegativeButton: 239 | altPositiveButton: 240 | gravity: 1000 241 | dead: 0.001 242 | sensitivity: 1000 243 | snap: 0 244 | invert: 0 245 | type: 0 246 | axis: 0 247 | joyNum: 0 248 | - serializedVersion: 3 249 | m_Name: Submit 250 | descriptiveName: 251 | descriptiveNegativeName: 252 | negativeButton: 253 | positiveButton: return 254 | altNegativeButton: 255 | altPositiveButton: joystick button 0 256 | gravity: 1000 257 | dead: 0.001 258 | sensitivity: 1000 259 | snap: 0 260 | invert: 0 261 | type: 0 262 | axis: 0 263 | joyNum: 0 264 | - serializedVersion: 3 265 | m_Name: Submit 266 | descriptiveName: 267 | descriptiveNegativeName: 268 | negativeButton: 269 | positiveButton: enter 270 | altNegativeButton: 271 | altPositiveButton: space 272 | gravity: 1000 273 | dead: 0.001 274 | sensitivity: 1000 275 | snap: 0 276 | invert: 0 277 | type: 0 278 | axis: 0 279 | joyNum: 0 280 | - serializedVersion: 3 281 | m_Name: Cancel 282 | descriptiveName: 283 | descriptiveNegativeName: 284 | negativeButton: 285 | positiveButton: escape 286 | altNegativeButton: 287 | altPositiveButton: joystick button 1 288 | gravity: 1000 289 | dead: 0.001 290 | sensitivity: 1000 291 | snap: 0 292 | invert: 0 293 | type: 0 294 | axis: 0 295 | joyNum: 0 296 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /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: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!129 &1 4 | PlayerSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 20 7 | productGUID: 18976aa89cb214941bcb93d24c6866ba 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: Marching Cubes Fast 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosUseCustomAppBackgroundBehavior: 0 56 | iosAllowHTTPDownload: 1 57 | allowedAutorotateToPortrait: 1 58 | allowedAutorotateToPortraitUpsideDown: 1 59 | allowedAutorotateToLandscapeRight: 1 60 | allowedAutorotateToLandscapeLeft: 1 61 | useOSAutorotation: 1 62 | use32BitDisplayBuffer: 1 63 | preserveFramebufferAlpha: 0 64 | disableDepthAndStencilBuffers: 0 65 | androidStartInFullscreen: 1 66 | androidRenderOutsideSafeArea: 1 67 | androidUseSwappy: 0 68 | androidBlitType: 0 69 | defaultIsNativeResolution: 1 70 | macRetinaSupport: 1 71 | runInBackground: 1 72 | captureSingleScreen: 0 73 | muteOtherAudioSources: 0 74 | Prepare IOS For Recording: 0 75 | Force IOS Speakers When Recording: 0 76 | deferSystemGesturesMode: 0 77 | hideHomeButton: 0 78 | submitAnalytics: 1 79 | usePlayerLog: 1 80 | bakeCollisionMeshes: 0 81 | forceSingleInstance: 0 82 | useFlipModelSwapchain: 1 83 | resizableWindow: 0 84 | useMacAppStoreValidation: 0 85 | macAppStoreCategory: public.app-category.games 86 | gpuSkinning: 1 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 1 93 | allowFullscreenSwitch: 1 94 | fullscreenMode: 1 95 | xboxSpeechDB: 0 96 | xboxEnableHeadOrientation: 0 97 | xboxEnableGuest: 0 98 | xboxEnablePIXSampling: 0 99 | metalFramebufferOnly: 0 100 | xboxOneResolution: 0 101 | xboxOneSResolution: 0 102 | xboxOneXResolution: 3 103 | xboxOneMonoLoggingLevel: 0 104 | xboxOneLoggingLevel: 1 105 | xboxOneDisableEsram: 0 106 | xboxOnePresentImmediateThreshold: 0 107 | switchQueueCommandMemory: 0 108 | switchQueueControlMemory: 16384 109 | switchQueueComputeMemory: 262144 110 | switchNVNShaderPoolsGranularity: 33554432 111 | switchNVNDefaultPoolsGranularity: 16777216 112 | switchNVNOtherPoolsGranularity: 16777216 113 | vulkanNumSwapchainBuffers: 3 114 | vulkanEnableSetSRGBWrite: 0 115 | m_SupportedAspectRatios: 116 | 4:3: 1 117 | 5:4: 1 118 | 16:10: 1 119 | 16:9: 1 120 | Others: 1 121 | bundleVersion: 0.1 122 | preloadedAssets: [] 123 | metroInputSource: 0 124 | wsaTransparentSwapchain: 0 125 | m_HolographicPauseOnTrackingLoss: 1 126 | xboxOneDisableKinectGpuReservation: 1 127 | xboxOneEnable7thCore: 1 128 | vrSettings: 129 | cardboard: 130 | depthFormat: 0 131 | enableTransitionView: 0 132 | daydream: 133 | depthFormat: 0 134 | useSustainedPerformanceMode: 0 135 | enableVideoLayer: 0 136 | useProtectedVideoMemory: 0 137 | minimumSupportedHeadTracking: 0 138 | maximumSupportedHeadTracking: 1 139 | hololens: 140 | depthFormat: 1 141 | depthBufferSharingEnabled: 1 142 | lumin: 143 | depthFormat: 0 144 | frameTiming: 2 145 | enableGLCache: 0 146 | glCacheMaxBlobSize: 524288 147 | glCacheMaxFileSize: 8388608 148 | oculus: 149 | sharedDepthBuffer: 1 150 | dashSupport: 1 151 | lowOverheadMode: 0 152 | protectedContext: 0 153 | v2Signing: 1 154 | enable360StereoCapture: 0 155 | isWsaHolographicRemotingEnabled: 0 156 | enableFrameTimingStats: 0 157 | useHDRDisplay: 0 158 | D3DHDRBitDepth: 0 159 | m_ColorGamuts: 00000000 160 | targetPixelDensity: 30 161 | resolutionScalingMode: 0 162 | androidSupportedAspectRatio: 1 163 | androidMaxAspectRatio: 2.1 164 | applicationIdentifier: {} 165 | buildNumber: {} 166 | AndroidBundleVersionCode: 1 167 | AndroidMinSdkVersion: 19 168 | AndroidTargetSdkVersion: 0 169 | AndroidPreferredInstallLocation: 1 170 | aotOptions: 171 | stripEngineCode: 1 172 | iPhoneStrippingLevel: 0 173 | iPhoneScriptCallOptimization: 0 174 | ForceInternetPermission: 0 175 | ForceSDCardPermission: 0 176 | CreateWallpaper: 0 177 | APKExpansionFiles: 0 178 | keepLoadedShadersAlive: 0 179 | StripUnusedMeshComponents: 1 180 | VertexChannelCompressionMask: 4054 181 | iPhoneSdkVersion: 988 182 | iOSTargetOSVersionString: 10.0 183 | tvOSSdkVersion: 0 184 | tvOSRequireExtendedGameController: 0 185 | tvOSTargetOSVersionString: 10.0 186 | uIPrerenderedIcon: 0 187 | uIRequiresPersistentWiFi: 0 188 | uIRequiresFullScreen: 1 189 | uIStatusBarHidden: 1 190 | uIExitOnSuspend: 0 191 | uIStatusBarStyle: 0 192 | iPhoneSplashScreen: {fileID: 0} 193 | iPhoneHighResSplashScreen: {fileID: 0} 194 | iPhoneTallHighResSplashScreen: {fileID: 0} 195 | iPhone47inSplashScreen: {fileID: 0} 196 | iPhone55inPortraitSplashScreen: {fileID: 0} 197 | iPhone55inLandscapeSplashScreen: {fileID: 0} 198 | iPhone58inPortraitSplashScreen: {fileID: 0} 199 | iPhone58inLandscapeSplashScreen: {fileID: 0} 200 | iPadPortraitSplashScreen: {fileID: 0} 201 | iPadHighResPortraitSplashScreen: {fileID: 0} 202 | iPadLandscapeSplashScreen: {fileID: 0} 203 | iPadHighResLandscapeSplashScreen: {fileID: 0} 204 | iPhone65inPortraitSplashScreen: {fileID: 0} 205 | iPhone65inLandscapeSplashScreen: {fileID: 0} 206 | iPhone61inPortraitSplashScreen: {fileID: 0} 207 | iPhone61inLandscapeSplashScreen: {fileID: 0} 208 | appleTVSplashScreen: {fileID: 0} 209 | appleTVSplashScreen2x: {fileID: 0} 210 | tvOSSmallIconLayers: [] 211 | tvOSSmallIconLayers2x: [] 212 | tvOSLargeIconLayers: [] 213 | tvOSLargeIconLayers2x: [] 214 | tvOSTopShelfImageLayers: [] 215 | tvOSTopShelfImageLayers2x: [] 216 | tvOSTopShelfImageWideLayers: [] 217 | tvOSTopShelfImageWideLayers2x: [] 218 | iOSLaunchScreenType: 0 219 | iOSLaunchScreenPortrait: {fileID: 0} 220 | iOSLaunchScreenLandscape: {fileID: 0} 221 | iOSLaunchScreenBackgroundColor: 222 | serializedVersion: 2 223 | rgba: 0 224 | iOSLaunchScreenFillPct: 100 225 | iOSLaunchScreenSize: 100 226 | iOSLaunchScreenCustomXibPath: 227 | iOSLaunchScreeniPadType: 0 228 | iOSLaunchScreeniPadImage: {fileID: 0} 229 | iOSLaunchScreeniPadBackgroundColor: 230 | serializedVersion: 2 231 | rgba: 0 232 | iOSLaunchScreeniPadFillPct: 100 233 | iOSLaunchScreeniPadSize: 100 234 | iOSLaunchScreeniPadCustomXibPath: 235 | iOSUseLaunchScreenStoryboard: 0 236 | iOSLaunchScreenCustomStoryboardPath: 237 | iOSDeviceRequirements: [] 238 | iOSURLSchemes: [] 239 | iOSBackgroundModes: 0 240 | iOSMetalForceHardShadows: 0 241 | metalEditorSupport: 1 242 | metalAPIValidation: 1 243 | iOSRenderExtraFrameOnPause: 0 244 | appleDeveloperTeamID: 245 | iOSManualSigningProvisioningProfileID: 246 | tvOSManualSigningProvisioningProfileID: 247 | iOSManualSigningProvisioningProfileType: 0 248 | tvOSManualSigningProvisioningProfileType: 0 249 | appleEnableAutomaticSigning: 0 250 | iOSRequireARKit: 0 251 | iOSAutomaticallyDetectAndAddCapabilities: 1 252 | appleEnableProMotion: 0 253 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 254 | templatePackageId: com.unity.template.3d@4.2.5 255 | templateDefaultScene: Assets/Scenes/SampleScene.unity 256 | AndroidTargetArchitectures: 1 257 | AndroidSplashScreenScale: 0 258 | androidSplashScreen: {fileID: 0} 259 | AndroidKeystoreName: 260 | AndroidKeyaliasName: 261 | AndroidBuildApkPerCpuArchitecture: 0 262 | AndroidTVCompatibility: 0 263 | AndroidIsGame: 1 264 | AndroidEnableTango: 0 265 | androidEnableBanner: 1 266 | androidUseLowAccuracyLocation: 0 267 | androidUseCustomKeystore: 0 268 | m_AndroidBanners: 269 | - width: 320 270 | height: 180 271 | banner: {fileID: 0} 272 | androidGamepadSupportLevel: 0 273 | AndroidValidateAppBundleSize: 1 274 | AndroidAppBundleSizeToValidate: 150 275 | m_BuildTargetIcons: [] 276 | m_BuildTargetPlatformIcons: [] 277 | m_BuildTargetBatching: 278 | - m_BuildTarget: Standalone 279 | m_StaticBatching: 1 280 | m_DynamicBatching: 0 281 | - m_BuildTarget: tvOS 282 | m_StaticBatching: 1 283 | m_DynamicBatching: 0 284 | - m_BuildTarget: Android 285 | m_StaticBatching: 1 286 | m_DynamicBatching: 0 287 | - m_BuildTarget: iPhone 288 | m_StaticBatching: 1 289 | m_DynamicBatching: 0 290 | - m_BuildTarget: WebGL 291 | m_StaticBatching: 0 292 | m_DynamicBatching: 0 293 | m_BuildTargetGraphicsJobs: 294 | - m_BuildTarget: MacStandaloneSupport 295 | m_GraphicsJobs: 0 296 | - m_BuildTarget: Switch 297 | m_GraphicsJobs: 1 298 | - m_BuildTarget: MetroSupport 299 | m_GraphicsJobs: 1 300 | - m_BuildTarget: AppleTVSupport 301 | m_GraphicsJobs: 0 302 | - m_BuildTarget: BJMSupport 303 | m_GraphicsJobs: 1 304 | - m_BuildTarget: LinuxStandaloneSupport 305 | m_GraphicsJobs: 1 306 | - m_BuildTarget: PS4Player 307 | m_GraphicsJobs: 1 308 | - m_BuildTarget: iOSSupport 309 | m_GraphicsJobs: 0 310 | - m_BuildTarget: WindowsStandaloneSupport 311 | m_GraphicsJobs: 1 312 | - m_BuildTarget: XboxOnePlayer 313 | m_GraphicsJobs: 1 314 | - m_BuildTarget: LuminSupport 315 | m_GraphicsJobs: 0 316 | - m_BuildTarget: AndroidPlayer 317 | m_GraphicsJobs: 0 318 | - m_BuildTarget: WebGLSupport 319 | m_GraphicsJobs: 0 320 | m_BuildTargetGraphicsJobMode: 321 | - m_BuildTarget: PS4Player 322 | m_GraphicsJobMode: 0 323 | - m_BuildTarget: XboxOnePlayer 324 | m_GraphicsJobMode: 0 325 | m_BuildTargetGraphicsAPIs: 326 | - m_BuildTarget: AndroidPlayer 327 | m_APIs: 150000000b000000 328 | m_Automatic: 0 329 | - m_BuildTarget: iOSSupport 330 | m_APIs: 10000000 331 | m_Automatic: 1 332 | - m_BuildTarget: AppleTVSupport 333 | m_APIs: 10000000 334 | m_Automatic: 0 335 | - m_BuildTarget: WebGLSupport 336 | m_APIs: 0b000000 337 | m_Automatic: 1 338 | m_BuildTargetVRSettings: 339 | - m_BuildTarget: Standalone 340 | m_Enabled: 0 341 | m_Devices: 342 | - Oculus 343 | - OpenVR 344 | openGLRequireES31: 0 345 | openGLRequireES31AEP: 0 346 | openGLRequireES32: 0 347 | m_TemplateCustomTags: {} 348 | mobileMTRendering: 349 | Android: 1 350 | iPhone: 1 351 | tvOS: 1 352 | m_BuildTargetGroupLightmapEncodingQuality: [] 353 | m_BuildTargetGroupLightmapSettings: [] 354 | playModeTestRunnerEnabled: 0 355 | runPlayModeTestAsEditModeTest: 0 356 | actionOnDotNetUnhandledException: 1 357 | enableInternalProfiler: 0 358 | logObjCUncaughtExceptions: 1 359 | enableCrashReportAPI: 0 360 | cameraUsageDescription: 361 | locationUsageDescription: 362 | microphoneUsageDescription: 363 | switchNetLibKey: 364 | switchSocketMemoryPoolSize: 6144 365 | switchSocketAllocatorPoolSize: 128 366 | switchSocketConcurrencyLimit: 14 367 | switchScreenResolutionBehavior: 2 368 | switchUseCPUProfiler: 0 369 | switchApplicationID: 0x01004b9000490000 370 | switchNSODependencies: 371 | switchTitleNames_0: 372 | switchTitleNames_1: 373 | switchTitleNames_2: 374 | switchTitleNames_3: 375 | switchTitleNames_4: 376 | switchTitleNames_5: 377 | switchTitleNames_6: 378 | switchTitleNames_7: 379 | switchTitleNames_8: 380 | switchTitleNames_9: 381 | switchTitleNames_10: 382 | switchTitleNames_11: 383 | switchTitleNames_12: 384 | switchTitleNames_13: 385 | switchTitleNames_14: 386 | switchPublisherNames_0: 387 | switchPublisherNames_1: 388 | switchPublisherNames_2: 389 | switchPublisherNames_3: 390 | switchPublisherNames_4: 391 | switchPublisherNames_5: 392 | switchPublisherNames_6: 393 | switchPublisherNames_7: 394 | switchPublisherNames_8: 395 | switchPublisherNames_9: 396 | switchPublisherNames_10: 397 | switchPublisherNames_11: 398 | switchPublisherNames_12: 399 | switchPublisherNames_13: 400 | switchPublisherNames_14: 401 | switchIcons_0: {fileID: 0} 402 | switchIcons_1: {fileID: 0} 403 | switchIcons_2: {fileID: 0} 404 | switchIcons_3: {fileID: 0} 405 | switchIcons_4: {fileID: 0} 406 | switchIcons_5: {fileID: 0} 407 | switchIcons_6: {fileID: 0} 408 | switchIcons_7: {fileID: 0} 409 | switchIcons_8: {fileID: 0} 410 | switchIcons_9: {fileID: 0} 411 | switchIcons_10: {fileID: 0} 412 | switchIcons_11: {fileID: 0} 413 | switchIcons_12: {fileID: 0} 414 | switchIcons_13: {fileID: 0} 415 | switchIcons_14: {fileID: 0} 416 | switchSmallIcons_0: {fileID: 0} 417 | switchSmallIcons_1: {fileID: 0} 418 | switchSmallIcons_2: {fileID: 0} 419 | switchSmallIcons_3: {fileID: 0} 420 | switchSmallIcons_4: {fileID: 0} 421 | switchSmallIcons_5: {fileID: 0} 422 | switchSmallIcons_6: {fileID: 0} 423 | switchSmallIcons_7: {fileID: 0} 424 | switchSmallIcons_8: {fileID: 0} 425 | switchSmallIcons_9: {fileID: 0} 426 | switchSmallIcons_10: {fileID: 0} 427 | switchSmallIcons_11: {fileID: 0} 428 | switchSmallIcons_12: {fileID: 0} 429 | switchSmallIcons_13: {fileID: 0} 430 | switchSmallIcons_14: {fileID: 0} 431 | switchManualHTML: 432 | switchAccessibleURLs: 433 | switchLegalInformation: 434 | switchMainThreadStackSize: 1048576 435 | switchPresenceGroupId: 436 | switchLogoHandling: 0 437 | switchReleaseVersion: 0 438 | switchDisplayVersion: 1.0.0 439 | switchStartupUserAccount: 0 440 | switchTouchScreenUsage: 0 441 | switchSupportedLanguagesMask: 0 442 | switchLogoType: 0 443 | switchApplicationErrorCodeCategory: 444 | switchUserAccountSaveDataSize: 0 445 | switchUserAccountSaveDataJournalSize: 0 446 | switchApplicationAttribute: 0 447 | switchCardSpecSize: -1 448 | switchCardSpecClock: -1 449 | switchRatingsMask: 0 450 | switchRatingsInt_0: 0 451 | switchRatingsInt_1: 0 452 | switchRatingsInt_2: 0 453 | switchRatingsInt_3: 0 454 | switchRatingsInt_4: 0 455 | switchRatingsInt_5: 0 456 | switchRatingsInt_6: 0 457 | switchRatingsInt_7: 0 458 | switchRatingsInt_8: 0 459 | switchRatingsInt_9: 0 460 | switchRatingsInt_10: 0 461 | switchRatingsInt_11: 0 462 | switchRatingsInt_12: 0 463 | switchLocalCommunicationIds_0: 464 | switchLocalCommunicationIds_1: 465 | switchLocalCommunicationIds_2: 466 | switchLocalCommunicationIds_3: 467 | switchLocalCommunicationIds_4: 468 | switchLocalCommunicationIds_5: 469 | switchLocalCommunicationIds_6: 470 | switchLocalCommunicationIds_7: 471 | switchParentalControl: 0 472 | switchAllowsScreenshot: 1 473 | switchAllowsVideoCapturing: 1 474 | switchAllowsRuntimeAddOnContentInstall: 0 475 | switchDataLossConfirmation: 0 476 | switchUserAccountLockEnabled: 0 477 | switchSystemResourceMemory: 16777216 478 | switchSupportedNpadStyles: 22 479 | switchNativeFsCacheSize: 32 480 | switchIsHoldTypeHorizontal: 0 481 | switchSupportedNpadCount: 8 482 | switchSocketConfigEnabled: 0 483 | switchTcpInitialSendBufferSize: 32 484 | switchTcpInitialReceiveBufferSize: 64 485 | switchTcpAutoSendBufferSizeMax: 256 486 | switchTcpAutoReceiveBufferSizeMax: 256 487 | switchUdpSendBufferSize: 9 488 | switchUdpReceiveBufferSize: 42 489 | switchSocketBufferEfficiency: 4 490 | switchSocketInitializeEnabled: 1 491 | switchNetworkInterfaceManagerInitializeEnabled: 1 492 | switchPlayerConnectionEnabled: 1 493 | ps4NPAgeRating: 12 494 | ps4NPTitleSecret: 495 | ps4NPTrophyPackPath: 496 | ps4ParentalLevel: 11 497 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 498 | ps4Category: 0 499 | ps4MasterVersion: 01.00 500 | ps4AppVersion: 01.00 501 | ps4AppType: 0 502 | ps4ParamSfxPath: 503 | ps4VideoOutPixelFormat: 0 504 | ps4VideoOutInitialWidth: 1920 505 | ps4VideoOutBaseModeInitialWidth: 1920 506 | ps4VideoOutReprojectionRate: 60 507 | ps4PronunciationXMLPath: 508 | ps4PronunciationSIGPath: 509 | ps4BackgroundImagePath: 510 | ps4StartupImagePath: 511 | ps4StartupImagesFolder: 512 | ps4IconImagesFolder: 513 | ps4SaveDataImagePath: 514 | ps4SdkOverride: 515 | ps4BGMPath: 516 | ps4ShareFilePath: 517 | ps4ShareOverlayImagePath: 518 | ps4PrivacyGuardImagePath: 519 | ps4NPtitleDatPath: 520 | ps4RemotePlayKeyAssignment: -1 521 | ps4RemotePlayKeyMappingDir: 522 | ps4PlayTogetherPlayerCount: 0 523 | ps4EnterButtonAssignment: 1 524 | ps4ApplicationParam1: 0 525 | ps4ApplicationParam2: 0 526 | ps4ApplicationParam3: 0 527 | ps4ApplicationParam4: 0 528 | ps4DownloadDataSize: 0 529 | ps4GarlicHeapSize: 2048 530 | ps4ProGarlicHeapSize: 2560 531 | playerPrefsMaxSize: 32768 532 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 533 | ps4pnSessions: 1 534 | ps4pnPresence: 1 535 | ps4pnFriends: 1 536 | ps4pnGameCustomData: 1 537 | playerPrefsSupport: 0 538 | enableApplicationExit: 0 539 | resetTempFolder: 1 540 | restrictedAudioUsageRights: 0 541 | ps4UseResolutionFallback: 0 542 | ps4ReprojectionSupport: 0 543 | ps4UseAudio3dBackend: 0 544 | ps4SocialScreenEnabled: 0 545 | ps4ScriptOptimizationLevel: 0 546 | ps4Audio3dVirtualSpeakerCount: 14 547 | ps4attribCpuUsage: 0 548 | ps4PatchPkgPath: 549 | ps4PatchLatestPkgPath: 550 | ps4PatchChangeinfoPath: 551 | ps4PatchDayOne: 0 552 | ps4attribUserManagement: 0 553 | ps4attribMoveSupport: 0 554 | ps4attrib3DSupport: 0 555 | ps4attribShareSupport: 0 556 | ps4attribExclusiveVR: 0 557 | ps4disableAutoHideSplash: 0 558 | ps4videoRecordingFeaturesUsed: 0 559 | ps4contentSearchFeaturesUsed: 0 560 | ps4attribEyeToEyeDistanceSettingVR: 0 561 | ps4IncludedModules: [] 562 | ps4attribVROutputEnabled: 0 563 | monoEnv: 564 | splashScreenBackgroundSourceLandscape: {fileID: 0} 565 | splashScreenBackgroundSourcePortrait: {fileID: 0} 566 | blurSplashScreenBackground: 1 567 | spritePackerPolicy: 568 | webGLMemorySize: 16 569 | webGLExceptionSupport: 1 570 | webGLNameFilesAsHashes: 0 571 | webGLDataCaching: 1 572 | webGLDebugSymbols: 0 573 | webGLEmscriptenArgs: 574 | webGLModulesDirectory: 575 | webGLTemplate: APPLICATION:Default 576 | webGLAnalyzeBuildSize: 0 577 | webGLUseEmbeddedResources: 0 578 | webGLCompressionFormat: 1 579 | webGLLinkerTarget: 1 580 | webGLThreadsSupport: 0 581 | webGLWasmStreaming: 0 582 | scriptingDefineSymbols: {} 583 | platformArchitecture: {} 584 | scriptingBackend: {} 585 | il2cppCompilerConfiguration: {} 586 | managedStrippingLevel: {} 587 | incrementalIl2cppBuild: {} 588 | allowUnsafeCode: 1 589 | additionalIl2CppArgs: 590 | scriptingRuntimeVersion: 1 591 | gcIncremental: 0 592 | gcWBarrierValidation: 0 593 | apiCompatibilityLevelPerPlatform: {} 594 | m_RenderingPath: 1 595 | m_MobileRenderingPath: 1 596 | metroPackageName: Template_3D 597 | metroPackageVersion: 598 | metroCertificatePath: 599 | metroCertificatePassword: 600 | metroCertificateSubject: 601 | metroCertificateIssuer: 602 | metroCertificateNotAfter: 0000000000000000 603 | metroApplicationDescription: Template_3D 604 | wsaImages: {} 605 | metroTileShortName: 606 | metroTileShowName: 0 607 | metroMediumTileShowName: 0 608 | metroLargeTileShowName: 0 609 | metroWideTileShowName: 0 610 | metroSupportStreamingInstall: 0 611 | metroLastRequiredScene: 0 612 | metroDefaultTileSize: 1 613 | metroTileForegroundText: 2 614 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 615 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 616 | a: 1} 617 | metroSplashScreenUseBackgroundColor: 0 618 | platformCapabilities: {} 619 | metroTargetDeviceFamilies: {} 620 | metroFTAName: 621 | metroFTAFileTypes: [] 622 | metroProtocolName: 623 | XboxOneProductId: 624 | XboxOneUpdateKey: 625 | XboxOneSandboxId: 626 | XboxOneContentId: 627 | XboxOneTitleId: 628 | XboxOneSCId: 629 | XboxOneGameOsOverridePath: 630 | XboxOnePackagingOverridePath: 631 | XboxOneAppManifestOverridePath: 632 | XboxOneVersion: 1.0.0.0 633 | XboxOnePackageEncryption: 0 634 | XboxOnePackageUpdateGranularity: 2 635 | XboxOneDescription: 636 | XboxOneLanguage: 637 | - enus 638 | XboxOneCapability: [] 639 | XboxOneGameRating: {} 640 | XboxOneIsContentPackage: 0 641 | XboxOneEnableGPUVariability: 1 642 | XboxOneSockets: {} 643 | XboxOneSplashScreen: {fileID: 0} 644 | XboxOneAllowedProductIds: [] 645 | XboxOnePersistentLocalStorageSize: 0 646 | XboxOneXTitleMemory: 8 647 | XboxOneOverrideIdentityName: 648 | vrEditorSettings: 649 | daydream: 650 | daydreamIconForeground: {fileID: 0} 651 | daydreamIconBackground: {fileID: 0} 652 | cloudServicesEnabled: 653 | UNet: 1 654 | luminIcon: 655 | m_Name: 656 | m_ModelFolderPath: 657 | m_PortalFolderPath: 658 | luminCert: 659 | m_CertPath: 660 | m_SignPackage: 1 661 | luminIsChannelApp: 0 662 | luminVersion: 663 | m_VersionCode: 1 664 | m_VersionName: 665 | apiCompatibilityLevel: 6 666 | cloudProjectId: 667 | framebufferDepthMemorylessMode: 0 668 | projectName: 669 | organizationId: 670 | cloudEnabled: 0 671 | enableNativePlatformBackendsForNewInputSystem: 0 672 | disableOldInputManagerSupport: 0 673 | legacyClampBlendShapeWeights: 0 674 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.3.14f1 2 | m_EditorVersionWithRevision: 2019.3.14f1 (2b330bf6d2d8) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 0 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 70 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 2 164 | antiAliasing: 2 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 2 199 | antiAliasing: 2 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: 220 | Android: 2 221 | Lumin: 5 222 | Nintendo 3DS: 5 223 | Nintendo Switch: 5 224 | PS4: 5 225 | PSP2: 2 226 | Stadia: 5 227 | Standalone: 5 228 | WebGL: 3 229 | Windows Store Apps: 5 230 | XboxOne: 5 231 | iPhone: 2 232 | tvOS: 2 233 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity Marching Cubes Implementation 2 | This is my implementation of destructible infinite marching cubes terrain. Made in Unity utilizing latest Unity features, like collider baking on separate threads and setting raw mesh buffers. 3 | 4 | Demo video: https://www.youtube.com/watch?v=2RQKQjoIVnI&feature=youtu.be 5 | 6 | ## About the project 7 | Code is not that well documented but it gets the job done. Infinite terrain generation is currently not as fast as I would like it to be, since pooled chunks need to wait out all of their jobs before they can be used again. Terrain destruction is very fast, since all the colliders are baked on separate threads using Physics.BakeMesh. Everything is pooled so no memory (or very little) gets allocated or freed on runtime. 8 | 9 | ## In research 10 | I'm currently researching faster collision detection. I'd also like to be able to instantly stop a job instead of having to wait for it to speed up the infinite terrain part. 11 | 12 | ## Problems 13 | Render distance above 500 is very slow. This is because all the chunks are currently full GameObjects. I'd like to render meshes outside of the player's destruction range manually, but I didn't find a way to do it yet without having too many draw calls and abysmall performance. Next thing would be to experiment with CommandBuffer.DrawProceduralIndirect or some other alternative. Waiting for jobs on pooled chunks when traversing terrain causes most of the lag. 14 | 15 | ## Controls 16 | WASD to move, right click to control the camera, F to fill and C to cut terrain. 17 | 18 | ## Known problems 19 | If you build the project the build might randomly crash. Doesn't happen in editor, no clue why. 20 | 21 | ## Collaboration 22 | Feel free to fork the project and submit a pull request if you manage to optimize it even further :) 23 | Parts of the code are taken from https://github.com/Eldemarkki/Marching-Cubes-Terrain (those parts are mentioned in the comments) 24 | 25 | Recommended Unity version 2019.3.14f1 26 | 27 | 28 | Contact me 29 | 30 | Discord: Fobri#6742 31 | 32 | Email: itsfobri@gmail.com 33 | --------------------------------------------------------------------------------