├── Assets ├── Cave.meta ├── Cave │ ├── Materials.meta │ ├── Materials │ │ ├── Textures.meta │ │ ├── Textures │ │ │ ├── blurry_dif.png │ │ │ ├── blurry_dif.png.meta │ │ │ ├── normal.png │ │ │ └── normal.png.meta │ │ ├── Triplanar Rock.mat │ │ ├── Triplanar Rock.mat.meta │ │ ├── Triplanar.meta │ │ └── Triplanar │ │ │ ├── Editor.meta │ │ │ ├── Editor │ │ │ ├── StandardTriplanarInspector.cs │ │ │ └── StandardTriplanarInspector.cs.meta │ │ │ ├── Shaders.meta │ │ │ └── Shaders │ │ │ ├── StandardTriplanar.shader │ │ │ └── StandardTriplanar.shader.meta │ ├── Prefabs.meta │ ├── Prefabs │ │ ├── CaveChunk.prefab │ │ └── CaveChunk.prefab.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── BoundsCollection.cs │ │ ├── BoundsCollection.cs.meta │ │ ├── CaveSystem.cs │ │ ├── CaveSystem.cs.meta │ │ ├── Chunks.meta │ │ ├── Chunks │ │ │ ├── Chunk.cs │ │ │ ├── Chunk.cs.meta │ │ │ ├── ChunkData.cs │ │ │ ├── ChunkData.cs.meta │ │ │ ├── ChunkPool.cs │ │ │ └── ChunkPool.cs.meta │ │ ├── Mesh.meta │ │ ├── Mesh │ │ │ ├── MeshGenerator.cs │ │ │ ├── MeshGenerator.cs.meta │ │ │ ├── MeshGeneratorCube.cs │ │ │ ├── MeshGeneratorCube.cs.meta │ │ │ ├── MeshGeneratorTetrahedron.cs │ │ │ ├── MeshGeneratorTetrahedron.cs.meta │ │ │ ├── MeshLookup.cs │ │ │ ├── MeshLookup.cs.meta │ │ │ ├── MeshLookupCube.cs │ │ │ ├── MeshLookupCube.cs.meta │ │ │ ├── MeshLookupTetrahedron.cs │ │ │ ├── MeshLookupTetrahedron.cs.meta │ │ │ ├── MeshSettings.cs │ │ │ └── MeshSettings.cs.meta │ │ ├── Voxels.meta │ │ └── Voxels │ │ │ ├── NoiseSettings.cs │ │ │ ├── NoiseSettings.cs.meta │ │ │ ├── VoxelGenerator.cs │ │ │ ├── VoxelGenerator.cs.meta │ │ │ ├── VoxelGeneratorNoise.cs │ │ │ ├── VoxelGeneratorNoise.cs.meta │ │ │ ├── VoxelSettings.cs │ │ │ ├── VoxelSettings.cs.meta │ │ │ ├── VoxelVolume.cs │ │ │ └── VoxelVolume.cs.meta │ ├── Settings.meta │ └── Settings │ │ ├── MeshSettings.asset │ │ ├── MeshSettings.asset.meta │ │ ├── VoxelSettings.asset │ │ └── VoxelSettings.asset.meta ├── DemoScene.meta └── DemoScene │ ├── Cave.unity │ ├── Cave.unity.meta │ ├── FlyCam.cs │ ├── FlyCam.cs.meta │ ├── Spline.cs │ └── Spline.cs.meta ├── LICENSE.md ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── BurstAotSettings_StandaloneWindows.json ├── 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/Cave.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a6ef7e67610e710498175eeb885f071b 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f50a943e0894054085ebda8426bc0a3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 530a948028e0e5a46b2204cbd7f798d4 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Textures/blurry_dif.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbaske/procedural-cave/bf7be4d7bc10cf93b351c92220d4a195e65370ca/Assets/Cave/Materials/Textures/blurry_dif.png -------------------------------------------------------------------------------- /Assets/Cave/Materials/Textures/blurry_dif.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b76bbc8fd001010479e04fd615abdd60 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 1 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 0 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Textures/normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mbaske/procedural-cave/bf7be4d7bc10cf93b351c92220d4a195e65370ca/Assets/Cave/Materials/Textures/normal.png -------------------------------------------------------------------------------- /Assets/Cave/Materials/Textures/normal.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e471ea80a7e391a4c9698e6c93c12dbd 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 1 10 | sRGBTexture: 0 11 | linearTexture: 0 12 | fadeOut: 0 13 | borderMipMap: 0 14 | mipMapsPreserveCoverage: 0 15 | alphaTestReferenceValue: 0.5 16 | mipMapFadeDistanceStart: 1 17 | mipMapFadeDistanceEnd: 3 18 | bumpmap: 19 | convertToNormalMap: 0 20 | externalNormalMap: 0 21 | heightScale: 0.25 22 | normalMapFilter: 0 23 | isReadable: 0 24 | streamingMipmaps: 0 25 | streamingMipmapsPriority: 0 26 | grayScaleToAlpha: 0 27 | generateCubemap: 6 28 | cubemapConvolution: 0 29 | seamlessCubemap: 0 30 | textureFormat: 1 31 | maxTextureSize: 2048 32 | textureSettings: 33 | serializedVersion: 2 34 | filterMode: -1 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: -1 38 | wrapV: -1 39 | wrapW: -1 40 | nPOTScale: 1 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 0 44 | spriteExtrude: 1 45 | spriteMeshType: 1 46 | alignment: 0 47 | spritePivot: {x: 0.5, y: 0.5} 48 | spritePixelsToUnits: 100 49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 50 | spriteGenerateFallbackPhysicsShape: 1 51 | alphaUsage: 1 52 | alphaIsTransparency: 0 53 | spriteTessellationDetail: -1 54 | textureType: 1 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | applyGammaDecoding: 0 61 | platformSettings: 62 | - serializedVersion: 3 63 | buildTarget: DefaultTexturePlatform 64 | maxTextureSize: 2048 65 | resizeAlgorithm: 0 66 | textureFormat: -1 67 | textureCompression: 1 68 | compressionQuality: 50 69 | crunchedCompression: 0 70 | allowsAlphaSplitting: 0 71 | overridden: 0 72 | androidETC2FallbackOverride: 0 73 | forceMaximumCompressionQuality_BC6H_BC7: 0 74 | spriteSheet: 75 | serializedVersion: 2 76 | sprites: [] 77 | outline: [] 78 | physicsShape: [] 79 | bones: [] 80 | spriteID: 81 | internalID: 0 82 | vertices: [] 83 | indices: 84 | edges: [] 85 | weights: [] 86 | secondaryTextures: [] 87 | spritePackingTag: 88 | pSDRemoveMatte: 0 89 | pSDShowRemoveMatteOption: 0 90 | userData: 91 | assetBundleName: 92 | assetBundleVariant: 93 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar Rock.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: Triplanar Rock 11 | m_Shader: {fileID: 4800000, guid: e4be71837c1c849fda6e7e18d331e612, type: 3} 12 | m_ShaderKeywords: _NORMALMAP 13 | m_LightmapFlags: 5 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: 2800000, guid: e471ea80a7e391a4c9698e6c93c12dbd, type: 3} 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: 2800000, guid: b76bbc8fd001010479e04fd615abdd60, type: 3} 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 | - _Glossiness: 0.2 64 | - _MapScale: 0.15 65 | - _Metallic: 0 66 | - _Mode: 0 67 | - _OcclusionStrength: 0 68 | - _Parallax: 0.02 69 | - _SrcBlend: 1 70 | - _UVSec: 0 71 | - _ZWrite: 1 72 | m_Colors: 73 | - _Color: {r: 1, g: 0.90225196, b: 0.6556604, a: 1} 74 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 75 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar Rock.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 81d5ff70c77bb4739b2216eacb060dbb 3 | timeCreated: 1432644229 4 | licenseType: Pro 5 | NativeFormatImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88e07d203171748f1be0d497b9650055 3 | folderAsset: yes 4 | timeCreated: 1432647065 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 119df102b99e94599879b4fa0912828b 3 | folderAsset: yes 4 | timeCreated: 1432647073 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar/Editor/StandardTriplanarInspector.cs: -------------------------------------------------------------------------------- 1 | // Standard shader with triplanar mapping 2 | // https://github.com/keijiro/StandardTriplanar 3 | 4 | using UnityEngine; 5 | using UnityEditor; 6 | 7 | public class StandardTriplanarInspector : ShaderGUI 8 | { 9 | static class Styles 10 | { 11 | static public readonly GUIContent albedo = new GUIContent("Albedo", "Albedo (RGB)"); 12 | static public readonly GUIContent normalMap = new GUIContent("Normal Map", "Normal Map"); 13 | static public readonly GUIContent occlusion = new GUIContent("Occlusion", "Occlusion (G)"); 14 | } 15 | 16 | bool _initialized; 17 | 18 | public override void OnGUI(MaterialEditor editor, MaterialProperty[] props) 19 | { 20 | EditorGUI.BeginChangeCheck(); 21 | 22 | editor.TexturePropertySingleLine( 23 | Styles.albedo, FindProperty("_MainTex", props), FindProperty("_Color", props) 24 | ); 25 | 26 | editor.ShaderProperty(FindProperty("_Metallic", props), "Metallic"); 27 | editor.ShaderProperty(FindProperty("_Glossiness", props), "Smoothness"); 28 | 29 | var normal = FindProperty("_BumpMap", props); 30 | editor.TexturePropertySingleLine( 31 | Styles.normalMap, normal, 32 | normal.textureValue ? FindProperty("_BumpScale", props) : null 33 | ); 34 | 35 | var occ = FindProperty("_OcclusionMap", props); 36 | editor.TexturePropertySingleLine( 37 | Styles.occlusion, occ, 38 | occ.textureValue ? FindProperty("_OcclusionStrength", props) : null 39 | ); 40 | 41 | editor.ShaderProperty(FindProperty("_MapScale", props), "Texture Scale"); 42 | 43 | if (EditorGUI.EndChangeCheck() || !_initialized) 44 | foreach (Material m in editor.targets) 45 | SetMaterialKeywords(m); 46 | 47 | _initialized = true; 48 | } 49 | 50 | static void SetMaterialKeywords(Material material) 51 | { 52 | SetKeyword(material, "_NORMALMAP", material.GetTexture("_BumpMap")); 53 | SetKeyword(material, "_OCCLUSIONMAP", material.GetTexture("_OcclusionMap")); 54 | } 55 | 56 | static void SetKeyword(Material m, string keyword, bool state) 57 | { 58 | if (state) 59 | m.EnableKeyword(keyword); 60 | else 61 | m.DisableKeyword(keyword); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar/Editor/StandardTriplanarInspector.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f4c74c7b0c67a4251902a5a7d75c2b39 3 | timeCreated: 1432647091 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f47f15052a7ae44dea55bf153dec1247 3 | folderAsset: yes 4 | timeCreated: 1432650727 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar/Shaders/StandardTriplanar.shader: -------------------------------------------------------------------------------- 1 | // Standard shader with triplanar mapping 2 | // https://github.com/keijiro/StandardTriplanar 3 | 4 | Shader "Standard Triplanar" 5 | { 6 | Properties 7 | { 8 | _Color("", Color) = (1, 1, 1, 1) 9 | _MainTex("", 2D) = "white" {} 10 | 11 | _Glossiness("", Range(0, 1)) = 0.5 12 | [Gamma] _Metallic("", Range(0, 1)) = 0 13 | 14 | _BumpScale("", Float) = 1 15 | _BumpMap("", 2D) = "bump" {} 16 | 17 | _OcclusionStrength("", Range(0, 1)) = 1 18 | _OcclusionMap("", 2D) = "white" {} 19 | 20 | _MapScale("", Float) = 1 21 | } 22 | SubShader 23 | { 24 | Tags { "RenderType"="Opaque" } 25 | 26 | CGPROGRAM 27 | 28 | #pragma surface surf Standard vertex:vert fullforwardshadows addshadow 29 | 30 | #pragma shader_feature _NORMALMAP 31 | #pragma shader_feature _OCCLUSIONMAP 32 | 33 | #pragma target 3.0 34 | 35 | half4 _Color; 36 | sampler2D _MainTex; 37 | 38 | half _Glossiness; 39 | half _Metallic; 40 | 41 | half _BumpScale; 42 | sampler2D _BumpMap; 43 | 44 | half _OcclusionStrength; 45 | sampler2D _OcclusionMap; 46 | 47 | half _MapScale; 48 | 49 | struct Input 50 | { 51 | float3 localCoord; 52 | float3 localNormal; 53 | }; 54 | 55 | void vert(inout appdata_full v, out Input data) 56 | { 57 | UNITY_INITIALIZE_OUTPUT(Input, data); 58 | data.localCoord = v.vertex.xyz; 59 | data.localNormal = v.normal.xyz; 60 | } 61 | 62 | void surf(Input IN, inout SurfaceOutputStandard o) 63 | { 64 | // Blending factor of triplanar mapping 65 | float3 bf = normalize(abs(IN.localNormal)); 66 | bf /= dot(bf, (float3)1); 67 | 68 | // Triplanar mapping 69 | float2 tx = IN.localCoord.yz * _MapScale; 70 | float2 ty = IN.localCoord.zx * _MapScale; 71 | float2 tz = IN.localCoord.xy * _MapScale; 72 | 73 | // Base color 74 | half4 cx = tex2D(_MainTex, tx) * bf.x; 75 | half4 cy = tex2D(_MainTex, ty) * bf.y; 76 | half4 cz = tex2D(_MainTex, tz) * bf.z; 77 | half4 color = (cx + cy + cz) * _Color; 78 | o.Albedo = color.rgb; 79 | o.Alpha = color.a; 80 | 81 | #ifdef _NORMALMAP 82 | // Normal map 83 | half4 nx = tex2D(_BumpMap, tx) * bf.x; 84 | half4 ny = tex2D(_BumpMap, ty) * bf.y; 85 | half4 nz = tex2D(_BumpMap, tz) * bf.z; 86 | o.Normal = UnpackScaleNormal(nx + ny + nz, _BumpScale); 87 | #endif 88 | 89 | #ifdef _OCCLUSIONMAP 90 | // Occlusion map 91 | half ox = tex2D(_OcclusionMap, tx).g * bf.x; 92 | half oy = tex2D(_OcclusionMap, ty).g * bf.y; 93 | half oz = tex2D(_OcclusionMap, tz).g * bf.z; 94 | o.Occlusion = lerp((half4)1, ox + oy + oz, _OcclusionStrength); 95 | #endif 96 | 97 | // Misc parameters 98 | o.Metallic = _Metallic; 99 | o.Smoothness = _Glossiness; 100 | } 101 | ENDCG 102 | } 103 | FallBack "Diffuse" 104 | CustomEditor "StandardTriplanarInspector" 105 | } 106 | -------------------------------------------------------------------------------- /Assets/Cave/Materials/Triplanar/Shaders/StandardTriplanar.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e4be71837c1c849fda6e7e18d331e612 3 | timeCreated: 1432640677 4 | licenseType: Pro 5 | ShaderImporter: 6 | defaultTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Cave/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67fbed737139dd54e943e4ab720c7b08 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Prefabs/CaveChunk.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &1189921576992816206 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: 1189921576992816194} 12 | - component: {fileID: 1189921576992816195} 13 | - component: {fileID: 1189921576992816204} 14 | - component: {fileID: 1189921576992816205} 15 | - component: {fileID: 1189921576992816193} 16 | m_Layer: 8 17 | m_Name: CaveChunk 18 | m_TagString: Untagged 19 | m_Icon: {fileID: 0} 20 | m_NavMeshLayer: 0 21 | m_StaticEditorFlags: 4294967294 22 | m_IsActive: 1 23 | --- !u!4 &1189921576992816194 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: 1189921576992816206} 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 &1189921576992816195 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: 1189921576992816206} 44 | m_Mesh: {fileID: 0} 45 | --- !u!23 &1189921576992816204 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: 1189921576992816206} 52 | m_Enabled: 1 53 | m_CastShadows: 0 54 | m_ReceiveShadows: 0 55 | m_DynamicOccludee: 1 56 | m_MotionVectors: 0 57 | m_LightProbeUsage: 0 58 | m_ReflectionProbeUsage: 0 59 | m_RayTracingMode: 2 60 | m_RenderingLayerMask: 1 61 | m_RendererPriority: 0 62 | m_Materials: 63 | - {fileID: 2100000, guid: 81d5ff70c77bb4739b2216eacb060dbb, 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 &1189921576992816205 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: 1189921576992816206} 91 | m_Material: {fileID: 0} 92 | m_IsTrigger: 0 93 | m_Enabled: 1 94 | serializedVersion: 4 95 | m_Convex: 0 96 | m_CookingOptions: 0 97 | m_Mesh: {fileID: 0} 98 | --- !u!114 &1189921576992816193 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: 1189921576992816206} 105 | m_Enabled: 1 106 | m_EditorHideFlags: 0 107 | m_Script: {fileID: 11500000, guid: 170831f79f4778442a4966cedc267a4d, type: 3} 108 | m_Name: 109 | m_EditorClassIdentifier: 110 | addCollider: 2 111 | -------------------------------------------------------------------------------- /Assets/Cave/Prefabs/CaveChunk.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 15469a8436211c84eb52de916f246381 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b3dd1ba14030b9444b83044de6472a45 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/BoundsCollection.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | public class BoundsCollection 5 | { 6 | private Vector3Int size; 7 | private Vector3Int scaledExtents; 8 | private Dictionary buffer; 9 | 10 | public BoundsCollection(Vector3Int voxelsPerChunk, Vector3Int extents) 11 | { 12 | size = voxelsPerChunk; 13 | scaledExtents = Vector3Int.Scale(size, extents); 14 | buffer = new Dictionary(); 15 | } 16 | 17 | public IEnumerable GetBounds(Vector3Int center) 18 | { 19 | Vector3Int min = center - scaledExtents; 20 | Vector3Int max = center + scaledExtents; 21 | 22 | for (int x = min.x; x <= max.x; x += size.x) 23 | { 24 | for (int y = min.y; y <= max.y; y += size.y) 25 | { 26 | for (int z = min.z; z <= max.z; z += size.z) 27 | { 28 | Vector3Int pos = new Vector3Int(x, y, z); 29 | if (!buffer.TryGetValue(pos, out Bounds bounds)) 30 | { 31 | bounds = new Bounds(pos, size); 32 | buffer.Add(pos, bounds); 33 | } 34 | yield return bounds; 35 | } 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/BoundsCollection.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c8f530cb9ae0f024fbdc618a826d4962 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/CaveSystem.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | public class CaveSystem : MonoBehaviour 5 | { 6 | // Scriptable object instance. 7 | [SerializeField] 8 | private VoxelSettings voxelSettings; 9 | [SerializeField, Tooltip("Number of chunks extending from center chunk")] 10 | private Vector3Int extents; 11 | 12 | [SerializeField] 13 | private float updateDistance = 5; 14 | private float updateSqrDistance; 15 | private Vector3 prevAgentPos; 16 | // Update on rotation when using cam frustum. 17 | [SerializeField] 18 | private float updateAngle = 5; 19 | private Vector3 prevAgentFwd; 20 | 21 | private Camera cam; 22 | private Plane[] planes; 23 | private bool useCamFrustum; 24 | 25 | private Transform agent; 26 | private ChunkPool chunkPool; 27 | private BoundsCollection bounds; 28 | private Vector3Int chunkSize; 29 | private Vector3 invChunkSize; 30 | private HashSet coords; 31 | private HashSet chunks; 32 | private bool allChunksActive; 33 | private bool isInitialized; 34 | 35 | public void Initialize() 36 | { 37 | chunkPool = FindObjectOfType(); 38 | chunks = new HashSet(); 39 | coords = new HashSet(); 40 | 41 | chunkSize = voxelSettings.VoxelsPerChunk; 42 | invChunkSize = new Vector3( 43 | 1f / (float)chunkSize.x, 44 | 1f / (float)chunkSize.y, 45 | 1f / (float)chunkSize.z); 46 | bounds = new BoundsCollection(chunkSize, extents); 47 | updateSqrDistance = updateDistance * updateDistance; 48 | isInitialized = true; 49 | } 50 | 51 | public void Initialize(Transform agent) 52 | { 53 | this.agent = agent; 54 | Initialize(); 55 | } 56 | 57 | public void Initialize(Transform agent, Camera camera) 58 | { 59 | planes = new Plane[6]; 60 | useCamFrustum = true; 61 | cam = camera; 62 | Initialize(agent); 63 | } 64 | 65 | public void OnReset() 66 | { 67 | foreach (Vector3Int coord in coords) 68 | { 69 | chunks.Remove(chunkPool.Deactivate(coord, transform)); 70 | } 71 | coords.Clear(); 72 | allChunksActive = false; 73 | prevAgentPos = Vector3.one * 999; 74 | prevAgentFwd = agent.forward; 75 | } 76 | 77 | public bool AllChunksActive() 78 | { 79 | if (allChunksActive) 80 | { 81 | return true; 82 | } 83 | else if (chunks.Count == 0) 84 | { 85 | return false; 86 | } 87 | 88 | allChunksActive = true; 89 | foreach (Chunk chunk in chunks) 90 | { 91 | allChunksActive = allChunksActive && chunk.IsActive; 92 | } 93 | return allChunksActive; 94 | } 95 | 96 | private void Update() 97 | { 98 | if (isInitialized && MustUpdate()) 99 | { 100 | // Round agent pos to valid chunk pos. 101 | Vector3Int roundedPos = Vector3Int.Scale(Vector3Int.RoundToInt( 102 | Vector3.Scale(agent.localPosition, invChunkSize)), chunkSize); 103 | HashSet tmp = new HashSet(coords); 104 | coords.Clear(); 105 | 106 | foreach (Bounds b in bounds.GetBounds(roundedPos)) 107 | { 108 | Vector3Int v = Vector3Int.RoundToInt(b.center); 109 | if (!useCamFrustum || GeometryUtility.TestPlanesAABB(planes, b)) 110 | { 111 | coords.Add(v); 112 | if (!tmp.Contains(v)) 113 | { 114 | int priority = -(v - roundedPos).sqrMagnitude; 115 | chunks.Add(chunkPool.Activate(v, transform, priority)); 116 | allChunksActive = false; 117 | } 118 | } 119 | } 120 | 121 | tmp.ExceptWith(coords); 122 | foreach (Vector3Int v in tmp) 123 | { 124 | chunks.Remove(chunkPool.Deactivate(v, transform)); 125 | } 126 | } 127 | } 128 | 129 | private bool MustUpdate() 130 | { 131 | if ((agent.position - prevAgentPos).sqrMagnitude > updateSqrDistance || 132 | (useCamFrustum && Vector3.Angle(agent.forward, prevAgentFwd) > updateAngle)) 133 | { 134 | prevAgentPos = agent.position; 135 | 136 | if (useCamFrustum) 137 | { 138 | prevAgentFwd = agent.forward; 139 | GeometryUtility.CalculateFrustumPlanes(cam, planes); 140 | } 141 | return true; 142 | } 143 | return false; 144 | } 145 | } -------------------------------------------------------------------------------- /Assets/Cave/Scripts/CaveSystem.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8f521691a4d027045932c350eb729bcd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c90e2aaa39d234b4286ef59e69f10d09 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks/Chunk.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class Chunk : MonoBehaviour 4 | { 5 | public static string GetName(Transform parent, Vector3Int pos) 6 | { 7 | return $"{parent.GetInstanceID()}_{pos.x}_{pos.y}_{pos.z}"; 8 | } 9 | 10 | public bool IsActive { get; private set; } 11 | 12 | // Delayed option: avoid adding all mesh colliders at once. 13 | private enum AddColliderMode 14 | { 15 | Immediate = 0, 16 | Delayed = 1, 17 | DelayedOnReuse = 2, 18 | None = 3 19 | } 20 | 21 | [SerializeField] 22 | private AddColliderMode addCollider; 23 | [SerializeField] 24 | private float delay = 0.05f; 25 | 26 | private MeshFilter meshFilter; 27 | private MeshCollider meshCollider; 28 | 29 | private void Awake() 30 | { 31 | meshFilter = GetComponent(); 32 | meshCollider = GetComponent(); 33 | meshCollider.enabled = addCollider != AddColliderMode.None; 34 | } 35 | 36 | public void Place(string name, Transform parent, Vector3 localPos) 37 | { 38 | IsActive = false; 39 | transform.name = name; 40 | transform.parent = parent; 41 | transform.localPosition = localPos; 42 | } 43 | 44 | public void SetActive(bool active, Mesh mesh = null) 45 | { 46 | gameObject.SetActive(active); 47 | meshFilter.sharedMesh = mesh; 48 | 49 | if (active) 50 | { 51 | if (addCollider == AddColliderMode.Delayed) 52 | { 53 | Invoke("AddCollider", ChunkPool.GetBusyCount() * delay); 54 | } 55 | else if (addCollider == AddColliderMode.Immediate) 56 | { 57 | AddCollider(); 58 | } 59 | else if (addCollider == AddColliderMode.DelayedOnReuse) 60 | { 61 | AddCollider(); 62 | addCollider = AddColliderMode.Delayed; 63 | } 64 | } 65 | else 66 | { 67 | meshCollider.sharedMesh = null; 68 | } 69 | } 70 | 71 | private void AddCollider() 72 | { 73 | meshCollider.sharedMesh = meshFilter.sharedMesh; 74 | IsActive = true; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks/Chunk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 170831f79f4778442a4966cedc267a4d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks/ChunkData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections.Generic; 3 | 4 | public class ChunkData : System.IDisposable 5 | { 6 | public bool IsActive { get; set; } 7 | public int Priority { get; set; } 8 | // Multiple cave systems: ChunkData can be associated with more than one gameobject. 9 | public List AssociatedChunks { get; set; } = new List(); 10 | public VoxelVolume Volume => voxelGen.Volume; 11 | public bool HasUpToDateMesh => state == State.Completed; 12 | public Mesh Mesh => meshGen.Mesh; 13 | 14 | private enum State 15 | { 16 | Idle = 0, 17 | VoxelsScheduled = 1, 18 | MeshScheduled = 2, 19 | Completed = 3 20 | } 21 | private State state; 22 | private MeshGenerator meshGen; 23 | private VoxelGenerator voxelGen; 24 | 25 | public ChunkData(VoxelSettings voxelSettings, MeshSettings meshSettings) 26 | { 27 | voxelGen = VoxelGeneratorFactory.CreateInstance(voxelSettings); 28 | meshGen = MeshGeneratorFactory.CreateInstance(meshSettings); 29 | meshGen.VoxelGenerator = voxelGen; 30 | } 31 | 32 | public void SetPosition(Vector3Int pos) 33 | { 34 | voxelGen.Volume.SetPosition(pos); 35 | state = State.Idle; 36 | } 37 | 38 | public bool IsCompleted(ref int availableWorkers) 39 | { 40 | switch (state) 41 | { 42 | case State.Idle: 43 | if (availableWorkers > 0) 44 | { 45 | voxelGen.Schedule(); 46 | state = State.VoxelsScheduled; 47 | availableWorkers--; 48 | } 49 | break; 50 | 51 | case State.VoxelsScheduled: 52 | if (voxelGen.IsCompleted) 53 | { 54 | // TODO Schedule with dependency? 55 | voxelGen.Complete(); 56 | meshGen.Schedule(); 57 | state = State.MeshScheduled; 58 | } 59 | break; 60 | 61 | case State.MeshScheduled: 62 | if (meshGen.IsCompleted) 63 | { 64 | meshGen.Complete(); 65 | state = State.Completed; 66 | availableWorkers++; 67 | 68 | foreach (Chunk chunk in AssociatedChunks) 69 | { 70 | chunk.SetActive(true, meshGen.Mesh); 71 | } 72 | } 73 | break; 74 | } 75 | 76 | return state == State.Completed; 77 | } 78 | 79 | public void CancelJobs(ref int availableWorkers) 80 | { 81 | switch (state) 82 | { 83 | case State.VoxelsScheduled: 84 | voxelGen.Complete(); 85 | availableWorkers++; 86 | break; 87 | 88 | case State.MeshScheduled: 89 | meshGen.Complete(); 90 | availableWorkers++; 91 | break; 92 | } 93 | } 94 | 95 | public void Dispose() 96 | { 97 | voxelGen.Dispose(); 98 | meshGen.Dispose(); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks/ChunkData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 88cae6562a7baba4d9cd69d753121543 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks/ChunkPool.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | public class ChunkPool : MonoBehaviour, System.IDisposable 5 | { 6 | // Global frame counter for staggered chunk updates. 7 | public static int GetBusyCount() 8 | { 9 | return busyCount++; 10 | } 11 | private static int busyCount; 12 | private static void OnFrameUpdate() 13 | { 14 | busyCount = Mathf.Max(0, --busyCount); 15 | } 16 | 17 | // Scriptable object instance. 18 | [SerializeField] 19 | private VoxelSettings voxelSettings; 20 | // Scriptable object instance. 21 | [SerializeField] 22 | private MeshSettings meshSettings; 23 | [SerializeField] 24 | private Chunk chunkPrefab; 25 | // Number of jobs that can be scheduled simultaneously. 26 | [SerializeField] 27 | private int numWorkers = 32; 28 | 29 | private Dictionary dataByPos; 30 | private List bufferedData; 31 | private Queue reusableData; 32 | private List scheduledData; 33 | 34 | private Dictionary chunksByName; 35 | private Queue reusableChunks; 36 | 37 | private void Awake() 38 | { 39 | dataByPos = new Dictionary(); 40 | bufferedData = new List(); 41 | reusableData = new Queue(); 42 | scheduledData = new List(); 43 | 44 | chunksByName = new Dictionary(); 45 | reusableChunks = new Queue(); 46 | 47 | InvokeRepeating("FlushBuffered", 1, 1); 48 | } 49 | 50 | public Chunk Activate(Vector3Int pos, Transform parent, int priority) 51 | { 52 | string name = Chunk.GetName(parent, pos); 53 | 54 | if (!dataByPos.TryGetValue(pos, out ChunkData data)) 55 | { 56 | data = reusableData.Count > 0 57 | ? reusableData.Dequeue() 58 | : new ChunkData(voxelSettings, meshSettings); 59 | data.CancelJobs(ref numWorkers); 60 | data.SetPosition(pos); 61 | data.Priority = priority; 62 | dataByPos.Add(pos, data); 63 | scheduledData.Add(data); 64 | } 65 | 66 | if (!chunksByName.TryGetValue(name, out Chunk chunk)) 67 | { 68 | chunk = reusableChunks.Count > 0 69 | ? reusableChunks.Dequeue() 70 | : Instantiate(chunkPrefab); 71 | chunk.Place(name, parent, data.Volume.Bounds.min); 72 | chunksByName.Add(name, chunk); 73 | } 74 | 75 | data.IsActive = true; 76 | data.AssociatedChunks.Add(chunk); 77 | chunk.SetActive(data.HasUpToDateMesh, data.Mesh); 78 | 79 | return chunk; 80 | } 81 | 82 | public void SortByPriority() 83 | { 84 | // Priority value is the negative distance^2 between agent and chunk pos. 85 | // Smallest distance (0) -> highest priority data is placed last in the list. 86 | // The Update loop checks list items in descending order. 87 | // We're not using a queue, because jobs are not guaranteed to finish in 88 | // the same order they were scheduled. 89 | scheduledData.Sort((x, y) => x.Priority.CompareTo(y.Priority)); 90 | } 91 | 92 | public Chunk Deactivate(Vector3Int pos, Transform parent) 93 | { 94 | string name = Chunk.GetName(parent, pos); 95 | Chunk chunk = chunksByName[name]; 96 | chunk.SetActive(false); 97 | chunksByName.Remove(name); 98 | reusableChunks.Enqueue(chunk); 99 | 100 | ChunkData data = dataByPos[pos]; 101 | data.AssociatedChunks.Remove(chunk); 102 | if (data.AssociatedChunks.Count == 0) 103 | { 104 | data.IsActive = false; 105 | if (!bufferedData.Contains(data)) 106 | { 107 | bufferedData.Add(data); 108 | } 109 | } 110 | 111 | return chunk; 112 | } 113 | 114 | private void FlushBuffered() 115 | { 116 | foreach (ChunkData data in bufferedData) 117 | { 118 | if (!data.IsActive) 119 | { 120 | dataByPos.Remove(data.Volume.Position); 121 | reusableData.Enqueue(data); 122 | } 123 | } 124 | bufferedData.Clear(); 125 | } 126 | 127 | public void Dispose() 128 | { 129 | foreach (ChunkData data in dataByPos.Values) 130 | { 131 | data.CancelJobs(ref numWorkers); 132 | data.Dispose(); 133 | } 134 | foreach (ChunkData data in reusableData) 135 | { 136 | data.CancelJobs(ref numWorkers); 137 | data.Dispose(); 138 | } 139 | 140 | MeshLookup.GetInstance().Dispose(); 141 | } 142 | 143 | private void Update() 144 | { 145 | OnFrameUpdate(); 146 | 147 | for (int i = scheduledData.Count - 1; i >= 0; i--) 148 | { 149 | if (scheduledData[i].IsCompleted(ref numWorkers)) 150 | { 151 | scheduledData.RemoveAt(i); 152 | } 153 | } 154 | } 155 | 156 | private void OnDestroy() 157 | { 158 | Dispose(); 159 | } 160 | } 161 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Chunks/ChunkPool.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 85d3986725d195f468c9944a79998b53 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9278a12ead7f9994baddbb478fc1ed17 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshGenerator.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using Unity.Mathematics; 3 | using Unity.Jobs; 4 | using UnityEngine; 5 | 6 | public static class MeshGeneratorFactory 7 | { 8 | public static MeshGenerator CreateInstance(MeshSettings settings) 9 | { 10 | switch (settings.GeneratorType) 11 | { 12 | case MeshSettings.Generator.Tetrahedron: 13 | return new MeshGeneratorTetrahedron(settings); 14 | 15 | case MeshSettings.Generator.Cube: 16 | default: 17 | return new MeshGeneratorCube(settings); 18 | } 19 | } 20 | } 21 | 22 | public abstract class MeshGenerator : System.IDisposable 23 | { 24 | public Mesh Mesh { get; private set; } 25 | public VoxelGenerator VoxelGenerator { protected get; set; } 26 | public bool IsCompleted => jobHandle.IsCompleted; 27 | 28 | protected NativeList indexBuffer; 29 | protected NativeList vertexBuffer; 30 | protected NativeHashMap weldMap; 31 | protected MeshSettings settings; 32 | protected MeshLookup lookup; 33 | protected JobHandle jobHandle; 34 | 35 | public MeshGenerator(MeshSettings settings) 36 | { 37 | this.settings = settings; 38 | Mesh = new Mesh(); 39 | lookup = MeshLookup.GetInstance(settings); 40 | Allocate(); 41 | } 42 | 43 | protected virtual void Allocate() 44 | { 45 | // TODO Allocation size? Vertex & triangle count unknown prior to job execution. 46 | vertexBuffer = new NativeList(0, Allocator.Persistent); 47 | indexBuffer = new NativeList(0, Allocator.Persistent); 48 | weldMap = new NativeHashMap(0, Allocator.Persistent); 49 | } 50 | 51 | public virtual void Schedule() 52 | { 53 | vertexBuffer.Clear(); 54 | indexBuffer.Clear(); 55 | weldMap.Clear(); 56 | } 57 | 58 | public virtual void Complete(bool updateMesh = true) 59 | { 60 | jobHandle.Complete(); 61 | 62 | if (updateMesh) 63 | { 64 | Mesh.Clear(); 65 | Mesh.SetVertices(vertexBuffer.AsArray()); 66 | Mesh.SetTriangles(indexBuffer.ToArray(), 0); 67 | Mesh.RecalculateBounds(); 68 | Mesh.RecalculateNormals(); 69 | } 70 | } 71 | 72 | public virtual void Dispose() 73 | { 74 | vertexBuffer.Dispose(); 75 | indexBuffer.Dispose(); 76 | weldMap.Dispose(); 77 | } 78 | } -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 544a378f50c954a4c8ac4e633024f8c9 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshGeneratorCube.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using Unity.Mathematics; 3 | using Unity.Jobs; 4 | using Unity.Burst; 5 | using UnityEngine; 6 | 7 | // Adapted from https://github.com/Scrawk/Marching-Cubes 8 | // https://github.com/Scrawk/Marching-Cubes/blob/master/LICENSE 9 | 10 | public class MeshGeneratorCube : MeshGenerator 11 | { 12 | [BurstCompile] 13 | private struct GenerateMesh : IJob 14 | { 15 | [WriteOnly] 16 | public NativeList indexBuffer; 17 | [WriteOnly] 18 | public NativeList vertexBuffer; 19 | 20 | [ReadOnly] 21 | public float surfaceCutOff; 22 | [ReadOnly] 23 | public NativeArray vertexOffsets; 24 | [ReadOnly] 25 | public NativeArray edgeVertexIndices; 26 | [ReadOnly] 27 | public NativeArray edgeDirections; 28 | [ReadOnly] 29 | public NativeArray edgeFlags; 30 | [ReadOnly] 31 | public NativeArray triangles; 32 | 33 | [ReadOnly] 34 | public Vector3Int size; 35 | [ReadOnly] 36 | public Vector3Int paddedSize; 37 | [ReadOnly] 38 | public NativeArray voxels; 39 | 40 | // read/write 41 | public NativeArray edgeVertices; 42 | // read/write 43 | public NativeArray cubeVoxels; 44 | 45 | [ReadOnly] 46 | public bool weld; 47 | // read/write 48 | public NativeHashMap weldMap; 49 | 50 | public void Execute() 51 | { 52 | int xy = paddedSize.x * paddedSize.y; 53 | 54 | for (int n = 0, x = 0; x < size.x; x++) 55 | { 56 | for (int y = 0; y < size.y; y++) 57 | { 58 | for (int z = 0; z < size.z; z++) 59 | { 60 | int flagIndex = 0; 61 | for (int i = 0; i < 8; i++) 62 | { 63 | int i3 = i * 3; 64 | int ix = x + vertexOffsets[i3]; 65 | int iy = y + vertexOffsets[i3 + 1]; 66 | int iz = z + vertexOffsets[i3 + 2]; 67 | cubeVoxels[i] = voxels[ix + iy * paddedSize.x + iz * xy]; 68 | 69 | if (cubeVoxels[i] <= surfaceCutOff) 70 | { 71 | flagIndex |= 1 << i; 72 | } 73 | } 74 | 75 | int edgeFlag = edgeFlags[flagIndex]; 76 | if (!edgeFlag.Equals(0)) 77 | { 78 | for (int i = 0; i < 12; i++) 79 | { 80 | if (!(edgeFlag & (1 << i)).Equals(0)) 81 | { 82 | int evi = edgeVertexIndices[i * 2]; 83 | int evi3 = evi * 3; 84 | int i3 = i * 3; 85 | float delta = cubeVoxels[edgeVertexIndices[i * 2 + 1]] - cubeVoxels[evi]; 86 | float offset = delta.Equals(0f) ? surfaceCutOff : (surfaceCutOff - cubeVoxels[evi]) / delta; 87 | edgeVertices[i] = new float3( 88 | x + (vertexOffsets[evi3] + offset * edgeDirections[i3]), 89 | y + (vertexOffsets[evi3 + 1] + offset * edgeDirections[i3 + 1]), 90 | z + (vertexOffsets[evi3 + 2] + offset * edgeDirections[i3 + 2]) 91 | ); 92 | } 93 | } 94 | 95 | for (int i = 0; i < 5; i++) 96 | { 97 | if (triangles[flagIndex * 16 + 3 * i] < 0) break; 98 | 99 | for (int j = 0; j < 3; j++) 100 | { 101 | int v = triangles[flagIndex * 16 + 3 * i + j]; 102 | if (weld) 103 | { 104 | if (weldMap.TryGetValue(edgeVertices[v], out int index)) 105 | { 106 | indexBuffer.Add(index); 107 | } 108 | else 109 | { 110 | weldMap.TryAdd(edgeVertices[v], n); 111 | vertexBuffer.Add(edgeVertices[v]); 112 | indexBuffer.Add(n); 113 | n++; 114 | } 115 | } 116 | else 117 | { 118 | vertexBuffer.Add(edgeVertices[v]); 119 | indexBuffer.Add(n); 120 | n++; 121 | } 122 | } 123 | } 124 | } 125 | } 126 | } 127 | } 128 | } 129 | } 130 | 131 | private GenerateMesh job; 132 | 133 | public MeshGeneratorCube(MeshSettings settings) : base(settings) 134 | { 135 | } 136 | 137 | public override void Schedule() 138 | { 139 | base.Schedule(); 140 | 141 | job = new GenerateMesh() 142 | { 143 | indexBuffer = indexBuffer, 144 | vertexBuffer = vertexBuffer, 145 | surfaceCutOff = settings.SurfaceCutOff, 146 | weld = settings.WeldVertices, 147 | weldMap = weldMap, 148 | 149 | vertexOffsets = lookup.VertexOffsets, 150 | edgeVertexIndices = lookup.VertexIndices, 151 | edgeDirections = lookup.EdgeDirections, 152 | edgeFlags = lookup.EdgeFlags, 153 | triangles = lookup.Triangles, 154 | 155 | voxels = VoxelGenerator.Volume.Voxels, 156 | size = VoxelGenerator.Volume.Size, 157 | paddedSize = VoxelGenerator.Volume.PaddedSize, 158 | 159 | edgeVertices = new NativeArray(12, Allocator.Persistent), 160 | cubeVoxels = new NativeArray(8, Allocator.Persistent) 161 | }; 162 | 163 | jobHandle = job.Schedule(); 164 | } 165 | 166 | public override void Complete(bool updateMesh = true) 167 | { 168 | base.Complete(updateMesh); 169 | job.edgeVertices.Dispose(); 170 | job.cubeVoxels.Dispose(); 171 | } 172 | } -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshGeneratorCube.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7ec60149efb36a9499b08b37f7875cbe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshGeneratorTetrahedron.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using Unity.Mathematics; 3 | using Unity.Jobs; 4 | using Unity.Burst; 5 | using UnityEngine; 6 | 7 | // Adapted from https://github.com/Scrawk/Marching-Cubes 8 | // https://github.com/Scrawk/Marching-Cubes/blob/master/LICENSE 9 | 10 | public class MeshGeneratorTetrahedron : MeshGenerator 11 | { 12 | [BurstCompile] 13 | private struct GenerateMesh : IJob 14 | { 15 | [WriteOnly] 16 | public NativeList indexBuffer; 17 | [WriteOnly] 18 | public NativeList vertexBuffer; 19 | 20 | [ReadOnly] 21 | public float surfaceCutOff; 22 | [ReadOnly] 23 | public NativeArray vertexOffsets; 24 | [ReadOnly] 25 | public NativeArray edgeVertexIndices; 26 | [ReadOnly] 27 | public NativeArray cubeVertexIndices; 28 | [ReadOnly] 29 | public NativeArray edgeFlags; 30 | [ReadOnly] 31 | public NativeArray triangles; 32 | 33 | [ReadOnly] 34 | public Vector3Int size; 35 | [ReadOnly] 36 | public Vector3Int paddedSize; 37 | [ReadOnly] 38 | public NativeArray voxels; 39 | 40 | // read/write 41 | public NativeArray edgeVertices; 42 | // read/write 43 | public NativeArray cubeVoxels; 44 | // read/write 45 | public NativeArray cubePositions; 46 | // read/write 47 | public NativeArray tetrahedronPositions; 48 | // read/write 49 | public NativeArray tetrahedronValues; 50 | 51 | [ReadOnly] 52 | public bool weld; 53 | // read/write 54 | public NativeHashMap weldMap; 55 | 56 | public void Execute() 57 | { 58 | int xy = paddedSize.x * paddedSize.y; 59 | 60 | for (int n = 0, x = 0; x < size.x; x++) 61 | { 62 | for (int y = 0; y < size.y; y++) 63 | { 64 | for (int z = 0; z < size.z; z++) 65 | { 66 | for (int i = 0; i < 8; i++) 67 | { 68 | int i3 = i * 3; 69 | int ix = x + vertexOffsets[i3]; 70 | int iy = y + vertexOffsets[i3 + 1]; 71 | int iz = z + vertexOffsets[i3 + 2]; 72 | cubeVoxels[i] = voxels[ix + iy * paddedSize.x + iz * xy]; 73 | cubePositions[i] = new float3( 74 | x + vertexOffsets[i3], 75 | y + vertexOffsets[i3 + 1], 76 | z + vertexOffsets[i3 + 2] 77 | ); 78 | } 79 | 80 | for (int i = 0; i < 6; i++) 81 | { 82 | for (int j = 0; j < 4; j++) 83 | { 84 | int vi = cubeVertexIndices[i * 4 + j]; 85 | tetrahedronPositions[j] = cubePositions[vi]; 86 | tetrahedronValues[j] = cubeVoxels[vi]; 87 | } 88 | 89 | int flagIndex = 0; 90 | for (int j = 0; j < 4; j++) 91 | { 92 | if (tetrahedronValues[j] <= surfaceCutOff) 93 | { 94 | flagIndex |= 1 << j; 95 | } 96 | } 97 | 98 | int edgeFlag = edgeFlags[flagIndex]; 99 | if (!edgeFlag.Equals(0)) 100 | { 101 | for (int j = 0; j < 6; j++) 102 | { 103 | if (!(edgeFlag & (1 << j)).Equals(0)) 104 | { 105 | int vi0 = edgeVertexIndices[j * 2]; 106 | int vi1 = edgeVertexIndices[j * 2 + 1]; 107 | float delta = tetrahedronValues[vi1] - tetrahedronValues[vi0]; 108 | float offset = delta.Equals(0f) ? surfaceCutOff : (surfaceCutOff - tetrahedronValues[vi0]) / delta; 109 | edgeVertices[j] = (1 - offset) * tetrahedronPositions[vi0] + offset * tetrahedronPositions[vi1]; 110 | } 111 | } 112 | 113 | for (int j = 0; j < 2; j++) 114 | { 115 | if (triangles[flagIndex * 7 + 3 * j] < 0) break; 116 | 117 | for (int k = 0; k < 3; k++) 118 | { 119 | int v = triangles[flagIndex * 7 + 3 * j + k]; 120 | if (weld) 121 | { 122 | if (weldMap.TryGetValue(edgeVertices[v], out int index)) 123 | { 124 | indexBuffer.Add(index); 125 | } 126 | else 127 | { 128 | weldMap.TryAdd(edgeVertices[v], n); 129 | vertexBuffer.Add(edgeVertices[v]); 130 | indexBuffer.Add(n); 131 | n++; 132 | } 133 | } 134 | else 135 | { 136 | vertexBuffer.Add(edgeVertices[v]); 137 | indexBuffer.Add(n); 138 | n++; 139 | } 140 | } 141 | } 142 | } 143 | } 144 | } 145 | } 146 | } 147 | } 148 | } 149 | 150 | private GenerateMesh job; 151 | 152 | public MeshGeneratorTetrahedron(MeshSettings settings) : base(settings) 153 | { 154 | } 155 | 156 | public override void Schedule() 157 | { 158 | base.Schedule(); 159 | 160 | job = new GenerateMesh() 161 | { 162 | indexBuffer = indexBuffer, 163 | vertexBuffer = vertexBuffer, 164 | surfaceCutOff = settings.SurfaceCutOff, 165 | weld = settings.WeldVertices, 166 | weldMap = weldMap, 167 | 168 | vertexOffsets = lookup.VertexOffsets, 169 | edgeVertexIndices = lookup.VertexIndices, 170 | cubeVertexIndices = lookup.CubeVertexIndices, 171 | edgeFlags = lookup.EdgeFlags, 172 | triangles = lookup.Triangles, 173 | 174 | voxels = VoxelGenerator.Volume.Voxels, 175 | size = VoxelGenerator.Volume.Size, 176 | paddedSize = VoxelGenerator.Volume.PaddedSize, 177 | 178 | edgeVertices = new NativeArray(6, Allocator.TempJob), 179 | cubeVoxels = new NativeArray(8, Allocator.TempJob), 180 | cubePositions = new NativeArray(8, Allocator.TempJob), 181 | tetrahedronPositions = new NativeArray(4, Allocator.TempJob), 182 | tetrahedronValues = new NativeArray(4, Allocator.TempJob) 183 | }; 184 | 185 | jobHandle = job.Schedule(); 186 | } 187 | 188 | public override void Complete(bool updateMesh = true) 189 | { 190 | base.Complete(updateMesh); 191 | job.edgeVertices.Dispose(); 192 | job.cubeVoxels.Dispose(); 193 | job.cubePositions.Dispose(); 194 | job.tetrahedronPositions.Dispose(); 195 | job.tetrahedronValues.Dispose(); 196 | } 197 | } 198 | 199 | 200 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshGeneratorTetrahedron.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a9d83dddb951159438ce35cb8e7858bd 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshLookup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Unity.Collections; 3 | 4 | // Adapted from https://github.com/Scrawk/Marching-Cubes 5 | // https://github.com/Scrawk/Marching-Cubes/blob/master/LICENSE 6 | 7 | public abstract class MeshLookup : IDisposable 8 | { 9 | public static MeshLookup GetInstance(MeshSettings settings = null) 10 | { 11 | if (instance != null) 12 | { 13 | return instance; 14 | } 15 | 16 | switch (settings.GeneratorType) 17 | { 18 | case MeshSettings.Generator.Tetrahedron: 19 | instance = new MeshLookupTetrahedron(); 20 | break; 21 | 22 | case MeshSettings.Generator.Cube: 23 | default: 24 | instance = new MeshLookupCube(); 25 | break; 26 | } 27 | 28 | return instance; 29 | } 30 | 31 | private static MeshLookup instance; 32 | 33 | public NativeArray VertexOffsets { get; protected set; } 34 | public NativeArray VertexIndices { get; protected set; } 35 | public NativeArray CubeVertexIndices { get; protected set; } 36 | public NativeArray EdgeDirections { get; protected set; } 37 | public NativeArray EdgeFlags { get; protected set; } 38 | public NativeArray Triangles { get; protected set; } 39 | 40 | public MeshLookup() 41 | { 42 | VertexOffsets = new NativeArray( 43 | new int[] 44 | { 45 | 0, 0, 0, 46 | 1, 0, 0, 47 | 1, 1, 0, 48 | 0, 1, 0, 49 | 0, 0, 1, 50 | 1, 0, 1, 51 | 1, 1, 1, 52 | 0, 1, 1 53 | }, 54 | Allocator.Persistent 55 | ); 56 | } 57 | 58 | public virtual void Dispose() 59 | { 60 | VertexOffsets.Dispose(); 61 | VertexIndices.Dispose(); 62 | EdgeFlags.Dispose(); 63 | Triangles.Dispose(); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshLookup.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4e7d165d70d772b4ead80ca1926cf7ca 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshLookupCube.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | 3 | // Adapted from https://github.com/Scrawk/Marching-Cubes 4 | // https://github.com/Scrawk/Marching-Cubes/blob/master/LICENSE 5 | 6 | public class MeshLookupCube : MeshLookup 7 | { 8 | public MeshLookupCube() 9 | { 10 | VertexIndices = new NativeArray( 11 | new int[] 12 | { 13 | 0, 1, 14 | 1, 2, 15 | 2, 3, 16 | 3, 0, 17 | 4, 5, 18 | 5, 6, 19 | 6, 7, 20 | 7, 4, 21 | 0, 4, 22 | 1, 5, 23 | 2, 6, 24 | 3, 7 25 | }, 26 | Allocator.Persistent 27 | ); 28 | 29 | EdgeDirections = new NativeArray( 30 | new int[] 31 | { 32 | 1, 0, 0, 33 | 0, 1, 0, 34 | -1, 0, 0, 35 | 0, -1, 0, 36 | 1, 0, 0, 37 | 0, 1, 0, 38 | -1, 0, 0, 39 | 0, -1, 0, 40 | 0, 0, 1, 41 | 0, 0, 1, 42 | 0, 0, 1, 43 | 0, 0, 1 44 | }, 45 | Allocator.Persistent 46 | ); 47 | 48 | EdgeFlags = new NativeArray( 49 | new int[] 50 | { 51 | 0x000, 0x109, 0x203, 0x30a, 0x406, 0x50f, 0x605, 0x70c, 52 | 0x80c, 0x905, 0xa0f, 0xb06, 0xc0a, 0xd03, 0xe09, 0xf00, 53 | 0x190, 0x099, 0x393, 0x29a, 0x596, 0x49f, 0x795, 0x69c, 54 | 0x99c, 0x895, 0xb9f, 0xa96, 0xd9a, 0xc93, 0xf99, 0xe90, 55 | 0x230, 0x339, 0x033, 0x13a, 0x636, 0x73f, 0x435, 0x53c, 56 | 0xa3c, 0xb35, 0x83f, 0x936, 0xe3a, 0xf33, 0xc39, 0xd30, 57 | 0x3a0, 0x2a9, 0x1a3, 0x0aa, 0x7a6, 0x6af, 0x5a5, 0x4ac, 58 | 0xbac, 0xaa5, 0x9af, 0x8a6, 0xfaa, 0xea3, 0xda9, 0xca0, 59 | 0x460, 0x569, 0x663, 0x76a, 0x066, 0x16f, 0x265, 0x36c, 60 | 0xc6c, 0xd65, 0xe6f, 0xf66, 0x86a, 0x963, 0xa69, 0xb60, 61 | 0x5f0, 0x4f9, 0x7f3, 0x6fa, 0x1f6, 0x0ff, 0x3f5, 0x2fc, 62 | 0xdfc, 0xcf5, 0xfff, 0xef6, 0x9fa, 0x8f3, 0xbf9, 0xaf0, 63 | 0x650, 0x759, 0x453, 0x55a, 0x256, 0x35f, 0x055, 0x15c, 64 | 0xe5c, 0xf55, 0xc5f, 0xd56, 0xa5a, 0xb53, 0x859, 0x950, 65 | 0x7c0, 0x6c9, 0x5c3, 0x4ca, 0x3c6, 0x2cf, 0x1c5, 0x0cc, 66 | 0xfcc, 0xec5, 0xdcf, 0xcc6, 0xbca, 0xac3, 0x9c9, 0x8c0, 67 | 0x8c0, 0x9c9, 0xac3, 0xbca, 0xcc6, 0xdcf, 0xec5, 0xfcc, 68 | 0x0cc, 0x1c5, 0x2cf, 0x3c6, 0x4ca, 0x5c3, 0x6c9, 0x7c0, 69 | 0x950, 0x859, 0xb53, 0xa5a, 0xd56, 0xc5f, 0xf55, 0xe5c, 70 | 0x15c, 0x055, 0x35f, 0x256, 0x55a, 0x453, 0x759, 0x650, 71 | 0xaf0, 0xbf9, 0x8f3, 0x9fa, 0xef6, 0xfff, 0xcf5, 0xdfc, 72 | 0x2fc, 0x3f5, 0x0ff, 0x1f6, 0x6fa, 0x7f3, 0x4f9, 0x5f0, 73 | 0xb60, 0xa69, 0x963, 0x86a, 0xf66, 0xe6f, 0xd65, 0xc6c, 74 | 0x36c, 0x265, 0x16f, 0x066, 0x76a, 0x663, 0x569, 0x460, 75 | 0xca0, 0xda9, 0xea3, 0xfaa, 0x8a6, 0x9af, 0xaa5, 0xbac, 76 | 0x4ac, 0x5a5, 0x6af, 0x7a6, 0x0aa, 0x1a3, 0x2a9, 0x3a0, 77 | 0xd30, 0xc39, 0xf33, 0xe3a, 0x936, 0x83f, 0xb35, 0xa3c, 78 | 0x53c, 0x435, 0x73f, 0x636, 0x13a, 0x033, 0x339, 0x230, 79 | 0xe90, 0xf99, 0xc93, 0xd9a, 0xa96, 0xb9f, 0x895, 0x99c, 80 | 0x69c, 0x795, 0x49f, 0x596, 0x29a, 0x393, 0x099, 0x190, 81 | 0xf00, 0xe09, 0xd03, 0xc0a, 0xb06, 0xa0f, 0x905, 0x80c, 82 | 0x70c, 0x605, 0x50f, 0x406, 0x30a, 0x203, 0x109, 0x000 83 | }, 84 | Allocator.Persistent 85 | ); 86 | 87 | Triangles = new NativeArray( 88 | new int[] 89 | { 90 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91 | 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92 | 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 93 | 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94 | 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95 | 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96 | 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97 | 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1, 98 | 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99 | 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 100 | 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101 | 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1, 102 | 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103 | 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1, 104 | 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1, 105 | 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106 | 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107 | 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108 | 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109 | 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1, 110 | 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111 | 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, 112 | 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 113 | 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1, 114 | 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115 | 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1, 116 | 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 117 | 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1, 118 | 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1, 119 | 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1, 120 | 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1, 121 | 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1, 122 | 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123 | 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124 | 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125 | 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1, 126 | 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127 | 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 128 | 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1, 129 | 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1, 130 | 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131 | 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1, 132 | 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, 133 | 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1, 134 | 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, 135 | 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1, 136 | 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1, 137 | 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, 138 | 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 139 | 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1, 140 | 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1, 141 | 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142 | 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1, 143 | 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1, 144 | 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1, 145 | 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, 146 | 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, 147 | 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1, 148 | 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1, 149 | 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1, 150 | 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1, 151 | 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1, 152 | 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1, 153 | 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154 | 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 155 | 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 156 | 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157 | 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 158 | 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 159 | 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1, 160 | 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1, 161 | 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1, 162 | 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163 | 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 164 | 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, 165 | 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1, 166 | 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1, 167 | 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1, 168 | 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1, 169 | 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1, 170 | 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 171 | 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1, 172 | 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, 173 | 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1, 174 | 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, 175 | 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1, 176 | 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1, 177 | 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1, 178 | 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, 179 | 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1, 180 | 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, 181 | 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1, 182 | 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1, 183 | 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1, 184 | 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1, 185 | 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1, 186 | 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 187 | 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, 188 | 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1, 189 | 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1, 190 | 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1, 191 | 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1, 192 | 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193 | 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, 194 | 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1, 195 | 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1, 196 | 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1, 197 | 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1, 198 | 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1, 199 | 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1, 200 | 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1, 201 | 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 202 | 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, 203 | 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1, 204 | 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1, 205 | 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1, 206 | 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1, 207 | 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1, 208 | 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1, 209 | 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210 | 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1, 211 | 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1, 212 | 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1, 213 | 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1, 214 | 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1, 215 | 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216 | 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1, 217 | 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 218 | 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 219 | 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 220 | 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221 | 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 222 | 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 223 | 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 224 | 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, 225 | 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1, 226 | 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227 | 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1, 228 | 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, 229 | 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1, 230 | 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1, 231 | 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1, 232 | 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1, 233 | 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1, 234 | 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 235 | 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1, 236 | 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1, 237 | 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1, 238 | 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1, 239 | 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1, 240 | 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1, 241 | 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1, 242 | 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, 243 | 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 244 | 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1, 245 | 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1, 246 | 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1, 247 | 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1, 248 | 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1, 249 | 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 250 | 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 251 | 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, 252 | 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 253 | 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1, 254 | 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, 255 | 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1, 256 | 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1, 257 | 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1, 258 | 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1, 259 | 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1, 260 | 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1, 261 | 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1, 262 | 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1, 263 | 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1, 264 | 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1, 265 | 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1, 266 | 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1, 267 | 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1, 268 | 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1, 269 | 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1, 270 | 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1, 271 | 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1, 272 | 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1, 273 | 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1, 274 | 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1, 275 | 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1, 276 | 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1, 277 | 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 278 | 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1, 279 | 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1, 280 | 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 281 | 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 282 | 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 283 | 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1, 284 | 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1, 285 | 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1, 286 | 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1, 287 | 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1, 288 | 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1, 289 | 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1, 290 | 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, 291 | 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1, 292 | 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1, 293 | 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1, 294 | 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 295 | 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1, 296 | 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1, 297 | 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 298 | 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, 299 | 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1, 300 | 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1, 301 | 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1, 302 | 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1, 303 | 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1, 304 | 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1, 305 | 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 306 | 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1, 307 | 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1, 308 | 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1, 309 | 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1, 310 | 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1, 311 | 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 312 | 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1, 313 | 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314 | 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1, 315 | 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1, 316 | 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1, 317 | 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1, 318 | 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1, 319 | 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1, 320 | 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1, 321 | 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1, 322 | 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1, 323 | 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1, 324 | 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1, 325 | 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 326 | 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1, 327 | 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1, 328 | 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 329 | 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 330 | 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 331 | 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1, 332 | 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1, 333 | 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 334 | 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1, 335 | 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1, 336 | 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 337 | 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 338 | 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1, 339 | 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 340 | 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1, 341 | 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342 | 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 343 | 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 344 | 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 345 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 346 | }, 347 | Allocator.Persistent 348 | ); 349 | } 350 | 351 | public override void Dispose() 352 | { 353 | base.Dispose(); 354 | EdgeDirections.Dispose(); 355 | } 356 | } 357 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshLookupCube.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0040ce9a088cc0c4fbe66d3fdee093f4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshLookupTetrahedron.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | 3 | // Adapted from https://github.com/Scrawk/Marching-Cubes 4 | // https://github.com/Scrawk/Marching-Cubes/blob/master/LICENSE 5 | 6 | public class MeshLookupTetrahedron : MeshLookup 7 | { 8 | public MeshLookupTetrahedron() 9 | { 10 | VertexIndices = new NativeArray( 11 | new int[] 12 | { 13 | 0, 1, 14 | 1, 2, 15 | 2, 0, 16 | 0, 3, 17 | 1, 3, 18 | 2, 3 19 | }, 20 | Allocator.Persistent 21 | ); 22 | 23 | CubeVertexIndices = new NativeArray( 24 | new int[] 25 | { 26 | 0, 5, 1, 6, 27 | 0, 1, 2, 6, 28 | 0, 2, 3, 6, 29 | 0, 3, 7, 6, 30 | 0, 7, 4, 6, 31 | 0, 4, 5, 6 32 | }, 33 | Allocator.Persistent 34 | ); 35 | 36 | EdgeFlags = new NativeArray( 37 | new int[] 38 | { 39 | 0x00, 0x0d, 0x13, 0x1e, 0x26, 0x2b, 0x35, 0x38, 40 | 0x38, 0x35, 0x2b, 0x26, 0x1e, 0x13, 0x0d, 0x00 41 | }, 42 | Allocator.Persistent 43 | ); 44 | 45 | Triangles = new NativeArray( 46 | new int[] 47 | { 48 | -1, -1, -1, -1, -1, -1, -1, 49 | 0, 3, 2, -1, -1, -1, -1, 50 | 0, 1, 4, -1, -1, -1, -1, 51 | 1, 4, 2, 2, 4, 3, -1, 52 | 1, 2, 5, -1, -1, -1, -1, 53 | 0, 3, 5, 0, 5, 1, -1, 54 | 0, 2, 5, 0, 5, 4, -1, 55 | 5, 4, 3, -1, -1, -1, -1, 56 | 3, 4, 5, -1, -1, -1, -1, 57 | 4, 5, 0, 5, 2, 0, -1, 58 | 1, 5, 0, 5, 3, 0, -1, 59 | 5, 2, 1, -1, -1, -1, -1, 60 | 3, 4, 2, 2, 4, 1, -1, 61 | 4, 1, 0, -1, -1, -1, -1, 62 | 2, 3, 0, -1, -1, -1, -1, 63 | -1, -1, -1, -1, -1, -1, -1 64 | }, 65 | Allocator.Persistent 66 | ); 67 | } 68 | 69 | public override void Dispose() 70 | { 71 | base.Dispose(); 72 | CubeVertexIndices.Dispose(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshLookupTetrahedron.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 52d43be7236b16441bf7e281921d286e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshSettings.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "MeshSettings", menuName = "ScriptableObjects/MeshSettings", order = 2)] 4 | public class MeshSettings : ScriptableObject 5 | { 6 | public enum Generator 7 | { 8 | Cube, 9 | Tetrahedron 10 | } 11 | public Generator GeneratorType = Generator.Tetrahedron; 12 | public bool WeldVertices = true; 13 | public float SurfaceCutOff = 0f; 14 | } 15 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Mesh/MeshSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f8de237fed1245a43b23febf6c861634 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 945b01d60b2b40347aed75971d184c94 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/NoiseSettings.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | [CreateAssetMenu(fileName = "NoiseSettings", menuName = "ScriptableObjects/NoiseSettings", order = 1)] 4 | public class NoiseSettings : VoxelSettings 5 | { 6 | public Vector3 NoiseScale = Vector3.one * 0.1f; 7 | public Vector3 NoiseOffset = Vector3.zero; 8 | } 9 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/NoiseSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5c0e8c433fc5e946a8d4f2564ebda3c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelGenerator.cs: -------------------------------------------------------------------------------- 1 | using Unity.Jobs; 2 | 3 | public static class VoxelGeneratorFactory 4 | { 5 | public static VoxelGenerator CreateInstance(VoxelSettings settings) 6 | { 7 | return new VoxelGeneratorNoise(settings); 8 | } 9 | } 10 | 11 | public class VoxelGenerator : System.IDisposable 12 | { 13 | public VoxelVolume Volume { get; protected set; } 14 | public bool IsCompleted => jobHandle.IsCompleted; 15 | 16 | protected VoxelSettings settings; 17 | protected JobHandle jobHandle; 18 | 19 | public VoxelGenerator(VoxelSettings settings) 20 | { 21 | this.settings = settings; 22 | Volume = new VoxelVolume(settings); 23 | } 24 | 25 | public virtual void Schedule() 26 | { 27 | } 28 | 29 | public virtual void Complete() 30 | { 31 | jobHandle.Complete(); 32 | } 33 | 34 | public virtual void Dispose() 35 | { 36 | Volume.Dispose(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6638ea1403e9d1344a74c7fa42368746 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelGeneratorNoise.cs: -------------------------------------------------------------------------------- 1 | using Unity.Collections; 2 | using Unity.Mathematics; 3 | using Unity.Jobs; 4 | using Unity.Burst; 5 | using UnityEngine; 6 | 7 | public class VoxelGeneratorNoise : VoxelGenerator 8 | { 9 | [BurstCompile] 10 | private struct GenerateVoxels : IJobParallelFor 11 | { 12 | [WriteOnly, NativeDisableParallelForRestriction] 13 | public NativeArray voxels; 14 | 15 | [ReadOnly] 16 | public Vector3Int paddedSize; 17 | [ReadOnly] 18 | public float3 position; 19 | [ReadOnly] 20 | public float3 scale; 21 | [ReadOnly] 22 | public float3 offset; 23 | 24 | public void Execute(int x) 25 | { 26 | int xy = paddedSize.x * paddedSize.y; 27 | 28 | for (int y = 0; y < paddedSize.y; y++) 29 | { 30 | for (int z = 0; z < paddedSize.z; z++) 31 | { 32 | float3 p = new float3( 33 | (position.x + x) * scale.x + offset.x, 34 | (position.y + y) * scale.y + offset.y, 35 | (position.z + z) * scale.z + offset.z 36 | ); 37 | voxels[x + y * paddedSize.x + z * xy] = noise.cnoise(p); 38 | } 39 | } 40 | } 41 | } 42 | 43 | GenerateVoxels job; 44 | 45 | public VoxelGeneratorNoise(VoxelSettings settings) : base(settings) 46 | { 47 | } 48 | 49 | public override void Schedule() 50 | { 51 | NoiseSettings s = settings as NoiseSettings; 52 | 53 | job = new GenerateVoxels() 54 | { 55 | voxels = Volume.Voxels, 56 | paddedSize = Volume.PaddedSize, 57 | position = Volume.Bounds.min, 58 | scale = s.NoiseScale, 59 | offset = s.NoiseOffset 60 | }; 61 | 62 | jobHandle = job.Schedule(Volume.PaddedSize.x, 32); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelGeneratorNoise.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5ad2ade406ca9284d9f0837322397040 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelSettings.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public abstract class VoxelSettings : ScriptableObject 4 | { 5 | public Vector3Int VoxelsPerChunk = Vector3Int.one * 10; 6 | } -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelSettings.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41154582397efdd4794c97f1e3d113a6 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelVolume.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using Unity.Collections; 3 | 4 | public class VoxelVolume : System.IDisposable 5 | { 6 | public Bounds Bounds = new Bounds(); 7 | public Vector3Int Position { get; private set; } 8 | public Vector3Int Size { get; private set; } 9 | public Vector3Int PaddedSize { get; private set; } 10 | public int VoxelCount { get; private set; } 11 | public NativeArray Voxels { get; private set; } 12 | 13 | public VoxelVolume(VoxelSettings settings) 14 | { 15 | Size = settings.VoxelsPerChunk; 16 | Bounds.size = Size; 17 | PaddedSize = Size + Vector3Int.one; 18 | VoxelCount = PaddedSize.x * PaddedSize.y * PaddedSize.z; 19 | Voxels = new NativeArray(VoxelCount, Allocator.Persistent); 20 | } 21 | 22 | public void SetPosition(Vector3Int pos) 23 | { 24 | Bounds.center = pos; 25 | Position = pos; 26 | } 27 | 28 | public void Dispose() 29 | { 30 | Voxels.Dispose(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assets/Cave/Scripts/Voxels/VoxelVolume.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 582f6b1e7b6cf4546bb70c490d6898c4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Cave/Settings.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d38644b9e03ecd142b3faa2aa0dfdb70 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Settings/MeshSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: f8de237fed1245a43b23febf6c861634, type: 3} 13 | m_Name: MeshSettings 14 | m_EditorClassIdentifier: 15 | GeneratorType: 1 16 | WeldVertices: 1 17 | SurfaceCutOff: -0.1 18 | -------------------------------------------------------------------------------- /Assets/Cave/Settings/MeshSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35e27228548a8fa4db49167769357e10 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Cave/Settings/VoxelSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &11400000 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 0 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: c5c0e8c433fc5e946a8d4f2564ebda3c, type: 3} 13 | m_Name: VoxelSettings 14 | m_EditorClassIdentifier: 15 | VoxelsPerChunk: {x: 10, y: 10, z: 10} 16 | NoiseScale: {x: 0.1, y: 0.1, z: 0.1} 17 | NoiseOffset: {x: 0, y: 0, z: 10} 18 | -------------------------------------------------------------------------------- /Assets/Cave/Settings/VoxelSettings.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 53d3437c104919f4ea3a94db6e01ee49 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/DemoScene.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6e87429711e2dea438cc2c3605755f03 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/DemoScene/Cave.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: 1 18 | m_FogColor: {r: 0, g: 0, b: 0, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.05 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: 0} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 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: 0 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: 512 79 | m_PVRBounces: 2 80 | m_PVREnvironmentSampleCount: 256 81 | m_PVREnvironmentReferencePointCount: 2048 82 | m_PVRFilteringMode: 1 83 | m_PVRDenoiserTypeDirect: 1 84 | m_PVRDenoiserTypeIndirect: 1 85 | m_PVRDenoiserTypeAO: 1 86 | m_PVRFilterTypeDirect: 0 87 | m_PVRFilterTypeIndirect: 0 88 | m_PVRFilterTypeAO: 0 89 | m_PVREnvironmentMIS: 1 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 &59911146 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: 59911148} 133 | - component: {fileID: 59911147} 134 | m_Layer: 8 135 | m_Name: CaveSystem 136 | m_TagString: Untagged 137 | m_Icon: {fileID: 0} 138 | m_NavMeshLayer: 0 139 | m_StaticEditorFlags: 0 140 | m_IsActive: 1 141 | --- !u!114 &59911147 142 | MonoBehaviour: 143 | m_ObjectHideFlags: 0 144 | m_CorrespondingSourceObject: {fileID: 0} 145 | m_PrefabInstance: {fileID: 0} 146 | m_PrefabAsset: {fileID: 0} 147 | m_GameObject: {fileID: 59911146} 148 | m_Enabled: 1 149 | m_EditorHideFlags: 0 150 | m_Script: {fileID: 11500000, guid: 8f521691a4d027045932c350eb729bcd, type: 3} 151 | m_Name: 152 | m_EditorClassIdentifier: 153 | voxelSettings: {fileID: 11400000, guid: 53d3437c104919f4ea3a94db6e01ee49, type: 2} 154 | extents: {x: 3, y: 3, z: 3} 155 | updateDistance: 5 156 | updateAngle: 5 157 | --- !u!4 &59911148 158 | Transform: 159 | m_ObjectHideFlags: 0 160 | m_CorrespondingSourceObject: {fileID: 0} 161 | m_PrefabInstance: {fileID: 0} 162 | m_PrefabAsset: {fileID: 0} 163 | m_GameObject: {fileID: 59911146} 164 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 165 | m_LocalPosition: {x: 0, y: 0, z: 0} 166 | m_LocalScale: {x: 1, y: 1, z: 1} 167 | m_Children: [] 168 | m_Father: {fileID: 0} 169 | m_RootOrder: 3 170 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 171 | --- !u!1 &318611157 172 | GameObject: 173 | m_ObjectHideFlags: 0 174 | m_CorrespondingSourceObject: {fileID: 0} 175 | m_PrefabInstance: {fileID: 0} 176 | m_PrefabAsset: {fileID: 0} 177 | serializedVersion: 6 178 | m_Component: 179 | - component: {fileID: 318611160} 180 | - component: {fileID: 318611159} 181 | - component: {fileID: 318611158} 182 | - component: {fileID: 318611164} 183 | m_Layer: 0 184 | m_Name: Camera 185 | m_TagString: Untagged 186 | m_Icon: {fileID: 0} 187 | m_NavMeshLayer: 0 188 | m_StaticEditorFlags: 0 189 | m_IsActive: 1 190 | --- !u!81 &318611158 191 | AudioListener: 192 | m_ObjectHideFlags: 0 193 | m_CorrespondingSourceObject: {fileID: 0} 194 | m_PrefabInstance: {fileID: 0} 195 | m_PrefabAsset: {fileID: 0} 196 | m_GameObject: {fileID: 318611157} 197 | m_Enabled: 1 198 | --- !u!20 &318611159 199 | Camera: 200 | m_ObjectHideFlags: 0 201 | m_CorrespondingSourceObject: {fileID: 0} 202 | m_PrefabInstance: {fileID: 0} 203 | m_PrefabAsset: {fileID: 0} 204 | m_GameObject: {fileID: 318611157} 205 | m_Enabled: 1 206 | serializedVersion: 2 207 | m_ClearFlags: 2 208 | m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0} 209 | m_projectionMatrixMode: 1 210 | m_GateFitMode: 2 211 | m_FOVAxisMode: 0 212 | m_SensorSize: {x: 36, y: 24} 213 | m_LensShift: {x: 0, y: 0} 214 | m_FocalLength: 50 215 | m_NormalizedViewPortRect: 216 | serializedVersion: 2 217 | x: 0 218 | y: 0 219 | width: 1 220 | height: 1 221 | near clip plane: 0.3 222 | far clip plane: 250 223 | field of view: 60 224 | orthographic: 0 225 | orthographic size: 5 226 | m_Depth: 0 227 | m_CullingMask: 228 | serializedVersion: 2 229 | m_Bits: 256 230 | m_RenderingPath: -1 231 | m_TargetTexture: {fileID: 0} 232 | m_TargetDisplay: 0 233 | m_TargetEye: 3 234 | m_HDR: 1 235 | m_AllowMSAA: 1 236 | m_AllowDynamicResolution: 0 237 | m_ForceIntoRT: 0 238 | m_OcclusionCulling: 1 239 | m_StereoConvergence: 10 240 | m_StereoSeparation: 0.022 241 | --- !u!4 &318611160 242 | Transform: 243 | m_ObjectHideFlags: 0 244 | m_CorrespondingSourceObject: {fileID: 0} 245 | m_PrefabInstance: {fileID: 0} 246 | m_PrefabAsset: {fileID: 0} 247 | m_GameObject: {fileID: 318611157} 248 | m_LocalRotation: {x: -0.046711, y: -0.8464505, z: -0.075305544, w: 0.52504164} 249 | m_LocalPosition: {x: 1.613, y: 8.92, z: -6.877} 250 | m_LocalScale: {x: 1, y: 1, z: 1} 251 | m_Children: [] 252 | m_Father: {fileID: 0} 253 | m_RootOrder: 1 254 | m_LocalEulerAnglesHint: {x: 0, y: -120, z: 0} 255 | --- !u!114 &318611164 256 | MonoBehaviour: 257 | m_ObjectHideFlags: 0 258 | m_CorrespondingSourceObject: {fileID: 0} 259 | m_PrefabInstance: {fileID: 0} 260 | m_PrefabAsset: {fileID: 0} 261 | m_GameObject: {fileID: 318611157} 262 | m_Enabled: 1 263 | m_EditorHideFlags: 0 264 | m_Script: {fileID: 11500000, guid: 168cef5bed755584cafad2f5f295066d, type: 3} 265 | m_Name: 266 | m_EditorClassIdentifier: 267 | speed: 10 268 | positionDampTime: 0.2 269 | tangentDampTime: 3 270 | farDetectionRange: 15 271 | obstacleDetectionRange: 2 272 | advanceFrameRatio: 0.25 273 | splineResolution: 25 274 | --- !u!1 &735342970 275 | GameObject: 276 | m_ObjectHideFlags: 0 277 | m_CorrespondingSourceObject: {fileID: 0} 278 | m_PrefabInstance: {fileID: 0} 279 | m_PrefabAsset: {fileID: 0} 280 | serializedVersion: 6 281 | m_Component: 282 | - component: {fileID: 735342971} 283 | m_Layer: 0 284 | m_Name: Lights 285 | m_TagString: Untagged 286 | m_Icon: {fileID: 0} 287 | m_NavMeshLayer: 0 288 | m_StaticEditorFlags: 0 289 | m_IsActive: 1 290 | --- !u!4 &735342971 291 | Transform: 292 | m_ObjectHideFlags: 0 293 | m_CorrespondingSourceObject: {fileID: 0} 294 | m_PrefabInstance: {fileID: 0} 295 | m_PrefabAsset: {fileID: 0} 296 | m_GameObject: {fileID: 735342970} 297 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 298 | m_LocalPosition: {x: -3.25, y: 3.8865, z: -10.551} 299 | m_LocalScale: {x: 1, y: 1, z: 1} 300 | m_Children: 301 | - {fileID: 1426241659} 302 | - {fileID: 1995563107} 303 | - {fileID: 900699664} 304 | m_Father: {fileID: 0} 305 | m_RootOrder: 0 306 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 307 | --- !u!1 &900699662 308 | GameObject: 309 | m_ObjectHideFlags: 0 310 | m_CorrespondingSourceObject: {fileID: 0} 311 | m_PrefabInstance: {fileID: 0} 312 | m_PrefabAsset: {fileID: 0} 313 | serializedVersion: 6 314 | m_Component: 315 | - component: {fileID: 900699664} 316 | - component: {fileID: 900699663} 317 | m_Layer: 0 318 | m_Name: Blue 319 | m_TagString: Untagged 320 | m_Icon: {fileID: 0} 321 | m_NavMeshLayer: 0 322 | m_StaticEditorFlags: 0 323 | m_IsActive: 1 324 | --- !u!108 &900699663 325 | Light: 326 | m_ObjectHideFlags: 0 327 | m_CorrespondingSourceObject: {fileID: 0} 328 | m_PrefabInstance: {fileID: 0} 329 | m_PrefabAsset: {fileID: 0} 330 | m_GameObject: {fileID: 900699662} 331 | m_Enabled: 1 332 | serializedVersion: 10 333 | m_Type: 1 334 | m_Shape: 0 335 | m_Color: {r: 0.21568628, g: 0.33333334, b: 0.5411765, a: 1} 336 | m_Intensity: 1 337 | m_Range: 10 338 | m_SpotAngle: 30 339 | m_InnerSpotAngle: 21.80208 340 | m_CookieSize: 10 341 | m_Shadows: 342 | m_Type: 0 343 | m_Resolution: -1 344 | m_CustomResolution: -1 345 | m_Strength: 1 346 | m_Bias: 0.05 347 | m_NormalBias: 0.4 348 | m_NearPlane: 0.2 349 | m_CullingMatrixOverride: 350 | e00: 1 351 | e01: 0 352 | e02: 0 353 | e03: 0 354 | e10: 0 355 | e11: 1 356 | e12: 0 357 | e13: 0 358 | e20: 0 359 | e21: 0 360 | e22: 1 361 | e23: 0 362 | e30: 0 363 | e31: 0 364 | e32: 0 365 | e33: 1 366 | m_UseCullingMatrixOverride: 0 367 | m_Cookie: {fileID: 0} 368 | m_DrawHalo: 0 369 | m_Flare: {fileID: 0} 370 | m_RenderMode: 0 371 | m_CullingMask: 372 | serializedVersion: 2 373 | m_Bits: 4294967295 374 | m_RenderingLayerMask: 1 375 | m_Lightmapping: 4 376 | m_LightShadowCasterMode: 0 377 | m_AreaSize: {x: 1, y: 1} 378 | m_BounceIntensity: 1 379 | m_ColorTemperature: 6570 380 | m_UseColorTemperature: 0 381 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 382 | m_UseBoundingSphereOverride: 0 383 | m_ShadowRadius: 0 384 | m_ShadowAngle: 0 385 | --- !u!4 &900699664 386 | Transform: 387 | m_ObjectHideFlags: 0 388 | m_CorrespondingSourceObject: {fileID: 0} 389 | m_PrefabInstance: {fileID: 0} 390 | m_PrefabAsset: {fileID: 0} 391 | m_GameObject: {fileID: 900699662} 392 | m_LocalRotation: {x: 0.7071068, y: -0, z: -0, w: 0.7071068} 393 | m_LocalPosition: {x: 0, y: 0, z: 0} 394 | m_LocalScale: {x: 1, y: 1, z: 1} 395 | m_Children: [] 396 | m_Father: {fileID: 735342971} 397 | m_RootOrder: 2 398 | m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} 399 | --- !u!1 &1426241657 400 | GameObject: 401 | m_ObjectHideFlags: 0 402 | m_CorrespondingSourceObject: {fileID: 0} 403 | m_PrefabInstance: {fileID: 0} 404 | m_PrefabAsset: {fileID: 0} 405 | serializedVersion: 6 406 | m_Component: 407 | - component: {fileID: 1426241659} 408 | - component: {fileID: 1426241658} 409 | m_Layer: 0 410 | m_Name: Red 411 | m_TagString: Untagged 412 | m_Icon: {fileID: 0} 413 | m_NavMeshLayer: 0 414 | m_StaticEditorFlags: 0 415 | m_IsActive: 1 416 | --- !u!108 &1426241658 417 | Light: 418 | m_ObjectHideFlags: 0 419 | m_CorrespondingSourceObject: {fileID: 0} 420 | m_PrefabInstance: {fileID: 0} 421 | m_PrefabAsset: {fileID: 0} 422 | m_GameObject: {fileID: 1426241657} 423 | m_Enabled: 1 424 | serializedVersion: 10 425 | m_Type: 1 426 | m_Shape: 0 427 | m_Color: {r: 1, g: 0.8784314, b: 0.80784315, a: 1} 428 | m_Intensity: 1 429 | m_Range: 10 430 | m_SpotAngle: 30 431 | m_InnerSpotAngle: 21.80208 432 | m_CookieSize: 10 433 | m_Shadows: 434 | m_Type: 0 435 | m_Resolution: -1 436 | m_CustomResolution: -1 437 | m_Strength: 1 438 | m_Bias: 0.05 439 | m_NormalBias: 0.4 440 | m_NearPlane: 0.2 441 | m_CullingMatrixOverride: 442 | e00: 1 443 | e01: 0 444 | e02: 0 445 | e03: 0 446 | e10: 0 447 | e11: 1 448 | e12: 0 449 | e13: 0 450 | e20: 0 451 | e21: 0 452 | e22: 1 453 | e23: 0 454 | e30: 0 455 | e31: 0 456 | e32: 0 457 | e33: 1 458 | m_UseCullingMatrixOverride: 0 459 | m_Cookie: {fileID: 0} 460 | m_DrawHalo: 0 461 | m_Flare: {fileID: 0} 462 | m_RenderMode: 0 463 | m_CullingMask: 464 | serializedVersion: 2 465 | m_Bits: 4294967295 466 | m_RenderingLayerMask: 1 467 | m_Lightmapping: 4 468 | m_LightShadowCasterMode: 0 469 | m_AreaSize: {x: 1, y: 1} 470 | m_BounceIntensity: 1 471 | m_ColorTemperature: 6570 472 | m_UseColorTemperature: 0 473 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 474 | m_UseBoundingSphereOverride: 0 475 | m_ShadowRadius: 0 476 | m_ShadowAngle: 0 477 | --- !u!4 &1426241659 478 | Transform: 479 | m_ObjectHideFlags: 0 480 | m_CorrespondingSourceObject: {fileID: 0} 481 | m_PrefabInstance: {fileID: 0} 482 | m_PrefabAsset: {fileID: 0} 483 | m_GameObject: {fileID: 1426241657} 484 | m_LocalRotation: {x: -0.35355338, y: 0.35355338, z: 0.1464466, w: 0.8535535} 485 | m_LocalPosition: {x: 0, y: 0, z: 0} 486 | m_LocalScale: {x: 1, y: 1, z: 1} 487 | m_Children: [] 488 | m_Father: {fileID: 735342971} 489 | m_RootOrder: 0 490 | m_LocalEulerAnglesHint: {x: -45, y: 45, z: 0} 491 | --- !u!1 &1974324444 492 | GameObject: 493 | m_ObjectHideFlags: 0 494 | m_CorrespondingSourceObject: {fileID: 0} 495 | m_PrefabInstance: {fileID: 0} 496 | m_PrefabAsset: {fileID: 0} 497 | serializedVersion: 6 498 | m_Component: 499 | - component: {fileID: 1974324446} 500 | - component: {fileID: 1974324445} 501 | m_Layer: 0 502 | m_Name: CaveChunkPool 503 | m_TagString: Untagged 504 | m_Icon: {fileID: 0} 505 | m_NavMeshLayer: 0 506 | m_StaticEditorFlags: 0 507 | m_IsActive: 1 508 | --- !u!114 &1974324445 509 | MonoBehaviour: 510 | m_ObjectHideFlags: 0 511 | m_CorrespondingSourceObject: {fileID: 0} 512 | m_PrefabInstance: {fileID: 0} 513 | m_PrefabAsset: {fileID: 0} 514 | m_GameObject: {fileID: 1974324444} 515 | m_Enabled: 1 516 | m_EditorHideFlags: 0 517 | m_Script: {fileID: 11500000, guid: 85d3986725d195f468c9944a79998b53, type: 3} 518 | m_Name: 519 | m_EditorClassIdentifier: 520 | voxelSettings: {fileID: 11400000, guid: 53d3437c104919f4ea3a94db6e01ee49, type: 2} 521 | meshSettings: {fileID: 11400000, guid: 35e27228548a8fa4db49167769357e10, type: 2} 522 | chunkPrefab: {fileID: 1189921576992816193, guid: 15469a8436211c84eb52de916f246381, 523 | type: 3} 524 | numWorkers: 64 525 | --- !u!4 &1974324446 526 | Transform: 527 | m_ObjectHideFlags: 0 528 | m_CorrespondingSourceObject: {fileID: 0} 529 | m_PrefabInstance: {fileID: 0} 530 | m_PrefabAsset: {fileID: 0} 531 | m_GameObject: {fileID: 1974324444} 532 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 533 | m_LocalPosition: {x: 0, y: 0, z: 0} 534 | m_LocalScale: {x: 1, y: 1, z: 1} 535 | m_Children: [] 536 | m_Father: {fileID: 0} 537 | m_RootOrder: 2 538 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 539 | --- !u!1 &1995563105 540 | GameObject: 541 | m_ObjectHideFlags: 0 542 | m_CorrespondingSourceObject: {fileID: 0} 543 | m_PrefabInstance: {fileID: 0} 544 | m_PrefabAsset: {fileID: 0} 545 | serializedVersion: 6 546 | m_Component: 547 | - component: {fileID: 1995563107} 548 | - component: {fileID: 1995563106} 549 | m_Layer: 0 550 | m_Name: Green 551 | m_TagString: Untagged 552 | m_Icon: {fileID: 0} 553 | m_NavMeshLayer: 0 554 | m_StaticEditorFlags: 0 555 | m_IsActive: 1 556 | --- !u!108 &1995563106 557 | Light: 558 | m_ObjectHideFlags: 0 559 | m_CorrespondingSourceObject: {fileID: 0} 560 | m_PrefabInstance: {fileID: 0} 561 | m_PrefabAsset: {fileID: 0} 562 | m_GameObject: {fileID: 1995563105} 563 | m_Enabled: 1 564 | serializedVersion: 10 565 | m_Type: 1 566 | m_Shape: 0 567 | m_Color: {r: 0.7607843, g: 0.78431374, b: 0.3882353, a: 1} 568 | m_Intensity: 1 569 | m_Range: 10 570 | m_SpotAngle: 30 571 | m_InnerSpotAngle: 21.80208 572 | m_CookieSize: 10 573 | m_Shadows: 574 | m_Type: 0 575 | m_Resolution: -1 576 | m_CustomResolution: -1 577 | m_Strength: 1 578 | m_Bias: 0.05 579 | m_NormalBias: 0.4 580 | m_NearPlane: 0.2 581 | m_CullingMatrixOverride: 582 | e00: 1 583 | e01: 0 584 | e02: 0 585 | e03: 0 586 | e10: 0 587 | e11: 1 588 | e12: 0 589 | e13: 0 590 | e20: 0 591 | e21: 0 592 | e22: 1 593 | e23: 0 594 | e30: 0 595 | e31: 0 596 | e32: 0 597 | e33: 1 598 | m_UseCullingMatrixOverride: 0 599 | m_Cookie: {fileID: 0} 600 | m_DrawHalo: 0 601 | m_Flare: {fileID: 0} 602 | m_RenderMode: 0 603 | m_CullingMask: 604 | serializedVersion: 2 605 | m_Bits: 4294967295 606 | m_RenderingLayerMask: 1 607 | m_Lightmapping: 4 608 | m_LightShadowCasterMode: 0 609 | m_AreaSize: {x: 1, y: 1} 610 | m_BounceIntensity: 1 611 | m_ColorTemperature: 6570 612 | m_UseColorTemperature: 0 613 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} 614 | m_UseBoundingSphereOverride: 0 615 | m_ShadowRadius: 0 616 | m_ShadowAngle: 0 617 | --- !u!4 &1995563107 618 | Transform: 619 | m_ObjectHideFlags: 0 620 | m_CorrespondingSourceObject: {fileID: 0} 621 | m_PrefabInstance: {fileID: 0} 622 | m_PrefabAsset: {fileID: 0} 623 | m_GameObject: {fileID: 1995563105} 624 | m_LocalRotation: {x: 0.8535535, y: 0.1464466, z: -0.35355338, w: 0.35355338} 625 | m_LocalPosition: {x: 0, y: 0, z: 0} 626 | m_LocalScale: {x: 1, y: 1, z: 1} 627 | m_Children: [] 628 | m_Father: {fileID: 735342971} 629 | m_RootOrder: 1 630 | m_LocalEulerAnglesHint: {x: 135, y: 45, z: 0} 631 | -------------------------------------------------------------------------------- /Assets/DemoScene/Cave.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45db70f3fdee26d4f88af0eee765d53b 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/DemoScene/FlyCam.cs: -------------------------------------------------------------------------------- 1 | using JPBotelho; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(Camera))] 6 | public class FlyCam : MonoBehaviour 7 | { 8 | [SerializeField] 9 | private float speed = 10; 10 | [SerializeField] 11 | private float positionDampTime = 0.2f; 12 | [SerializeField] 13 | private float tangentDampTime = 4; 14 | [SerializeField] 15 | private float farDetectionRange = 25; 16 | [SerializeField] 17 | private float obstacleDetectionRange = 2; 18 | [SerializeField] 19 | private float advanceFrameRatio = 0.5f; 20 | [SerializeField] 21 | private int splineResolution = 20; 22 | 23 | private const int mask = 1 << 8; 24 | private const int controlPointCount = 6; 25 | private int maxIndex; 26 | private int index; 27 | private float t; 28 | 29 | private Frame frame; 30 | private CaveSystem cave; 31 | private CatmullRom spline; 32 | private CatmullRom.CatmullRomPoint[] splinePoints; 33 | private Queue controlPoints; 34 | private bool waitForCaveReady = true; 35 | 36 | private Vector3 position; 37 | private Vector3 posDampVelo; 38 | private Vector3 tangent; 39 | private Vector3 tanDampVelo; 40 | 41 | void Start() 42 | { 43 | cave = FindObjectOfType(); 44 | cave.Initialize(transform); 45 | cave.OnReset(); 46 | 47 | frame = new Frame(transform); 48 | spline = new CatmullRom(splineResolution); 49 | controlPoints = new Queue(controlPointCount); 50 | controlPoints.Enqueue(frame.origin); 51 | maxIndex = splineResolution * 3 - 1; 52 | } 53 | 54 | private void LateUpdate() 55 | { 56 | if (!waitForCaveReady) 57 | { 58 | WalkSpline(); 59 | } 60 | else if (cave.AllChunksActive()) 61 | { 62 | waitForCaveReady = false; 63 | UpdateSpline(); 64 | } 65 | } 66 | 67 | private void WalkSpline() 68 | { 69 | if (t < 1f) 70 | { 71 | t += speed * Time.deltaTime; 72 | } 73 | else 74 | { 75 | t -= 1f; 76 | if (index < maxIndex) 77 | { 78 | index++; 79 | } 80 | else 81 | { 82 | index = splineResolution * 2; 83 | controlPoints.Dequeue(); 84 | UpdateSpline(); 85 | } 86 | } 87 | 88 | var a = splinePoints[index]; 89 | var b = splinePoints[index + 1]; 90 | Vector3 pos = Vector3.Lerp(a.position, b.position, t); 91 | Vector3 tan = Vector3.Lerp(a.tangent, b.tangent, t); 92 | 93 | pos += GetCentroid(transform, obstacleDetectionRange); 94 | position = Vector3.SmoothDamp(position, pos, ref posDampVelo, positionDampTime); 95 | tangent = Vector3.SmoothDamp(tangent, tan, ref tanDampVelo, tangentDampTime); 96 | transform.position = position; 97 | transform.rotation = Quaternion.LookRotation(tangent); 98 | 99 | // spline.DrawSpline(Color.white); 100 | } 101 | 102 | private void UpdateSpline() 103 | { 104 | while (controlPoints.Count < controlPointCount) 105 | { 106 | frame.origin += GetFarthest(frame, farDetectionRange) * advanceFrameRatio; 107 | controlPoints.Enqueue(frame.origin); 108 | } 109 | spline.Update(controlPoints); 110 | splinePoints = spline.GetPoints(); 111 | } 112 | 113 | private static Vector3 GetFarthest(Frame frame, float range, float angle = 45, float resolution = 6) 114 | { 115 | Ray[] rays = frame.GetRays(angle); 116 | Vector3 delta = Vector3.zero; 117 | 118 | for (int i = 0; i < rays.Length; i++) 119 | { 120 | if (Physics.Raycast(rays[i], out RaycastHit hit, range, mask)) 121 | { 122 | if (hit.distance > delta.magnitude) 123 | { 124 | delta = hit.point - rays[i].origin; 125 | } 126 | } 127 | else 128 | { 129 | delta = rays[i].direction * range; 130 | break; 131 | } 132 | } 133 | 134 | if (angle < resolution) 135 | { 136 | // 5.625 (45/8) degree resolution in 4th iteration, 17 raycasts total. 137 | return delta; 138 | } 139 | 140 | frame.Update(delta.normalized); 141 | return GetFarthest(frame, range, angle * 0.5f, resolution); 142 | } 143 | 144 | public static Vector3 GetCentroid(Transform origin, float range) 145 | { 146 | Vector3 c = Vector3.zero; 147 | Vector3 p = origin.position; 148 | Quaternion r = origin.rotation; 149 | 150 | for (int i = 0; i < sphere.Length; i++) 151 | { 152 | Vector3 d = r * sphere[i]; 153 | c += Physics.Raycast(p, d, out RaycastHit hit, range, mask) 154 | ? hit.point - p 155 | : d * range; 156 | } 157 | 158 | return c / (float)sphere.Length; 159 | } 160 | 161 | private static Vector3[] sphere = CalcFibonacciSphere(32); 162 | 163 | private static Vector3[] CalcFibonacciSphere(int n) 164 | { 165 | Vector3[] v = new Vector3[n]; 166 | float phi = Mathf.PI * (3f - Mathf.Sqrt(5f)); 167 | for (int i = 0; i < n; i++) 168 | { 169 | float y = 1 - (i / (n - 1f)) * 2; 170 | float theta = phi * i; 171 | float r = Mathf.Sqrt(1 - y * y); 172 | float x = Mathf.Cos(theta) * r; 173 | float z = Mathf.Sin(theta) * r; 174 | v[i] = new Vector3(x, y, z); 175 | } 176 | return v; 177 | } 178 | } 179 | 180 | public class Frame 181 | { 182 | public Vector3 origin; 183 | public Vector3 right; 184 | public Vector3 up; 185 | public Vector3 forward; 186 | 187 | public Frame(Transform transform) : this(transform.position, transform.forward, transform.up) 188 | { 189 | } 190 | 191 | public Frame(Vector3 origin, Vector3 forward, Vector3 up) 192 | { 193 | this.origin = origin; 194 | Update(forward, up); 195 | } 196 | 197 | public void Update(Vector3 forward, Vector3 up) 198 | { 199 | this.forward = forward; 200 | this.right = Vector3.Cross(forward, -up); 201 | this.up = Vector3.Cross(forward, right); 202 | } 203 | 204 | public void Update(Vector3 forward) 205 | { 206 | Update(forward, up); 207 | } 208 | 209 | public Ray[] GetRays(float angle) 210 | { 211 | return angle < 45 212 | ? new Ray[4] 213 | { 214 | new Ray(origin, Quaternion.AngleAxis(angle, up) * forward), 215 | new Ray(origin, Quaternion.AngleAxis(angle, -up) * forward), 216 | new Ray(origin, Quaternion.AngleAxis(angle, right) * forward), 217 | new Ray(origin, Quaternion.AngleAxis(angle, -right) * forward) 218 | } 219 | : new Ray[5] 220 | { 221 | new Ray(origin, forward), // only needed for 1st iteration 222 | new Ray(origin, Quaternion.AngleAxis(angle, up) * forward), 223 | new Ray(origin, Quaternion.AngleAxis(angle, -up) * forward), 224 | new Ray(origin, Quaternion.AngleAxis(angle, right) * forward), 225 | new Ray(origin, Quaternion.AngleAxis(angle, -right) * forward) 226 | }; 227 | } 228 | 229 | public void Draw() 230 | { 231 | Debug.DrawRay(origin, right, Color.red); 232 | Debug.DrawRay(origin, up, Color.green); 233 | Debug.DrawRay(origin, forward, Color.blue); 234 | } 235 | } -------------------------------------------------------------------------------- /Assets/DemoScene/FlyCam.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 168cef5bed755584cafad2f5f295066d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/DemoScene/Spline.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using UnityEngine; 3 | using System.Linq; 4 | using System.Collections.Generic; 5 | 6 | namespace JPBotelho 7 | { 8 | /* 9 | https://github.com/JPBotelho/Catmull-Rom-Splines 10 | 11 | Catmull-Rom splines are Hermite curves with special tangent values. 12 | Hermite curve formula: 13 | (2t^3 - 3t^2 + 1) * p0 + (t^3 - 2t^2 + t) * m0 + (-2t^3 + 3t^2) * p1 + (t^3 - t^2) * m1 14 | For points p0 and p1 passing through points m0 and m1 interpolated over t = [0, 1] 15 | Tangent M[k] = (P[k+1] - P[k-1]) / 2 16 | */ 17 | public class CatmullRom 18 | { 19 | // Struct to keep position, normal and tangent of a spline point 20 | [System.Serializable] 21 | public struct CatmullRomPoint 22 | { 23 | public Vector3 position; 24 | public Vector3 tangent; 25 | public Vector3 normal; 26 | 27 | public CatmullRomPoint(Vector3 position, Vector3 tangent, Vector3 normal) 28 | { 29 | this.position = position; 30 | this.tangent = tangent; 31 | this.normal = normal; 32 | } 33 | } 34 | 35 | private int resolution; // Amount of points between control points. [Tesselation factor] 36 | private bool closedLoop; 37 | 38 | private CatmullRomPoint[] splinePoints; // Generated spline points 39 | 40 | private Vector3[] controlPoints; 41 | 42 | // Returns spline points. Count is contorolPoints * resolution + [resolution] points if closed loop. 43 | public CatmullRomPoint[] GetPoints() 44 | { 45 | if(splinePoints == null) 46 | { 47 | throw new System.NullReferenceException("Spline not Initialized!"); 48 | } 49 | 50 | return splinePoints; 51 | } 52 | 53 | public CatmullRom(int resolution, bool closedLoop = false) 54 | { 55 | this.resolution = resolution; 56 | this.closedLoop = closedLoop; 57 | } 58 | 59 | // Updates control points 60 | public void Update(IEnumerable controlPoints) 61 | { 62 | this.controlPoints = controlPoints.ToArray(); 63 | GenerateSplinePoints(); 64 | } 65 | 66 | // Updates resolution and closed loop values 67 | public void Update(int resolution, bool closedLoop) 68 | { 69 | if(resolution < 2) 70 | { 71 | throw new ArgumentException("Invalid Resolution. Make sure it's >= 1"); 72 | } 73 | this.resolution = resolution; 74 | this.closedLoop = closedLoop; 75 | 76 | GenerateSplinePoints(); 77 | } 78 | 79 | // Draws a line between every point and the next. 80 | public void DrawSpline(Color color) 81 | { 82 | if(ValidatePoints()) 83 | { 84 | for(int i = 0; i < splinePoints.Length; i++) 85 | { 86 | if(i == splinePoints.Length - 1 && closedLoop) 87 | { 88 | Debug.DrawLine(splinePoints[i].position, splinePoints[0].position, color); 89 | } 90 | else if(i < splinePoints.Length - 1) 91 | { 92 | Debug.DrawLine(splinePoints[i].position, splinePoints[i+1].position, color); 93 | } 94 | } 95 | } 96 | } 97 | 98 | public void DrawNormals(float extrusion, Color color) 99 | { 100 | if(ValidatePoints()) 101 | { 102 | for(int i = 0; i < splinePoints.Length; i++) 103 | { 104 | Debug.DrawLine(splinePoints[i].position, splinePoints[i].position + splinePoints[i].normal * extrusion, color); 105 | } 106 | } 107 | } 108 | 109 | public void DrawTangents(float extrusion, Color color) 110 | { 111 | if(ValidatePoints()) 112 | { 113 | for(int i = 0; i < splinePoints.Length; i++) 114 | { 115 | Debug.DrawLine(splinePoints[i].position, splinePoints[i].position + splinePoints[i].tangent * extrusion, color); 116 | } 117 | } 118 | } 119 | 120 | // Validates if splinePoints have been set already. Throws nullref exception. 121 | private bool ValidatePoints() 122 | { 123 | if(splinePoints == null) 124 | { 125 | throw new NullReferenceException("Spline not initialized!"); 126 | } 127 | return splinePoints != null; 128 | } 129 | 130 | // Sets the length of the point array based on resolution/closed loop. 131 | private void InitializeProperties() 132 | { 133 | int pointsToCreate; 134 | if (closedLoop) 135 | { 136 | pointsToCreate = resolution * controlPoints.Length; // Loops back to the beggining, so no need to adjust for arrays starting at 0 137 | } 138 | else 139 | { 140 | pointsToCreate = resolution * (controlPoints.Length - 1); 141 | } 142 | 143 | splinePoints = new CatmullRomPoint[pointsToCreate]; 144 | } 145 | 146 | // Math stuff to generate the spline points 147 | private void GenerateSplinePoints() 148 | { 149 | InitializeProperties(); 150 | 151 | Vector3 p0, p1; // Start point, end point 152 | Vector3 m0, m1; // Tangents 153 | 154 | // First for loop goes through each individual control point and connects it to the next, so 0-1, 1-2, 2-3 and so on 155 | int closedAdjustment = closedLoop ? 0 : 1; 156 | for (int currentPoint = 0; currentPoint < controlPoints.Length - closedAdjustment; currentPoint++) 157 | { 158 | bool closedLoopFinalPoint = (closedLoop && currentPoint == controlPoints.Length - 1); 159 | 160 | p0 = controlPoints[currentPoint]; 161 | 162 | if(closedLoopFinalPoint) 163 | { 164 | p1 = controlPoints[0]; 165 | } 166 | else 167 | { 168 | p1 = controlPoints[currentPoint + 1]; 169 | } 170 | 171 | // m0 172 | if (currentPoint == 0) // Tangent M[k] = (P[k+1] - P[k-1]) / 2 173 | { 174 | if(closedLoop) 175 | { 176 | m0 = p1 - controlPoints[controlPoints.Length - 1]; 177 | } 178 | else 179 | { 180 | m0 = p1 - p0; 181 | } 182 | } 183 | else 184 | { 185 | m0 = p1 - controlPoints[currentPoint - 1]; 186 | } 187 | 188 | // m1 189 | if (closedLoop) 190 | { 191 | if (currentPoint == controlPoints.Length - 1) // Last point case 192 | { 193 | m1 = controlPoints[(currentPoint + 2) % controlPoints.Length] - p0; 194 | } 195 | else if (currentPoint == 0) // First point case 196 | { 197 | m1 = controlPoints[currentPoint + 2] - p0; 198 | } 199 | else 200 | { 201 | m1 = controlPoints[(currentPoint + 2) % controlPoints.Length] - p0; 202 | } 203 | } 204 | else 205 | { 206 | if (currentPoint < controlPoints.Length - 2) 207 | { 208 | m1 = controlPoints[(currentPoint + 2) % controlPoints.Length] - p0; 209 | } 210 | else 211 | { 212 | m1 = p1 - p0; 213 | } 214 | } 215 | 216 | m0 *= 0.5f; // Doing this here instead of in every single above statement 217 | m1 *= 0.5f; 218 | 219 | float pointStep = 1.0f / resolution; 220 | 221 | if ((currentPoint == controlPoints.Length - 2 && !closedLoop) || closedLoopFinalPoint) // Final point 222 | { 223 | pointStep = 1.0f / (resolution - 1); // last point of last segment should reach p1 224 | } 225 | 226 | // Creates [resolution] points between this control point and the next 227 | for (int tesselatedPoint = 0; tesselatedPoint < resolution; tesselatedPoint++) 228 | { 229 | float t = tesselatedPoint * pointStep; 230 | 231 | CatmullRomPoint point = Evaluate(p0, p1, m0, m1, t); 232 | 233 | splinePoints[currentPoint * resolution + tesselatedPoint] = point; 234 | } 235 | } 236 | } 237 | 238 | // Evaluates curve at t[0, 1]. Returns point/normal/tan struct. [0, 1] means clamped between 0 and 1. 239 | public static CatmullRomPoint Evaluate(Vector3 start, Vector3 end, Vector3 tanPoint1, Vector3 tanPoint2, float t) 240 | { 241 | Vector3 position = CalculatePosition(start, end, tanPoint1, tanPoint2, t); 242 | Vector3 tangent = CalculateTangent(start, end, tanPoint1, tanPoint2, t); 243 | Vector3 normal = NormalFromTangent(tangent); 244 | 245 | return new CatmullRomPoint(position, tangent, normal); 246 | } 247 | 248 | // Calculates curve position at t[0, 1] 249 | public static Vector3 CalculatePosition(Vector3 start, Vector3 end, Vector3 tanPoint1, Vector3 tanPoint2, float t) 250 | { 251 | // Hermite curve formula: 252 | // (2t^3 - 3t^2 + 1) * p0 + (t^3 - 2t^2 + t) * m0 + (-2t^3 + 3t^2) * p1 + (t^3 - t^2) * m1 253 | Vector3 position = (2.0f * t * t * t - 3.0f * t * t + 1.0f) * start 254 | + (t * t * t - 2.0f * t * t + t) * tanPoint1 255 | + (-2.0f * t * t * t + 3.0f * t * t) * end 256 | + (t * t * t - t * t) * tanPoint2; 257 | 258 | return position; 259 | } 260 | 261 | // Calculates tangent at t[0, 1] 262 | public static Vector3 CalculateTangent(Vector3 start, Vector3 end, Vector3 tanPoint1, Vector3 tanPoint2, float t) 263 | { 264 | // Calculate tangents 265 | // p'(t) = (6t² - 6t)p0 + (3t² - 4t + 1)m0 + (-6t² + 6t)p1 + (3t² - 2t)m1 266 | Vector3 tangent = (6 * t * t - 6 * t) * start 267 | + (3 * t * t - 4 * t + 1) * tanPoint1 268 | + (-6 * t * t + 6 * t) * end 269 | + (3 * t * t - 2 * t) * tanPoint2; 270 | 271 | return tangent.normalized; 272 | } 273 | 274 | // Calculates normal vector from tangent 275 | public static Vector3 NormalFromTangent(Vector3 tangent) 276 | { 277 | return Vector3.Cross(tangent, Vector3.up).normalized / 2; 278 | } 279 | } 280 | } -------------------------------------------------------------------------------- /Assets/DemoScene/Spline.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aae9387d0d938c648a12b8b4781db23a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 Mathias Baske 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 13 | all 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 21 | THE 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.1.4", 6 | "com.unity.jobs": "0.2.9-preview.15", 7 | "com.unity.test-framework": "1.1.11", 8 | "com.unity.textmeshpro": "2.0.1", 9 | "com.unity.timeline": "1.2.13", 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/BurstAotSettings_StandaloneWindows.json: -------------------------------------------------------------------------------- 1 | { 2 | "MonoBehaviour": { 3 | "Version": 2, 4 | "EnableBurstCompilation": true, 5 | "EnableOptimisations": true, 6 | "EnableSafetyChecks": false, 7 | "UsePlatformSDKLinker": false, 8 | "CpuMinTargetX32": 1, 9 | "CpuMaxTargetX32": 2, 10 | "CpuMinTargetX64": 3, 11 | "CpuMaxTargetX64": 4 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /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: 13 7 | m_Gravity: {x: 0, y: -20, 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: 2 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: c8f0ffffc8f0ffffc8f0ffffffffffffc8f0ffffc8f0ffffffffffffffffffffc8f0ffffc8fcffffc8f2ffffc8f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ClothGravity: {x: 0, y: -9.81, z: 0} 26 | m_ContactPairsMode: 0 27 | m_BroadphaseType: 0 28 | m_WorldBounds: 29 | m_Center: {x: 0, y: 0, z: 0} 30 | m_Extent: {x: 250, y: 250, z: 250} 31 | m_WorldSubdivisions: 8 32 | m_FrictionType: 0 33 | m_EnableEnhancedDeterminism: 0 34 | m_EnableUnifiedHeightmaps: 1 35 | m_SolverType: 1 36 | m_DefaultMaxAngularSpeed: 7 37 | -------------------------------------------------------------------------------- /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 | - enabled: 0 9 | path: Assets/DemoScene/Cave.unity 10 | guid: 45db70f3fdee26d4f88af0eee765d53b 11 | - enabled: 1 12 | path: Assets/Scenes/Track.unity 13 | guid: daebd3cf916f4b94ba3d3e5b29c4c2fe 14 | m_configObjects: {} 15 | -------------------------------------------------------------------------------- /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: 0 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: 0 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 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 41 | m_PreloadedShaders: [] 42 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 43 | type: 0} 44 | m_CustomRenderPipeline: {fileID: 0} 45 | m_TransparencySortMode: 0 46 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 47 | m_DefaultRenderingPath: 1 48 | m_DefaultMobileRenderingPath: 1 49 | m_TierSettings: [] 50 | m_LightmapStripping: 0 51 | m_FogStripping: 0 52 | m_InstancingStripping: 0 53 | m_LightmapKeepPlain: 1 54 | m_LightmapKeepDirCombined: 1 55 | m_LightmapKeepDynamicPlain: 1 56 | m_LightmapKeepDynamicDirCombined: 1 57 | m_LightmapKeepShadowMask: 1 58 | m_LightmapKeepSubtractive: 1 59 | m_FogKeepLinear: 1 60 | m_FogKeepExp: 1 61 | m_FogKeepExp2: 1 62 | m_AlbedoSwatchInfos: [] 63 | m_LightsUseLinearIntensity: 0 64 | m_LightsUseColorTemperature: 0 65 | m_LogWhenShaderIsCompiled: 0 66 | m_AllowEnlightenSupportForUpgradedProject: 0 67 | -------------------------------------------------------------------------------- /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: cd4201fef6ee65d488b440138e02dceb 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: mbaske 16 | productName: procedural-cave 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: 128 46 | defaultScreenHeight: 128 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: 0 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: 1 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: 0 94 | fullscreenMode: 3 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 | xboxOneEnableTypeOptimization: 0 107 | xboxOnePresentImmediateThreshold: 0 108 | switchQueueCommandMemory: 0 109 | switchQueueControlMemory: 16384 110 | switchQueueComputeMemory: 262144 111 | switchNVNShaderPoolsGranularity: 33554432 112 | switchNVNDefaultPoolsGranularity: 16777216 113 | switchNVNOtherPoolsGranularity: 16777216 114 | vulkanNumSwapchainBuffers: 3 115 | vulkanEnableSetSRGBWrite: 0 116 | m_SupportedAspectRatios: 117 | 4:3: 1 118 | 5:4: 1 119 | 16:10: 1 120 | 16:9: 1 121 | Others: 1 122 | bundleVersion: 0.1 123 | preloadedAssets: [] 124 | metroInputSource: 0 125 | wsaTransparentSwapchain: 0 126 | m_HolographicPauseOnTrackingLoss: 1 127 | xboxOneDisableKinectGpuReservation: 1 128 | xboxOneEnable7thCore: 1 129 | vrSettings: 130 | cardboard: 131 | depthFormat: 0 132 | enableTransitionView: 0 133 | daydream: 134 | depthFormat: 0 135 | useSustainedPerformanceMode: 0 136 | enableVideoLayer: 0 137 | useProtectedVideoMemory: 0 138 | minimumSupportedHeadTracking: 0 139 | maximumSupportedHeadTracking: 1 140 | hololens: 141 | depthFormat: 1 142 | depthBufferSharingEnabled: 1 143 | lumin: 144 | depthFormat: 0 145 | frameTiming: 2 146 | enableGLCache: 0 147 | glCacheMaxBlobSize: 524288 148 | glCacheMaxFileSize: 8388608 149 | oculus: 150 | sharedDepthBuffer: 1 151 | dashSupport: 1 152 | lowOverheadMode: 0 153 | protectedContext: 0 154 | v2Signing: 1 155 | enable360StereoCapture: 0 156 | isWsaHolographicRemotingEnabled: 0 157 | enableFrameTimingStats: 0 158 | useHDRDisplay: 0 159 | D3DHDRBitDepth: 0 160 | m_ColorGamuts: 00000000 161 | targetPixelDensity: 30 162 | resolutionScalingMode: 0 163 | androidSupportedAspectRatio: 1 164 | androidMaxAspectRatio: 2.1 165 | applicationIdentifier: {} 166 | buildNumber: {} 167 | AndroidBundleVersionCode: 1 168 | AndroidMinSdkVersion: 19 169 | AndroidTargetSdkVersion: 0 170 | AndroidPreferredInstallLocation: 1 171 | aotOptions: 172 | stripEngineCode: 1 173 | iPhoneStrippingLevel: 0 174 | iPhoneScriptCallOptimization: 0 175 | ForceInternetPermission: 0 176 | ForceSDCardPermission: 0 177 | CreateWallpaper: 0 178 | APKExpansionFiles: 0 179 | keepLoadedShadersAlive: 0 180 | StripUnusedMeshComponents: 1 181 | VertexChannelCompressionMask: 4054 182 | iPhoneSdkVersion: 988 183 | iOSTargetOSVersionString: 10.0 184 | tvOSSdkVersion: 0 185 | tvOSRequireExtendedGameController: 0 186 | tvOSTargetOSVersionString: 10.0 187 | uIPrerenderedIcon: 0 188 | uIRequiresPersistentWiFi: 0 189 | uIRequiresFullScreen: 1 190 | uIStatusBarHidden: 1 191 | uIExitOnSuspend: 0 192 | uIStatusBarStyle: 0 193 | iPhoneSplashScreen: {fileID: 0} 194 | iPhoneHighResSplashScreen: {fileID: 0} 195 | iPhoneTallHighResSplashScreen: {fileID: 0} 196 | iPhone47inSplashScreen: {fileID: 0} 197 | iPhone55inPortraitSplashScreen: {fileID: 0} 198 | iPhone55inLandscapeSplashScreen: {fileID: 0} 199 | iPhone58inPortraitSplashScreen: {fileID: 0} 200 | iPhone58inLandscapeSplashScreen: {fileID: 0} 201 | iPadPortraitSplashScreen: {fileID: 0} 202 | iPadHighResPortraitSplashScreen: {fileID: 0} 203 | iPadLandscapeSplashScreen: {fileID: 0} 204 | iPadHighResLandscapeSplashScreen: {fileID: 0} 205 | iPhone65inPortraitSplashScreen: {fileID: 0} 206 | iPhone65inLandscapeSplashScreen: {fileID: 0} 207 | iPhone61inPortraitSplashScreen: {fileID: 0} 208 | iPhone61inLandscapeSplashScreen: {fileID: 0} 209 | appleTVSplashScreen: {fileID: 0} 210 | appleTVSplashScreen2x: {fileID: 0} 211 | tvOSSmallIconLayers: [] 212 | tvOSSmallIconLayers2x: [] 213 | tvOSLargeIconLayers: [] 214 | tvOSLargeIconLayers2x: [] 215 | tvOSTopShelfImageLayers: [] 216 | tvOSTopShelfImageLayers2x: [] 217 | tvOSTopShelfImageWideLayers: [] 218 | tvOSTopShelfImageWideLayers2x: [] 219 | iOSLaunchScreenType: 0 220 | iOSLaunchScreenPortrait: {fileID: 0} 221 | iOSLaunchScreenLandscape: {fileID: 0} 222 | iOSLaunchScreenBackgroundColor: 223 | serializedVersion: 2 224 | rgba: 0 225 | iOSLaunchScreenFillPct: 100 226 | iOSLaunchScreenSize: 100 227 | iOSLaunchScreenCustomXibPath: 228 | iOSLaunchScreeniPadType: 0 229 | iOSLaunchScreeniPadImage: {fileID: 0} 230 | iOSLaunchScreeniPadBackgroundColor: 231 | serializedVersion: 2 232 | rgba: 0 233 | iOSLaunchScreeniPadFillPct: 100 234 | iOSLaunchScreeniPadSize: 100 235 | iOSLaunchScreeniPadCustomXibPath: 236 | iOSUseLaunchScreenStoryboard: 0 237 | iOSLaunchScreenCustomStoryboardPath: 238 | iOSDeviceRequirements: [] 239 | iOSURLSchemes: [] 240 | iOSBackgroundModes: 0 241 | iOSMetalForceHardShadows: 0 242 | metalEditorSupport: 1 243 | metalAPIValidation: 1 244 | iOSRenderExtraFrameOnPause: 0 245 | appleDeveloperTeamID: 246 | iOSManualSigningProvisioningProfileID: 247 | tvOSManualSigningProvisioningProfileID: 248 | iOSManualSigningProvisioningProfileType: 0 249 | tvOSManualSigningProvisioningProfileType: 0 250 | appleEnableAutomaticSigning: 0 251 | iOSRequireARKit: 0 252 | iOSAutomaticallyDetectAndAddCapabilities: 1 253 | appleEnableProMotion: 0 254 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 255 | templatePackageId: com.unity.template.3d@4.2.8 256 | templateDefaultScene: Assets/Scenes/SampleScene.unity 257 | AndroidTargetArchitectures: 1 258 | AndroidSplashScreenScale: 0 259 | androidSplashScreen: {fileID: 0} 260 | AndroidKeystoreName: 261 | AndroidKeyaliasName: 262 | AndroidBuildApkPerCpuArchitecture: 0 263 | AndroidTVCompatibility: 0 264 | AndroidIsGame: 1 265 | AndroidEnableTango: 0 266 | androidEnableBanner: 1 267 | androidUseLowAccuracyLocation: 0 268 | androidUseCustomKeystore: 0 269 | m_AndroidBanners: 270 | - width: 320 271 | height: 180 272 | banner: {fileID: 0} 273 | androidGamepadSupportLevel: 0 274 | AndroidValidateAppBundleSize: 1 275 | AndroidAppBundleSizeToValidate: 150 276 | m_BuildTargetIcons: [] 277 | m_BuildTargetPlatformIcons: [] 278 | m_BuildTargetBatching: 279 | - m_BuildTarget: Standalone 280 | m_StaticBatching: 1 281 | m_DynamicBatching: 0 282 | - m_BuildTarget: tvOS 283 | m_StaticBatching: 1 284 | m_DynamicBatching: 0 285 | - m_BuildTarget: Android 286 | m_StaticBatching: 1 287 | m_DynamicBatching: 0 288 | - m_BuildTarget: iPhone 289 | m_StaticBatching: 1 290 | m_DynamicBatching: 0 291 | - m_BuildTarget: WebGL 292 | m_StaticBatching: 0 293 | m_DynamicBatching: 0 294 | m_BuildTargetGraphicsJobs: 295 | - m_BuildTarget: MacStandaloneSupport 296 | m_GraphicsJobs: 0 297 | - m_BuildTarget: Switch 298 | m_GraphicsJobs: 1 299 | - m_BuildTarget: MetroSupport 300 | m_GraphicsJobs: 1 301 | - m_BuildTarget: AppleTVSupport 302 | m_GraphicsJobs: 0 303 | - m_BuildTarget: BJMSupport 304 | m_GraphicsJobs: 1 305 | - m_BuildTarget: LinuxStandaloneSupport 306 | m_GraphicsJobs: 1 307 | - m_BuildTarget: PS4Player 308 | m_GraphicsJobs: 1 309 | - m_BuildTarget: iOSSupport 310 | m_GraphicsJobs: 0 311 | - m_BuildTarget: WindowsStandaloneSupport 312 | m_GraphicsJobs: 1 313 | - m_BuildTarget: XboxOnePlayer 314 | m_GraphicsJobs: 1 315 | - m_BuildTarget: LuminSupport 316 | m_GraphicsJobs: 0 317 | - m_BuildTarget: AndroidPlayer 318 | m_GraphicsJobs: 0 319 | - m_BuildTarget: WebGLSupport 320 | m_GraphicsJobs: 0 321 | m_BuildTargetGraphicsJobMode: 322 | - m_BuildTarget: PS4Player 323 | m_GraphicsJobMode: 0 324 | - m_BuildTarget: XboxOnePlayer 325 | m_GraphicsJobMode: 0 326 | m_BuildTargetGraphicsAPIs: 327 | - m_BuildTarget: AndroidPlayer 328 | m_APIs: 150000000b000000 329 | m_Automatic: 0 330 | - m_BuildTarget: iOSSupport 331 | m_APIs: 10000000 332 | m_Automatic: 1 333 | - m_BuildTarget: AppleTVSupport 334 | m_APIs: 10000000 335 | m_Automatic: 0 336 | - m_BuildTarget: WebGLSupport 337 | m_APIs: 0b000000 338 | m_Automatic: 1 339 | m_BuildTargetVRSettings: 340 | - m_BuildTarget: Standalone 341 | m_Enabled: 0 342 | m_Devices: 343 | - Oculus 344 | - OpenVR 345 | openGLRequireES31: 0 346 | openGLRequireES31AEP: 0 347 | openGLRequireES32: 0 348 | m_TemplateCustomTags: {} 349 | mobileMTRendering: 350 | Android: 1 351 | iPhone: 1 352 | tvOS: 1 353 | m_BuildTargetGroupLightmapEncodingQuality: [] 354 | m_BuildTargetGroupLightmapSettings: [] 355 | playModeTestRunnerEnabled: 0 356 | runPlayModeTestAsEditModeTest: 0 357 | actionOnDotNetUnhandledException: 1 358 | enableInternalProfiler: 0 359 | logObjCUncaughtExceptions: 1 360 | enableCrashReportAPI: 0 361 | cameraUsageDescription: 362 | locationUsageDescription: 363 | microphoneUsageDescription: 364 | switchNetLibKey: 365 | switchSocketMemoryPoolSize: 6144 366 | switchSocketAllocatorPoolSize: 128 367 | switchSocketConcurrencyLimit: 14 368 | switchScreenResolutionBehavior: 2 369 | switchUseCPUProfiler: 0 370 | switchApplicationID: 0x01004b9000490000 371 | switchNSODependencies: 372 | switchTitleNames_0: 373 | switchTitleNames_1: 374 | switchTitleNames_2: 375 | switchTitleNames_3: 376 | switchTitleNames_4: 377 | switchTitleNames_5: 378 | switchTitleNames_6: 379 | switchTitleNames_7: 380 | switchTitleNames_8: 381 | switchTitleNames_9: 382 | switchTitleNames_10: 383 | switchTitleNames_11: 384 | switchTitleNames_12: 385 | switchTitleNames_13: 386 | switchTitleNames_14: 387 | switchPublisherNames_0: 388 | switchPublisherNames_1: 389 | switchPublisherNames_2: 390 | switchPublisherNames_3: 391 | switchPublisherNames_4: 392 | switchPublisherNames_5: 393 | switchPublisherNames_6: 394 | switchPublisherNames_7: 395 | switchPublisherNames_8: 396 | switchPublisherNames_9: 397 | switchPublisherNames_10: 398 | switchPublisherNames_11: 399 | switchPublisherNames_12: 400 | switchPublisherNames_13: 401 | switchPublisherNames_14: 402 | switchIcons_0: {fileID: 0} 403 | switchIcons_1: {fileID: 0} 404 | switchIcons_2: {fileID: 0} 405 | switchIcons_3: {fileID: 0} 406 | switchIcons_4: {fileID: 0} 407 | switchIcons_5: {fileID: 0} 408 | switchIcons_6: {fileID: 0} 409 | switchIcons_7: {fileID: 0} 410 | switchIcons_8: {fileID: 0} 411 | switchIcons_9: {fileID: 0} 412 | switchIcons_10: {fileID: 0} 413 | switchIcons_11: {fileID: 0} 414 | switchIcons_12: {fileID: 0} 415 | switchIcons_13: {fileID: 0} 416 | switchIcons_14: {fileID: 0} 417 | switchSmallIcons_0: {fileID: 0} 418 | switchSmallIcons_1: {fileID: 0} 419 | switchSmallIcons_2: {fileID: 0} 420 | switchSmallIcons_3: {fileID: 0} 421 | switchSmallIcons_4: {fileID: 0} 422 | switchSmallIcons_5: {fileID: 0} 423 | switchSmallIcons_6: {fileID: 0} 424 | switchSmallIcons_7: {fileID: 0} 425 | switchSmallIcons_8: {fileID: 0} 426 | switchSmallIcons_9: {fileID: 0} 427 | switchSmallIcons_10: {fileID: 0} 428 | switchSmallIcons_11: {fileID: 0} 429 | switchSmallIcons_12: {fileID: 0} 430 | switchSmallIcons_13: {fileID: 0} 431 | switchSmallIcons_14: {fileID: 0} 432 | switchManualHTML: 433 | switchAccessibleURLs: 434 | switchLegalInformation: 435 | switchMainThreadStackSize: 1048576 436 | switchPresenceGroupId: 437 | switchLogoHandling: 0 438 | switchReleaseVersion: 0 439 | switchDisplayVersion: 1.0.0 440 | switchStartupUserAccount: 0 441 | switchTouchScreenUsage: 0 442 | switchSupportedLanguagesMask: 0 443 | switchLogoType: 0 444 | switchApplicationErrorCodeCategory: 445 | switchUserAccountSaveDataSize: 0 446 | switchUserAccountSaveDataJournalSize: 0 447 | switchApplicationAttribute: 0 448 | switchCardSpecSize: -1 449 | switchCardSpecClock: -1 450 | switchRatingsMask: 0 451 | switchRatingsInt_0: 0 452 | switchRatingsInt_1: 0 453 | switchRatingsInt_2: 0 454 | switchRatingsInt_3: 0 455 | switchRatingsInt_4: 0 456 | switchRatingsInt_5: 0 457 | switchRatingsInt_6: 0 458 | switchRatingsInt_7: 0 459 | switchRatingsInt_8: 0 460 | switchRatingsInt_9: 0 461 | switchRatingsInt_10: 0 462 | switchRatingsInt_11: 0 463 | switchRatingsInt_12: 0 464 | switchLocalCommunicationIds_0: 465 | switchLocalCommunicationIds_1: 466 | switchLocalCommunicationIds_2: 467 | switchLocalCommunicationIds_3: 468 | switchLocalCommunicationIds_4: 469 | switchLocalCommunicationIds_5: 470 | switchLocalCommunicationIds_6: 471 | switchLocalCommunicationIds_7: 472 | switchParentalControl: 0 473 | switchAllowsScreenshot: 1 474 | switchAllowsVideoCapturing: 1 475 | switchAllowsRuntimeAddOnContentInstall: 0 476 | switchDataLossConfirmation: 0 477 | switchUserAccountLockEnabled: 0 478 | switchSystemResourceMemory: 16777216 479 | switchSupportedNpadStyles: 22 480 | switchNativeFsCacheSize: 32 481 | switchIsHoldTypeHorizontal: 0 482 | switchSupportedNpadCount: 8 483 | switchSocketConfigEnabled: 0 484 | switchTcpInitialSendBufferSize: 32 485 | switchTcpInitialReceiveBufferSize: 64 486 | switchTcpAutoSendBufferSizeMax: 256 487 | switchTcpAutoReceiveBufferSizeMax: 256 488 | switchUdpSendBufferSize: 9 489 | switchUdpReceiveBufferSize: 42 490 | switchSocketBufferEfficiency: 4 491 | switchSocketInitializeEnabled: 1 492 | switchNetworkInterfaceManagerInitializeEnabled: 1 493 | switchPlayerConnectionEnabled: 1 494 | ps4NPAgeRating: 12 495 | ps4NPTitleSecret: 496 | ps4NPTrophyPackPath: 497 | ps4ParentalLevel: 11 498 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 499 | ps4Category: 0 500 | ps4MasterVersion: 01.00 501 | ps4AppVersion: 01.00 502 | ps4AppType: 0 503 | ps4ParamSfxPath: 504 | ps4VideoOutPixelFormat: 0 505 | ps4VideoOutInitialWidth: 1920 506 | ps4VideoOutBaseModeInitialWidth: 1920 507 | ps4VideoOutReprojectionRate: 60 508 | ps4PronunciationXMLPath: 509 | ps4PronunciationSIGPath: 510 | ps4BackgroundImagePath: 511 | ps4StartupImagePath: 512 | ps4StartupImagesFolder: 513 | ps4IconImagesFolder: 514 | ps4SaveDataImagePath: 515 | ps4SdkOverride: 516 | ps4BGMPath: 517 | ps4ShareFilePath: 518 | ps4ShareOverlayImagePath: 519 | ps4PrivacyGuardImagePath: 520 | ps4NPtitleDatPath: 521 | ps4RemotePlayKeyAssignment: -1 522 | ps4RemotePlayKeyMappingDir: 523 | ps4PlayTogetherPlayerCount: 0 524 | ps4EnterButtonAssignment: 1 525 | ps4ApplicationParam1: 0 526 | ps4ApplicationParam2: 0 527 | ps4ApplicationParam3: 0 528 | ps4ApplicationParam4: 0 529 | ps4DownloadDataSize: 0 530 | ps4GarlicHeapSize: 2048 531 | ps4ProGarlicHeapSize: 2560 532 | playerPrefsMaxSize: 32768 533 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 534 | ps4pnSessions: 1 535 | ps4pnPresence: 1 536 | ps4pnFriends: 1 537 | ps4pnGameCustomData: 1 538 | playerPrefsSupport: 0 539 | enableApplicationExit: 0 540 | resetTempFolder: 1 541 | restrictedAudioUsageRights: 0 542 | ps4UseResolutionFallback: 0 543 | ps4ReprojectionSupport: 0 544 | ps4UseAudio3dBackend: 0 545 | ps4SocialScreenEnabled: 0 546 | ps4ScriptOptimizationLevel: 0 547 | ps4Audio3dVirtualSpeakerCount: 14 548 | ps4attribCpuUsage: 0 549 | ps4PatchPkgPath: 550 | ps4PatchLatestPkgPath: 551 | ps4PatchChangeinfoPath: 552 | ps4PatchDayOne: 0 553 | ps4attribUserManagement: 0 554 | ps4attribMoveSupport: 0 555 | ps4attrib3DSupport: 0 556 | ps4attribShareSupport: 0 557 | ps4attribExclusiveVR: 0 558 | ps4disableAutoHideSplash: 0 559 | ps4videoRecordingFeaturesUsed: 0 560 | ps4contentSearchFeaturesUsed: 0 561 | ps4attribEyeToEyeDistanceSettingVR: 0 562 | ps4IncludedModules: [] 563 | ps4attribVROutputEnabled: 0 564 | monoEnv: 565 | splashScreenBackgroundSourceLandscape: {fileID: 0} 566 | splashScreenBackgroundSourcePortrait: {fileID: 0} 567 | blurSplashScreenBackground: 1 568 | spritePackerPolicy: 569 | webGLMemorySize: 16 570 | webGLExceptionSupport: 1 571 | webGLNameFilesAsHashes: 0 572 | webGLDataCaching: 1 573 | webGLDebugSymbols: 0 574 | webGLEmscriptenArgs: 575 | webGLModulesDirectory: 576 | webGLTemplate: APPLICATION:Default 577 | webGLAnalyzeBuildSize: 0 578 | webGLUseEmbeddedResources: 0 579 | webGLCompressionFormat: 1 580 | webGLLinkerTarget: 1 581 | webGLThreadsSupport: 0 582 | webGLWasmStreaming: 0 583 | scriptingDefineSymbols: 584 | 1: UNITY_POST_PROCESSING_STACK_V2 585 | 7: UNITY_POST_PROCESSING_STACK_V2 586 | 13: UNITY_POST_PROCESSING_STACK_V2 587 | 19: UNITY_POST_PROCESSING_STACK_V2 588 | 21: UNITY_POST_PROCESSING_STACK_V2 589 | 25: UNITY_POST_PROCESSING_STACK_V2 590 | 27: UNITY_POST_PROCESSING_STACK_V2 591 | 28: UNITY_POST_PROCESSING_STACK_V2 592 | 29: UNITY_POST_PROCESSING_STACK_V2 593 | platformArchitecture: {} 594 | scriptingBackend: {} 595 | il2cppCompilerConfiguration: {} 596 | managedStrippingLevel: {} 597 | incrementalIl2cppBuild: {} 598 | allowUnsafeCode: 0 599 | additionalIl2CppArgs: 600 | scriptingRuntimeVersion: 1 601 | gcIncremental: 0 602 | gcWBarrierValidation: 0 603 | apiCompatibilityLevelPerPlatform: 604 | Standalone: 3 605 | m_RenderingPath: 1 606 | m_MobileRenderingPath: 1 607 | metroPackageName: Template_3D 608 | metroPackageVersion: 609 | metroCertificatePath: 610 | metroCertificatePassword: 611 | metroCertificateSubject: 612 | metroCertificateIssuer: 613 | metroCertificateNotAfter: 0000000000000000 614 | metroApplicationDescription: Template_3D 615 | wsaImages: {} 616 | metroTileShortName: 617 | metroTileShowName: 0 618 | metroMediumTileShowName: 0 619 | metroLargeTileShowName: 0 620 | metroWideTileShowName: 0 621 | metroSupportStreamingInstall: 0 622 | metroLastRequiredScene: 0 623 | metroDefaultTileSize: 1 624 | metroTileForegroundText: 2 625 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 626 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 627 | a: 1} 628 | metroSplashScreenUseBackgroundColor: 0 629 | platformCapabilities: {} 630 | metroTargetDeviceFamilies: {} 631 | metroFTAName: 632 | metroFTAFileTypes: [] 633 | metroProtocolName: 634 | XboxOneProductId: 635 | XboxOneUpdateKey: 636 | XboxOneSandboxId: 637 | XboxOneContentId: 638 | XboxOneTitleId: 639 | XboxOneSCId: 640 | XboxOneGameOsOverridePath: 641 | XboxOnePackagingOverridePath: 642 | XboxOneAppManifestOverridePath: 643 | XboxOneVersion: 1.0.0.0 644 | XboxOnePackageEncryption: 0 645 | XboxOnePackageUpdateGranularity: 2 646 | XboxOneDescription: 647 | XboxOneLanguage: 648 | - enus 649 | XboxOneCapability: [] 650 | XboxOneGameRating: {} 651 | XboxOneIsContentPackage: 0 652 | XboxOneEnableGPUVariability: 1 653 | XboxOneSockets: {} 654 | XboxOneSplashScreen: {fileID: 0} 655 | XboxOneAllowedProductIds: [] 656 | XboxOnePersistentLocalStorageSize: 0 657 | XboxOneXTitleMemory: 8 658 | XboxOneOverrideIdentityName: 659 | vrEditorSettings: 660 | daydream: 661 | daydreamIconForeground: {fileID: 0} 662 | daydreamIconBackground: {fileID: 0} 663 | cloudServicesEnabled: 664 | UNet: 1 665 | luminIcon: 666 | m_Name: 667 | m_ModelFolderPath: 668 | m_PortalFolderPath: 669 | luminCert: 670 | m_CertPath: 671 | m_SignPackage: 1 672 | luminIsChannelApp: 0 673 | luminVersion: 674 | m_VersionCode: 1 675 | m_VersionName: 676 | apiCompatibilityLevel: 6 677 | cloudProjectId: 678 | framebufferDepthMemorylessMode: 0 679 | projectName: 680 | organizationId: 681 | cloudEnabled: 0 682 | enableNativePlatformBackendsForNewInputSystem: 0 683 | disableOldInputManagerSupport: 0 684 | legacyClampBlendShapeWeights: 0 685 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2019.3.7f1 2 | m_EditorVersionWithRevision: 2019.3.7f1 (6437fd74d35d) 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: 3 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 | skinWeights: 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 | customRenderPipeline: {fileID: 0} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Low 47 | pixelLightCount: 0 48 | shadows: 0 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 0 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 0 66 | lodBias: 0.4 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 16 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 0} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: Medium 83 | pixelLightCount: 1 84 | shadows: 1 85 | shadowResolution: 0 86 | shadowProjection: 1 87 | shadowCascades: 1 88 | shadowDistance: 20 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 0 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 0 97 | softParticles: 0 98 | softVegetation: 0 99 | realtimeReflectionProbes: 0 100 | billboardsFaceCameraPosition: 0 101 | vSyncCount: 1 102 | lodBias: 0.7 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 64 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 0} 116 | excludedTargetPlatforms: [] 117 | - serializedVersion: 2 118 | name: High 119 | pixelLightCount: 2 120 | shadows: 2 121 | shadowResolution: 1 122 | shadowProjection: 1 123 | shadowCascades: 2 124 | shadowDistance: 40 125 | shadowNearPlaneOffset: 3 126 | shadowCascade2Split: 0.33333334 127 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 128 | shadowmaskMode: 1 129 | skinWeights: 2 130 | textureQuality: 0 131 | anisotropicTextures: 1 132 | antiAliasing: 0 133 | softParticles: 0 134 | softVegetation: 1 135 | realtimeReflectionProbes: 1 136 | billboardsFaceCameraPosition: 1 137 | vSyncCount: 1 138 | lodBias: 1 139 | maximumLODLevel: 0 140 | streamingMipmapsActive: 0 141 | streamingMipmapsAddAllCameras: 1 142 | streamingMipmapsMemoryBudget: 512 143 | streamingMipmapsRenderersPerFrame: 512 144 | streamingMipmapsMaxLevelReduction: 2 145 | streamingMipmapsMaxFileIORequests: 1024 146 | particleRaycastBudget: 256 147 | asyncUploadTimeSlice: 2 148 | asyncUploadBufferSize: 16 149 | asyncUploadPersistentBuffer: 1 150 | resolutionScalingFixedDPIFactor: 1 151 | customRenderPipeline: {fileID: 0} 152 | excludedTargetPlatforms: [] 153 | - serializedVersion: 2 154 | name: Very High 155 | pixelLightCount: 3 156 | shadows: 2 157 | shadowResolution: 2 158 | shadowProjection: 1 159 | shadowCascades: 2 160 | shadowDistance: 70 161 | shadowNearPlaneOffset: 3 162 | shadowCascade2Split: 0.33333334 163 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 164 | shadowmaskMode: 1 165 | skinWeights: 4 166 | textureQuality: 0 167 | anisotropicTextures: 2 168 | antiAliasing: 2 169 | softParticles: 1 170 | softVegetation: 1 171 | realtimeReflectionProbes: 1 172 | billboardsFaceCameraPosition: 1 173 | vSyncCount: 1 174 | lodBias: 1.5 175 | maximumLODLevel: 0 176 | streamingMipmapsActive: 0 177 | streamingMipmapsAddAllCameras: 1 178 | streamingMipmapsMemoryBudget: 512 179 | streamingMipmapsRenderersPerFrame: 512 180 | streamingMipmapsMaxLevelReduction: 2 181 | streamingMipmapsMaxFileIORequests: 1024 182 | particleRaycastBudget: 1024 183 | asyncUploadTimeSlice: 2 184 | asyncUploadBufferSize: 16 185 | asyncUploadPersistentBuffer: 1 186 | resolutionScalingFixedDPIFactor: 1 187 | customRenderPipeline: {fileID: 0} 188 | excludedTargetPlatforms: [] 189 | - serializedVersion: 2 190 | name: Ultra 191 | pixelLightCount: 4 192 | shadows: 2 193 | shadowResolution: 2 194 | shadowProjection: 1 195 | shadowCascades: 4 196 | shadowDistance: 150 197 | shadowNearPlaneOffset: 3 198 | shadowCascade2Split: 0.33333334 199 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 200 | shadowmaskMode: 1 201 | skinWeights: 4 202 | textureQuality: 0 203 | anisotropicTextures: 2 204 | antiAliasing: 2 205 | softParticles: 1 206 | softVegetation: 1 207 | realtimeReflectionProbes: 1 208 | billboardsFaceCameraPosition: 1 209 | vSyncCount: 1 210 | lodBias: 2 211 | maximumLODLevel: 0 212 | streamingMipmapsActive: 0 213 | streamingMipmapsAddAllCameras: 1 214 | streamingMipmapsMemoryBudget: 512 215 | streamingMipmapsRenderersPerFrame: 512 216 | streamingMipmapsMaxLevelReduction: 2 217 | streamingMipmapsMaxFileIORequests: 1024 218 | particleRaycastBudget: 4096 219 | asyncUploadTimeSlice: 2 220 | asyncUploadBufferSize: 16 221 | asyncUploadPersistentBuffer: 1 222 | resolutionScalingFixedDPIFactor: 1 223 | customRenderPipeline: {fileID: 0} 224 | excludedTargetPlatforms: [] 225 | m_PerPlatformDefaultQuality: 226 | Android: 2 227 | Lumin: 5 228 | Nintendo 3DS: 5 229 | Nintendo Switch: 5 230 | PS4: 5 231 | PSP2: 2 232 | Stadia: 5 233 | Standalone: 5 234 | WebGL: 3 235 | Windows Store Apps: 5 236 | XboxOne: 5 237 | iPhone: 2 238 | tvOS: 2 239 | -------------------------------------------------------------------------------- /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 | - Cave 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 Procedural Cave - [Video](https://www.youtube.com/watch?v=LJjLroQJJig) 2 | 3 | A partially jobified port of [Scrawk's](https://github.com/Scrawk) [Marching Cubes/Tetrahedra](https://github.com/Scrawk/Marching-Cubes) implementation. [Triplanar shader](https://github.com/keijiro/StandardTriplanar) by [Keijiro Takahashi](https://github.com/keijiro). 4 | --------------------------------------------------------------------------------