├── Voxel ├── ProjectSettings │ ├── ProjectVersion.txt │ ├── ClusterInputManager.asset │ ├── NetworkManager.asset │ ├── TimeManager.asset │ ├── EditorBuildSettings.asset │ ├── VFXManager.asset │ ├── AudioManager.asset │ ├── TagManager.asset │ ├── EditorSettings.asset │ ├── PresetManager.asset │ ├── UnityConnectSettings.asset │ ├── DynamicsManager.asset │ ├── Physics2DSettings.asset │ ├── NavMeshAreas.asset │ ├── GraphicsSettings.asset │ ├── InputManager.asset │ ├── QualitySettings.asset │ └── ProjectSettings.asset ├── Assets │ ├── Textures │ │ ├── UI │ │ │ ├── Crosshair.png │ │ │ └── Crosshair.png.meta │ │ ├── Blocks │ │ │ ├── BlockTextures.png │ │ │ ├── Materials.meta │ │ │ ├── Materials │ │ │ │ ├── BlockTextures.mat.meta │ │ │ │ └── BlockTextures.mat │ │ │ └── BlockTextures.png.meta │ │ ├── UI.meta │ │ └── Blocks.meta │ ├── Scenes │ │ ├── Game.unity.meta │ │ └── Game.unity │ ├── Core.meta │ ├── Prefabs │ │ ├── Voxel │ │ │ ├── Chunk.prefab.meta │ │ │ └── Chunk.prefab │ │ └── Voxel.meta │ ├── Scenes.meta │ ├── Core │ │ ├── Blocks.meta │ │ ├── Player.meta │ │ ├── Voxel.meta │ │ ├── Noise.meta │ │ ├── Voxel │ │ │ ├── Block.cs.meta │ │ │ ├── Chunk.cs.meta │ │ │ ├── Save.cs.meta │ │ │ ├── World.cs.meta │ │ │ ├── EditTerrain.cs.meta │ │ │ ├── LoadChunks.cs.meta │ │ │ ├── MeshData.cs.meta │ │ │ ├── TerrainGen.cs.meta │ │ │ ├── DeveloperScreen.cs.meta │ │ │ ├── Serialization.cs.meta │ │ │ ├── WorldPosition.cs.meta │ │ │ ├── DeveloperScreen.cs │ │ │ ├── Save.cs │ │ │ ├── WorldPosition.cs │ │ │ ├── EditTerrain.cs │ │ │ ├── Serialization.cs │ │ │ ├── MeshData.cs │ │ │ ├── Chunk.cs │ │ │ ├── World.cs │ │ │ ├── TerrainGen.cs │ │ │ ├── LoadChunks.cs │ │ │ └── Block.cs │ │ ├── Blocks │ │ │ ├── Block_Air.cs.meta │ │ │ ├── Block_Grass.cs.meta │ │ │ ├── Block_Oak.cs.meta │ │ │ ├── Block_Stone.cs.meta │ │ │ ├── Block_Oak_Leaves.cs.meta │ │ │ ├── Block_Air.cs │ │ │ ├── Block_Stone.cs │ │ │ ├── Block_Oak_Leaves.cs │ │ │ ├── Block_Oak.cs │ │ │ └── Block_Grass.cs │ │ ├── Noise │ │ │ ├── SimplexNoise.cs.meta │ │ │ └── SimplexNoise.cs │ │ └── Player │ │ │ ├── PlayerInfo.cs.meta │ │ │ ├── PlayerLook.cs.meta │ │ │ ├── PlayerController.cs.meta │ │ │ ├── PlayerInteraction.cs.meta │ │ │ ├── PlayerInfo.cs │ │ │ ├── PlayerInteraction.cs │ │ │ ├── PlayerLook.cs │ │ │ └── PlayerController.cs │ ├── Prefabs.meta │ ├── Shaders.meta │ ├── Textures.meta │ ├── Skybox.mat.meta │ ├── Post-Processing Main.asset.meta │ ├── Shaders │ │ ├── BlockShader.shader.meta │ │ └── BlockShader.shader │ ├── Skybox.mat │ └── Post-Processing Main.asset └── Packages │ └── manifest.json ├── Caves.png ├── Voxel.png ├── README.md └── .gitignore /Voxel/ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2018.3.9f1 2 | -------------------------------------------------------------------------------- /Caves.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/artak10t/VoxelEngine/HEAD/Caves.png -------------------------------------------------------------------------------- /Voxel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/artak10t/VoxelEngine/HEAD/Voxel.png -------------------------------------------------------------------------------- /Voxel/Assets/Textures/UI/Crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/artak10t/VoxelEngine/HEAD/Voxel/Assets/Textures/UI/Crosshair.png -------------------------------------------------------------------------------- /Voxel/Assets/Textures/Blocks/BlockTextures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/artak10t/VoxelEngine/HEAD/Voxel/Assets/Textures/Blocks/BlockTextures.png -------------------------------------------------------------------------------- /Voxel/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 | -------------------------------------------------------------------------------- /Voxel/Assets/Scenes/Game.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bda2e5d4c28aa27419d3c6eabe82620c 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Voxel/Assets/Core.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 45621f5a9348011429580cc71c3c7b6f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Prefabs/Voxel/Chunk.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a4b0ff65209415c43b069acc9c1e39dd 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Voxel/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: df1aedcc70905c34faeed9964c4bbb62 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/ProjectSettings/NetworkManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!149 &1 4 | NetworkManager: 5 | m_ObjectHideFlags: 0 6 | m_DebugLevel: 0 7 | m_Sendrate: 15 8 | m_AssetToPrefab: {} 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5d76e073630dee841a3ed645a54241d3 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 37962767614a28049a9f1964f36ddc32 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b745f7eac7cc0cc468d658d65b8c7dea 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Prefabs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 67382cbd1bc3f5e43a10552fdd813b66 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1504d4b302af3c84c8761332a76454fd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cf81cc80116dec74ab65c953f5344691 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/UI.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e8eab713622ab5345934195b91fa9cb5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Prefabs/Voxel.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 76f74746ee8f35c41bb941393fc2105f 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/Blocks.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 010c5b9dcd90e7b44a441d18cb1c29db 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Skybox.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0e5a2c967c0b25549990aaa1fa59b900 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/Blocks/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cb17a1869a680ee438b4c329c3d0d9cd 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Noise.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 42f8918d06894d647a4563abfd4fa69e 3 | folderAsset: yes 4 | timeCreated: 1489482446 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Voxel/Assets/Post-Processing Main.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3e9c6aedcfa7000468cdc02082bc9139 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/Blocks/Materials/BlockTextures.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c02a881af6cae2342bcb07641ba837fb 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Voxel/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.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Voxel/Assets/Shaders/BlockShader.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2ae8ec34af549564c8ebbdbed4933679 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Block.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b32435f387497140b6fe576c1deeeeb 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Chunk.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2e44cc43e3926f4384c2d0ef3e7cdb8 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Save.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1b5b8148d4808a041a4ddc666b9558b2 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/World.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 62dd3de82f68bbe478bbc6773cca9ea5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Air.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b29839bb9841a047a3310a59d0f557a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Grass.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2f4f3d67948bd6e45b25cdf547411602 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Oak.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fd2aae1afbe2de64086e41790653637b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Stone.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 41a1fbf90640fa84c989920d78d7462e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Noise/SimplexNoise.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f249525eda182fb4388acfdbaba3d370 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 188ffa21e92af4f4597df06948600156 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerLook.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4f8da24da23153a498bf4415c57c3c0b 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/EditTerrain.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 08e4aef21887e6c4fa8f609d449bb8e7 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/LoadChunks.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb5f21faba890f045972b47f98aa72d5 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/MeshData.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7efc4eb14b3028f42b19980429304cbe 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/TerrainGen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e6f77ea6b98a7b444ba08bad100a865e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Oak_Leaves.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f90aa534a1ef004b8fd163902a2bd3d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerController.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d7db33ff3a5ff73419f59b111751ad63 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/DeveloperScreen.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: db3050fd62d5419448fc801510df374a 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Serialization.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1c6ea00a8955dde44a3f02ad71452f68 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/WorldPosition.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa039ce173b194c46ab0f840b89d9726 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerInteraction.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 33aa02f814a36ce4a9065919f5bccf6f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Voxel/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: 1 9 | path: Assets/Scenes/Game.unity 10 | guid: bda2e5d4c28aa27419d3c6eabe82620c 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /Voxel/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_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/DeveloperScreen.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | public static class DeveloperScreen 6 | { 7 | private static bool debugSSAO = false; 8 | 9 | public static bool DebugSSAO 10 | { 11 | get 12 | { 13 | return debugSSAO; 14 | } 15 | set 16 | { 17 | debugSSAO = value; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Voxel/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 | m_Volume: 1 7 | Rolloff Scale: 1 8 | Doppler Factor: 1 9 | Default Speaker Mode: 2 10 | m_SampleRate: 0 11 | m_DSPBufferSize: 1024 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_AmbisonicDecoderPlugin: 16 | m_DisableAudio: 0 17 | m_VirtualizeEffects: 1 18 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Air.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | 4 | namespace Voxel.Blocks 5 | { 6 | [Serializable] 7 | public class Block_Air : Block 8 | { 9 | public Block_Air() : base() 10 | { 11 | 12 | } 13 | 14 | public override MeshData BlockData(Chunk chunk, int x, int y, int z, MeshData meshData) 15 | { 16 | return meshData; 17 | } 18 | 19 | public override bool IsSolid(Direction direction) 20 | { 21 | return false; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VoxelEngine 2 | 3 | ![](Voxel.png) 4 | 5 | > Voxel engine for Unity with implemented SSAO and serialization. Inspired by minecraft. 6 | 7 | ## :hammer: Generation 8 | 9 | ![](Caves.png) 10 | 11 | Procedural Generation of: 12 | 13 | ```sh 14 | Terrain, Caves, Trees 15 | ``` 16 | 17 | ## :clipboard: Meta 18 | 19 | Spartak Gevorgyan – artak10t@gmail.com 20 | 21 | Distributed under the GNU General Public License v3.0 license. See ``GNU General Public License v3.0`` for more information. 22 | 23 | [https://github.com/artak10t/github-link](https://github.com/artak10t/) 24 | -------------------------------------------------------------------------------- /Voxel/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 | - PostProcessing 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 | -------------------------------------------------------------------------------- /Voxel/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: 7 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_LineEndingsForNewScripts: 2 10 | m_DefaultBehaviorMode: 0 11 | m_SpritePackerMode: 0 12 | m_SpritePackerPaddingPower: 1 13 | m_EtcTextureCompressorBehavior: 1 14 | m_EtcTextureFastCompressor: 1 15 | m_EtcTextureNormalCompressor: 2 16 | m_EtcTextureBestCompressor: 4 17 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 18 | m_ProjectGenerationRootNamespace: 19 | m_UserGeneratedProjectSuffix: 20 | m_CollabEditorSettings: 21 | inProgressEnabled: 1 22 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Voxel; 5 | using Voxel.Blocks; 6 | 7 | public class PlayerInfo : MonoBehaviour 8 | { 9 | public Vector3 position; 10 | [HideInInspector] 11 | public Block standingOn; 12 | 13 | private void Update() 14 | { 15 | RaycastHit hit; 16 | if (Physics.Raycast(transform.position, Vector3.down, out hit, 1f)) 17 | { 18 | standingOn = EditTerrain.GetBlock(hit); 19 | } 20 | 21 | position = new Vector3(Mathf.Round(transform.position.x * 100) / 100, Mathf.Round(transform.position.y * 100) / 100, Mathf.Round(transform.position.z * 100) / 100); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Stone.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | 4 | namespace Voxel.Blocks 5 | { 6 | 7 | [Serializable] 8 | public class Block_Stone : Block 9 | { 10 | public Block_Stone() : base() 11 | { 12 | 13 | } 14 | 15 | public override MeshData BlockData(Chunk chunk, int x, int y, int z, MeshData meshData) 16 | { 17 | meshData.useRenderDataForCollider = true; 18 | 19 | return base.BlockData(chunk, x, y, z, meshData); 20 | } 21 | 22 | public override Tile TexturePosition(Direction direction) 23 | { 24 | Tile tile = new Tile(); 25 | tile.x = 0; 26 | tile.y = 1; 27 | return tile; 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Oak_Leaves.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Voxel.Blocks 4 | { 5 | [Serializable] 6 | public class Block_Oak_Leaves : Block 7 | { 8 | 9 | public Block_Oak_Leaves() : base() 10 | { 11 | 12 | } 13 | public override MeshData BlockData(Chunk chunk, int x, int y, int z, MeshData meshData) 14 | { 15 | meshData.useRenderDataForCollider = true; 16 | 17 | return base.BlockData(chunk, x, y, z, meshData); 18 | } 19 | 20 | public override bool IsSolid(Direction direction) 21 | { 22 | return false; 23 | } 24 | 25 | public override Tile TexturePosition(Direction direction) 26 | { 27 | Tile tile = new Tile(); 28 | 29 | tile.x = 3; 30 | tile.y = 1; 31 | 32 | return tile; 33 | } 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Save.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System; 5 | using Voxel; 6 | using Voxel.Blocks; 7 | 8 | [Serializable] 9 | public class Save 10 | { 11 | public Dictionary blocks = new Dictionary(); 12 | 13 | public Save(Chunk chunk) 14 | { 15 | for (int x = 0; x < Chunk.chunkSize; x++) 16 | { 17 | for (int y = 0; y < Chunk.chunkSize; y++) 18 | { 19 | for (int z = 0; z < Chunk.chunkSize; z++) 20 | { 21 | if (!chunk.blocks[x, y, z].changed) 22 | continue; 23 | 24 | WorldPosition pos = new WorldPosition(x, y, z); 25 | blocks.Add(pos, chunk.blocks[x, y, z]); 26 | } 27 | } 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /Voxel/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 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: c1cf8506f04ef2c4a88b64b6c4202eea, 13 | type: 2} 14 | - type: 15 | m_NativeTypeID: 1020 16 | m_ManagedTypePPtr: {fileID: 0} 17 | m_ManagedTypeFallback: 18 | defaultPresets: 19 | - m_Preset: {fileID: 2655988077585873504, guid: 0cd792cc87e492d43b4e95b205fc5cc6, 20 | type: 2} 21 | - type: 22 | m_NativeTypeID: 1006 23 | m_ManagedTypePPtr: {fileID: 0} 24 | m_ManagedTypeFallback: 25 | defaultPresets: 26 | - m_Preset: {fileID: 2655988077585873504, guid: 7a99f8aa944efe94cb9bd74562b7d5f9, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | [Ll]ibrary/ 2 | [Tt]emp/ 3 | [Oo]bj/ 4 | [Bb]uild/ 5 | [Bb]uilds/ 6 | [Ll]ogs/ 7 | 8 | # Never ignore Asset meta data 9 | ![Aa]ssets/**/*.meta 10 | 11 | # Uncomment this line if you wish to ignore the asset store tools plugin 12 | # [Aa]ssets/AssetStoreTools* 13 | 14 | # TextMesh Pro files 15 | [Aa]ssets/TextMesh*Pro/ 16 | 17 | # Visual Studio cache directory 18 | .vs/ 19 | 20 | # Gradle cache directory 21 | .gradle/ 22 | 23 | # Autogenerated VS/MD/Consulo solution and project files 24 | ExportedObj/ 25 | .consulo/ 26 | *.csproj 27 | *.unityproj 28 | *.sln 29 | *.suo 30 | *.tmp 31 | *.user 32 | *.userprefs 33 | *.pidb 34 | *.booproj 35 | *.svd 36 | *.pdb 37 | *.mdb 38 | *.opendb 39 | *.VC.db 40 | 41 | # Unity3D generated meta files 42 | *.pidb.meta 43 | *.pdb.meta 44 | *.mdb.meta 45 | 46 | # Unity3D generated file on crash reports 47 | sysinfo.txt 48 | 49 | # Builds 50 | *.apk 51 | *.unitypackage 52 | 53 | # Crashlytics generated file 54 | crashlytics-build.properties -------------------------------------------------------------------------------- /Voxel/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: 1 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 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Oak.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Voxel.Blocks 4 | { 5 | [Serializable] 6 | public class Block_Oak : Block 7 | { 8 | 9 | public Block_Oak() : base() 10 | { 11 | 12 | } 13 | public override MeshData BlockData(Chunk chunk, int x, int y, int z, MeshData meshData) 14 | { 15 | meshData.useRenderDataForCollider = true; 16 | 17 | return base.BlockData(chunk, x, y, z, meshData); 18 | } 19 | 20 | public override Tile TexturePosition(Direction direction) 21 | { 22 | Tile tile = new Tile(); 23 | switch (direction) 24 | { 25 | case Direction.Up: 26 | tile.x = 2; 27 | tile.y = 1; 28 | return tile; 29 | 30 | case Direction.Down: 31 | tile.x = 2; 32 | tile.y = 1; 33 | return tile; 34 | } 35 | 36 | tile.x = 1; 37 | tile.y = 1; 38 | 39 | return tile; 40 | } 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerInteraction.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Voxel.Blocks; 5 | 6 | public class PlayerInteraction : MonoBehaviour 7 | { 8 | public Camera playerCamera; 9 | private static float interactionDistance = 5; 10 | 11 | private void Start() 12 | { 13 | if(playerCamera == null) 14 | { 15 | playerCamera = Camera.main; 16 | } 17 | } 18 | 19 | void Update() 20 | { 21 | if (Input.GetMouseButtonDown(0)) 22 | { 23 | RaycastHit hit; 24 | if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit, interactionDistance)) 25 | { 26 | EditTerrain.SetBlock(hit, new Block_Air()); 27 | } 28 | } 29 | 30 | if (Input.GetMouseButtonDown(1)) 31 | { 32 | RaycastHit hit; 33 | if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hit, interactionDistance)) 34 | { 35 | EditTerrain.SetBlock(hit, new Block_Stone(), true); 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Voxel/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: 8 7 | m_Gravity: {x: 0, y: -9.81, z: 0} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_BounceThreshold: 2 10 | m_SleepThreshold: 0.005 11 | m_DefaultContactOffset: 0.01 12 | m_DefaultSolverIterations: 6 13 | m_DefaultSolverVelocityIterations: 1 14 | m_QueriesHitBackfaces: 0 15 | m_QueriesHitTriggers: 1 16 | m_EnableAdaptiveForce: 0 17 | m_ClothInterCollisionDistance: 0 18 | m_ClothInterCollisionStiffness: 0 19 | m_ContactsGeneration: 1 20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 | m_AutoSimulation: 1 22 | m_AutoSyncTransforms: 0 23 | m_ReuseCollisionCallbacks: 1 24 | m_ClothInterCollisionSettingsToggle: 0 25 | m_ContactPairsMode: 0 26 | m_BroadphaseType: 0 27 | m_WorldBounds: 28 | m_Center: {x: 0, y: 0, z: 0} 29 | m_Extent: {x: 250, y: 250, z: 250} 30 | m_WorldSubdivisions: 8 31 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/WorldPosition.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using System; 5 | 6 | namespace Voxel 7 | { 8 | [Serializable] 9 | public struct WorldPosition 10 | { 11 | public int x, y, z; 12 | 13 | public WorldPosition(int x, int y, int z) 14 | { 15 | this.x = x; 16 | this.y = y; 17 | this.z = z; 18 | } 19 | 20 | public override bool Equals(object obj) 21 | { 22 | if (!(obj is WorldPosition)) 23 | return false; 24 | 25 | WorldPosition pos = (WorldPosition)obj; 26 | if (pos.x != x || pos.y != y || pos.z != z) 27 | { 28 | return false; 29 | } 30 | else 31 | { 32 | return true; 33 | } 34 | } 35 | 36 | public override int GetHashCode() 37 | { 38 | unchecked 39 | { 40 | int hash = 47; 41 | hash = hash * 227 + x.GetHashCode(); 42 | hash = hash * 227 + y.GetHashCode(); 43 | hash = hash * 227 + z.GetHashCode(); 44 | return hash; 45 | } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Voxel/Assets/Shaders/BlockShader.shader: -------------------------------------------------------------------------------- 1 | Shader "BlockShader" { 2 | Properties 3 | { 4 | _MainTex("Texture", 2D) = "white" {} 5 | _Cutoff("Alpha cutoff", Range(0,1)) = 0.5 6 | } 7 | 8 | SubShader 9 | { 10 | Tags {"Queue" = "AlphaTest" "IgnoreProjector" = "True" "RenderType" = "TransparentCutout"} 11 | 12 | Pass 13 | { 14 | CGPROGRAM 15 | #pragma vertex vert 16 | #pragma fragment frag 17 | 18 | #include "UnityCG.cginc" 19 | 20 | struct vertexData 21 | { 22 | float4 vertex : POSITION; 23 | float2 uv : TEXCOORD0; 24 | fixed4 color : COLOR; 25 | }; 26 | 27 | struct fragmentData 28 | { 29 | float2 uv : TEXCOORD0; 30 | float4 vertex : SV_POSITION; 31 | fixed4 color : COLOR; 32 | }; 33 | 34 | sampler2D _MainTex; 35 | float4 _MainTex_ST; 36 | float _Cutoff; 37 | 38 | fragmentData vert(vertexData v) 39 | { 40 | fragmentData o; 41 | o.vertex = UnityObjectToClipPos(v.vertex); 42 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 43 | o.color = v.color; 44 | return o; 45 | } 46 | 47 | fixed4 frag(fragmentData i) : SV_Target 48 | { 49 | fixed4 col = tex2D(_MainTex, i.uv) * i.color; 50 | clip(col.a - _Cutoff); 51 | UNITY_APPLY_FOG(i.fogCoord, col); 52 | return col; 53 | } 54 | 55 | ENDCG 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Voxel/Assets/Core/Blocks/Block_Grass.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Voxel.Blocks 4 | { 5 | [Serializable] 6 | public class Block_Grass : Block 7 | { 8 | private bool dirt = false; 9 | 10 | public Block_Grass() : base() 11 | { 12 | 13 | } 14 | public override MeshData BlockData(Chunk chunk, int x, int y, int z, MeshData meshData) 15 | { 16 | meshData.useRenderDataForCollider = true; 17 | 18 | if (chunk.GetBlock(x, y + 1, z).IsSolid(Direction.Down)) 19 | { 20 | dirt = true; 21 | } 22 | 23 | return base.BlockData(chunk, x, y, z, meshData); 24 | } 25 | 26 | public override Tile TexturePosition(Direction direction) 27 | { 28 | Tile tile = new Tile(); 29 | 30 | if (!dirt) 31 | { 32 | switch (direction) 33 | { 34 | case Direction.Up: 35 | tile.x = 2; 36 | tile.y = 0; 37 | return tile; 38 | 39 | case Direction.Down: 40 | tile.x = 1; 41 | tile.y = 0; 42 | return tile; 43 | } 44 | 45 | tile.x = 3; 46 | tile.y = 0; 47 | } 48 | else 49 | { 50 | tile.x = 1; 51 | tile.y = 0; 52 | } 53 | return tile; 54 | } 55 | } 56 | } 57 | 58 | -------------------------------------------------------------------------------- /Voxel/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_AutoSimulation: 1 23 | m_QueriesHitTriggers: 1 24 | m_QueriesStartInColliders: 1 25 | m_ChangeStopsCallbacks: 0 26 | m_CallbacksOnDisable: 1 27 | m_ReuseCollisionCallbacks: 1 28 | m_AutoSyncTransforms: 0 29 | m_AlwaysShowColliders: 0 30 | m_ShowColliderSleep: 1 31 | m_ShowColliderContacts: 0 32 | m_ShowColliderAABB: 0 33 | m_ContactArrowScale: 0.2 34 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 35 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 36 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 37 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 38 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 39 | -------------------------------------------------------------------------------- /Voxel/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 | -------------------------------------------------------------------------------- /Voxel/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.ads": "2.0.8", 4 | "com.unity.analytics": "3.2.2", 5 | "com.unity.collab-proxy": "1.2.15", 6 | "com.unity.package-manager-ui": "2.0.7", 7 | "com.unity.postprocessing": "2.1.4", 8 | "com.unity.purchasing": "2.0.3", 9 | "com.unity.textmeshpro": "1.3.0", 10 | "com.unity.modules.ai": "1.0.0", 11 | "com.unity.modules.animation": "1.0.0", 12 | "com.unity.modules.assetbundle": "1.0.0", 13 | "com.unity.modules.audio": "1.0.0", 14 | "com.unity.modules.cloth": "1.0.0", 15 | "com.unity.modules.director": "1.0.0", 16 | "com.unity.modules.imageconversion": "1.0.0", 17 | "com.unity.modules.imgui": "1.0.0", 18 | "com.unity.modules.jsonserialize": "1.0.0", 19 | "com.unity.modules.particlesystem": "1.0.0", 20 | "com.unity.modules.physics": "1.0.0", 21 | "com.unity.modules.physics2d": "1.0.0", 22 | "com.unity.modules.screencapture": "1.0.0", 23 | "com.unity.modules.terrain": "1.0.0", 24 | "com.unity.modules.terrainphysics": "1.0.0", 25 | "com.unity.modules.tilemap": "1.0.0", 26 | "com.unity.modules.ui": "1.0.0", 27 | "com.unity.modules.uielements": "1.0.0", 28 | "com.unity.modules.umbra": "1.0.0", 29 | "com.unity.modules.unityanalytics": "1.0.0", 30 | "com.unity.modules.unitywebrequest": "1.0.0", 31 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 32 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 33 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 34 | "com.unity.modules.unitywebrequestwww": "1.0.0", 35 | "com.unity.modules.vehicles": "1.0.0", 36 | "com.unity.modules.video": "1.0.0", 37 | "com.unity.modules.vr": "1.0.0", 38 | "com.unity.modules.wind": "1.0.0", 39 | "com.unity.modules.xr": "1.0.0" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/EditTerrain.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Voxel; 5 | using Voxel.Blocks; 6 | 7 | public static class EditTerrain 8 | { 9 | public static bool SetBlock(RaycastHit hit, Block block, bool adjacent = false) 10 | { 11 | Chunk chunk = hit.collider.GetComponent(); 12 | if (chunk == null) 13 | return false; 14 | 15 | WorldPosition pos = GetBlockPosition(hit, adjacent); 16 | 17 | chunk.world.SetBlock(pos.x, pos.y, pos.z, block); 18 | 19 | return true; 20 | } 21 | 22 | public static Block GetBlock(RaycastHit hit, bool adjacent = false) 23 | { 24 | Chunk chunk = hit.collider.GetComponent(); 25 | if (chunk == null) 26 | return null; 27 | 28 | WorldPosition pos = GetBlockPosition(hit, adjacent); 29 | 30 | Block block = chunk.world.GetBlock(pos.x, pos.y, pos.z); 31 | 32 | return block; 33 | } 34 | 35 | public static WorldPosition GetBlockPosition(Vector3 pos) 36 | { 37 | WorldPosition blockPos = new WorldPosition(Mathf.RoundToInt(pos.x), Mathf.RoundToInt(pos.y), Mathf.RoundToInt(pos.z)); 38 | 39 | return blockPos; 40 | } 41 | 42 | public static WorldPosition GetBlockPosition(RaycastHit hit, bool adjacent = false) 43 | { 44 | Vector3 pos = new Vector3(MoveWithinBlock(hit.point.x, hit.normal.x, adjacent), MoveWithinBlock(hit.point.y, hit.normal.y, adjacent), MoveWithinBlock(hit.point.z, hit.normal.z, adjacent)); 45 | 46 | return GetBlockPosition(pos); 47 | } 48 | 49 | static float MoveWithinBlock(float pos, float norm, bool adjacent = false) 50 | { 51 | if (pos - (int)pos == 0.5f || pos - (int)pos == -0.5f) 52 | { 53 | if (adjacent) 54 | { 55 | pos += (norm / 2); 56 | } 57 | else 58 | { 59 | pos -= (norm / 2); 60 | } 61 | } 62 | 63 | return (float)pos; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Serialization.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using System; 4 | using System.IO; 5 | using System.Runtime.Serialization.Formatters.Binary; 6 | using System.Runtime.Serialization; 7 | using Voxel; 8 | using Voxel.Blocks; 9 | 10 | using UnityEngine; 11 | 12 | public static class Serialization 13 | { 14 | public static string saveFolderName = "VoxelGameSaves"; 15 | 16 | public static string SaveLocation(string worldName) 17 | { 18 | string saveLocation = saveFolderName + "/" + worldName + "/"; 19 | 20 | if (!Directory.Exists(saveLocation)) 21 | { 22 | Directory.CreateDirectory(saveLocation); 23 | } 24 | 25 | return saveLocation; 26 | } 27 | 28 | public static string FileName(WorldPosition chunkLocation) 29 | { 30 | string fileName = chunkLocation.x + "," + chunkLocation.y + "," + chunkLocation.z + ".bin"; 31 | return fileName; 32 | } 33 | 34 | public static void SaveChunk(Chunk chunk) 35 | { 36 | Save save = new Save(chunk); 37 | if (save.blocks.Count == 0) 38 | return; 39 | string saveFile = SaveLocation(chunk.world.worldName); 40 | saveFile += FileName(chunk.position); 41 | IFormatter formatter = new BinaryFormatter(); 42 | Stream stream = new FileStream(saveFile, FileMode.Create, FileAccess.Write, FileShare.None); 43 | formatter.Serialize(stream, chunk.blocks); 44 | stream.Close(); 45 | 46 | } 47 | 48 | public static bool Load(Chunk chunk) 49 | { 50 | string saveFile = SaveLocation(chunk.world.worldName); 51 | saveFile += FileName(chunk.position); 52 | 53 | if (!File.Exists(saveFile)) 54 | return false; 55 | 56 | IFormatter formatter = new BinaryFormatter(); 57 | FileStream stream = new FileStream(saveFile, FileMode.Open); 58 | 59 | Save save = (Save)formatter.Deserialize(stream); 60 | foreach (var block in save.blocks) 61 | { 62 | chunk.blocks[block.Key.x, block.Key.y, block.Key.z] = block.Value; 63 | } 64 | stream.Close(); 65 | return true; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/MeshData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace Voxel 5 | { 6 | public class MeshData 7 | { 8 | public List vertices = new List(); 9 | public List triangles = new List(); 10 | public List uv = new List(); 11 | public List colors = new List(); 12 | 13 | public List colliderVertices = new List(); 14 | public List colliderTriangles = new List(); 15 | 16 | public bool useRenderDataForCollider; 17 | 18 | public MeshData() 19 | { 20 | 21 | } 22 | 23 | public void AddQuadTriangles() 24 | { 25 | triangles.Add(vertices.Count - 4); 26 | triangles.Add(vertices.Count - 3); 27 | triangles.Add(vertices.Count - 2); 28 | triangles.Add(vertices.Count - 4); 29 | triangles.Add(vertices.Count - 2); 30 | triangles.Add(vertices.Count - 1); 31 | 32 | if (useRenderDataForCollider) 33 | { 34 | colliderTriangles.Add(colliderVertices.Count - 4); 35 | colliderTriangles.Add(colliderVertices.Count - 3); 36 | colliderTriangles.Add(colliderVertices.Count - 2); 37 | colliderTriangles.Add(colliderVertices.Count - 4); 38 | colliderTriangles.Add(colliderVertices.Count - 2); 39 | colliderTriangles.Add(colliderVertices.Count - 1); 40 | } 41 | } 42 | 43 | public void AddColor(Color color) 44 | { 45 | colors.Add(color); 46 | } 47 | 48 | public void AddVertex(Vector3 vertex) 49 | { 50 | vertices.Add(vertex); 51 | if (useRenderDataForCollider) 52 | { 53 | colliderVertices.Add(vertex); 54 | } 55 | } 56 | 57 | public void AddTriangle(int tri) 58 | { 59 | triangles.Add(tri); 60 | if (useRenderDataForCollider) 61 | { 62 | colliderTriangles.Add(tri - (vertices.Count - colliderVertices.Count)); 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Voxel/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: 12 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: 10783, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 16000, 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 | -------------------------------------------------------------------------------- /Voxel/Assets/Skybox.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: Skybox 11 | m_Shader: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: _SUNDISK_HIGH_QUALITY 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _DetailAlbedoMap: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailMask: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailNormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _EmissionMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _MainTex: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MetallicGlossMap: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _OcclusionMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _ParallaxMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | m_Floats: 59 | - _AtmosphereThickness: 1 60 | - _BumpScale: 1 61 | - _Cutoff: 0.5 62 | - _DetailNormalMapScale: 1 63 | - _DstBlend: 0 64 | - _Exposure: 1.3 65 | - _GlossMapScale: 1 66 | - _Glossiness: 0.5 67 | - _GlossyReflections: 1 68 | - _Metallic: 0 69 | - _Mode: 0 70 | - _OcclusionStrength: 1 71 | - _Parallax: 0.02 72 | - _SmoothnessTextureChannel: 0 73 | - _SpecularHighlights: 1 74 | - _SrcBlend: 1 75 | - _SunDisk: 2 76 | - _SunSize: 0.04 77 | - _SunSizeConvergence: 5 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 1} 82 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 83 | - _GroundColor: {r: 0.63529414, g: 0.76470596, b: 0.9058824, a: 1} 84 | - _SkyTint: {r: 0.5, g: 0.5, b: 0.5, a: 1} 85 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/Blocks/BlockTextures.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6b8629160c4c4634b8d72d525f7d32db 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 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: 0 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 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 128 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 128 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/UI/Crosshair.png.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e96041d3962a4694287f4856ff460f3d 3 | TextureImporter: 4 | fileIDToRecycleName: {} 5 | externalObjects: {} 6 | serializedVersion: 9 7 | mipmaps: 8 | mipMapMode: 0 9 | enableMipMap: 0 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: 0 35 | aniso: -1 36 | mipBias: -100 37 | wrapU: 1 38 | wrapV: 1 39 | wrapW: -1 40 | nPOTScale: 0 41 | lightmap: 0 42 | compressionQuality: 50 43 | spriteMode: 1 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: 1 53 | spriteTessellationDetail: -1 54 | textureType: 8 55 | textureShape: 1 56 | singleChannelComponent: 0 57 | maxTextureSizeSet: 0 58 | compressionQualitySet: 0 59 | textureFormatSet: 0 60 | platformSettings: 61 | - serializedVersion: 2 62 | buildTarget: DefaultTexturePlatform 63 | maxTextureSize: 32 64 | resizeAlgorithm: 0 65 | textureFormat: -1 66 | textureCompression: 0 67 | compressionQuality: 50 68 | crunchedCompression: 0 69 | allowsAlphaSplitting: 0 70 | overridden: 0 71 | androidETC2FallbackOverride: 0 72 | - serializedVersion: 2 73 | buildTarget: Standalone 74 | maxTextureSize: 32 75 | resizeAlgorithm: 0 76 | textureFormat: -1 77 | textureCompression: 0 78 | compressionQuality: 50 79 | crunchedCompression: 0 80 | allowsAlphaSplitting: 0 81 | overridden: 0 82 | androidETC2FallbackOverride: 0 83 | spriteSheet: 84 | serializedVersion: 2 85 | sprites: [] 86 | outline: [] 87 | physicsShape: [] 88 | bones: [] 89 | spriteID: 2529e15c750eb0c44b88e467e3f9f667 90 | vertices: [] 91 | indices: 92 | edges: [] 93 | weights: [] 94 | spritePackingTag: 95 | pSDRemoveMatte: 0 96 | pSDShowRemoveMatteOption: 0 97 | userData: 98 | assetBundleName: 99 | assetBundleVariant: 100 | -------------------------------------------------------------------------------- /Voxel/Assets/Textures/Blocks/Materials/BlockTextures.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: BlockTextures 11 | m_Shader: {fileID: 4800000, guid: 2ae8ec34af549564c8ebbdbed4933679, type: 3} 12 | m_ShaderKeywords: _ALPHATEST_ON _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF 13 | m_LightmapFlags: 4 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: -1 17 | stringTagMap: {} 18 | disabledShaderPasses: [] 19 | m_SavedProperties: 20 | serializedVersion: 3 21 | m_TexEnvs: 22 | - _BumpMap: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _CutTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _DetailAlbedoMap: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _DetailMask: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _DetailNormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - _EmissionMap: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - _MainTex: 47 | m_Texture: {fileID: 2800000, guid: 6b8629160c4c4634b8d72d525f7d32db, type: 3} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - _MetallicGlossMap: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | - _OcclusionMap: 55 | m_Texture: {fileID: 0} 56 | m_Scale: {x: 1, y: 1} 57 | m_Offset: {x: 0, y: 0} 58 | - _ParallaxMap: 59 | m_Texture: {fileID: 0} 60 | m_Scale: {x: 1, y: 1} 61 | m_Offset: {x: 0, y: 0} 62 | m_Floats: 63 | - _BumpScale: 1 64 | - _Cutoff: 0.5 65 | - _DetailNormalMapScale: 1 66 | - _DstBlend: 0 67 | - _GlossMapScale: 0 68 | - _Glossiness: 0 69 | - _GlossyReflections: 0 70 | - _Metallic: 0.2 71 | - _Mode: 1 72 | - _OcclusionStrength: 1 73 | - _Parallax: 0.02 74 | - _Shininess: 0.1 75 | - _SmoothnessTextureChannel: 0 76 | - _SpecularHighlights: 0 77 | - _SrcBlend: 1 78 | - _UVSec: 0 79 | - _ZWrite: 1 80 | m_Colors: 81 | - _Color: {r: 1, g: 1, b: 1, a: 0.50980395} 82 | - _Emission: {r: 0, g: 0, b: 0, a: 0} 83 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 84 | - _Mod: {r: 1, g: 1, b: 1, a: 1} 85 | - _SpecColor: {r: 1, g: 1, b: 1, a: 0} 86 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerLook.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [System.Serializable] 6 | public class PlayerLook 7 | { 8 | public float XSensitivity = 2f; 9 | public float YSensitivity = 2f; 10 | public bool clampVerticalRotation = true; 11 | public float MinimumX = -90F; 12 | public float MaximumX = 90F; 13 | public bool smooth; 14 | public float smoothTime = 5f; 15 | public bool lockCursor = true; 16 | 17 | 18 | private Quaternion m_CharacterTargetRot; 19 | private Quaternion m_CameraTargetRot; 20 | private bool m_cursorIsLocked = true; 21 | 22 | public void Init(Transform character, Transform camera) 23 | { 24 | m_CharacterTargetRot = character.localRotation; 25 | m_CameraTargetRot = camera.localRotation; 26 | } 27 | 28 | 29 | public void LookRotation(Transform character, Transform camera) 30 | { 31 | float yRot = Input.GetAxis("Mouse X") * XSensitivity; 32 | float xRot = Input.GetAxis("Mouse Y") * YSensitivity; 33 | 34 | m_CharacterTargetRot *= Quaternion.Euler(0f, yRot, 0f); 35 | m_CameraTargetRot *= Quaternion.Euler(-xRot, 0f, 0f); 36 | 37 | if (clampVerticalRotation) 38 | m_CameraTargetRot = ClampRotationAroundXAxis(m_CameraTargetRot); 39 | 40 | if (smooth) 41 | { 42 | character.localRotation = Quaternion.Slerp(character.localRotation, m_CharacterTargetRot, 43 | smoothTime * Time.deltaTime); 44 | camera.localRotation = Quaternion.Slerp(camera.localRotation, m_CameraTargetRot, 45 | smoothTime * Time.deltaTime); 46 | } 47 | else 48 | { 49 | character.localRotation = m_CharacterTargetRot; 50 | camera.localRotation = m_CameraTargetRot; 51 | } 52 | 53 | UpdateCursorLock(); 54 | } 55 | 56 | public void SetCursorLock(bool value) 57 | { 58 | lockCursor = value; 59 | if (!lockCursor) 60 | {//we force unlock the cursor if the user disable the cursor locking helper 61 | Cursor.lockState = CursorLockMode.None; 62 | Cursor.visible = true; 63 | } 64 | } 65 | 66 | public void UpdateCursorLock() 67 | { 68 | //if the user set "lockCursor" we check & properly lock the cursos 69 | if (lockCursor) 70 | InternalLockUpdate(); 71 | } 72 | 73 | private void InternalLockUpdate() 74 | { 75 | if (Input.GetKeyUp(KeyCode.Escape)) 76 | { 77 | m_cursorIsLocked = false; 78 | } 79 | else if (Input.GetMouseButtonUp(0)) 80 | { 81 | m_cursorIsLocked = true; 82 | } 83 | 84 | if (m_cursorIsLocked) 85 | { 86 | Cursor.lockState = CursorLockMode.Locked; 87 | Cursor.visible = false; 88 | } 89 | else if (!m_cursorIsLocked) 90 | { 91 | Cursor.lockState = CursorLockMode.None; 92 | Cursor.visible = true; 93 | } 94 | } 95 | 96 | Quaternion ClampRotationAroundXAxis(Quaternion q) 97 | { 98 | q.x /= q.w; 99 | q.y /= q.w; 100 | q.z /= q.w; 101 | q.w = 1.0f; 102 | 103 | float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan(q.x); 104 | 105 | angleX = Mathf.Clamp(angleX, MinimumX, MaximumX); 106 | 107 | q.x = Mathf.Tan(0.5f * Mathf.Deg2Rad * angleX); 108 | 109 | return q; 110 | } 111 | 112 | } 113 | -------------------------------------------------------------------------------- /Voxel/Assets/Prefabs/Voxel/Chunk.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5440666592941423039 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: 5440666592941423034} 12 | - component: {fileID: 5440666592941423035} 13 | - component: {fileID: 5440666592941423036} 14 | - component: {fileID: 5440666592941423037} 15 | - component: {fileID: 5440666592941423038} 16 | m_Layer: 0 17 | m_Name: Chunk 18 | m_TagString: Untagged 19 | m_Icon: {fileID: 0} 20 | m_NavMeshLayer: 0 21 | m_StaticEditorFlags: 0 22 | m_IsActive: 1 23 | --- !u!4 &5440666592941423034 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: 5440666592941423039} 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!114 &5440666592941423035 38 | MonoBehaviour: 39 | m_ObjectHideFlags: 0 40 | m_CorrespondingSourceObject: {fileID: 0} 41 | m_PrefabInstance: {fileID: 0} 42 | m_PrefabAsset: {fileID: 0} 43 | m_GameObject: {fileID: 5440666592941423039} 44 | m_Enabled: 1 45 | m_EditorHideFlags: 0 46 | m_Script: {fileID: 11500000, guid: e2e44cc43e3926f4384c2d0ef3e7cdb8, type: 3} 47 | m_Name: 48 | m_EditorClassIdentifier: 49 | update: 0 50 | rendered: 0 51 | world: {fileID: 0} 52 | position: 53 | x: 0 54 | y: 0 55 | z: 0 56 | --- !u!33 &5440666592941423036 57 | MeshFilter: 58 | m_ObjectHideFlags: 0 59 | m_CorrespondingSourceObject: {fileID: 0} 60 | m_PrefabInstance: {fileID: 0} 61 | m_PrefabAsset: {fileID: 0} 62 | m_GameObject: {fileID: 5440666592941423039} 63 | m_Mesh: {fileID: 0} 64 | --- !u!23 &5440666592941423037 65 | MeshRenderer: 66 | m_ObjectHideFlags: 0 67 | m_CorrespondingSourceObject: {fileID: 0} 68 | m_PrefabInstance: {fileID: 0} 69 | m_PrefabAsset: {fileID: 0} 70 | m_GameObject: {fileID: 5440666592941423039} 71 | m_Enabled: 1 72 | m_CastShadows: 1 73 | m_ReceiveShadows: 1 74 | m_DynamicOccludee: 1 75 | m_MotionVectors: 1 76 | m_LightProbeUsage: 1 77 | m_ReflectionProbeUsage: 1 78 | m_RenderingLayerMask: 1 79 | m_RendererPriority: 0 80 | m_Materials: 81 | - {fileID: 2100000, guid: c02a881af6cae2342bcb07641ba837fb, type: 2} 82 | m_StaticBatchInfo: 83 | firstSubMesh: 0 84 | subMeshCount: 0 85 | m_StaticBatchRoot: {fileID: 0} 86 | m_ProbeAnchor: {fileID: 0} 87 | m_LightProbeVolumeOverride: {fileID: 0} 88 | m_ScaleInLightmap: 1 89 | m_PreserveUVs: 0 90 | m_IgnoreNormalsForChartDetection: 0 91 | m_ImportantGI: 0 92 | m_StitchLightmapSeams: 0 93 | m_SelectedEditorRenderState: 3 94 | m_MinimumChartSize: 4 95 | m_AutoUVMaxDistance: 0.5 96 | m_AutoUVMaxAngle: 89 97 | m_LightmapParameters: {fileID: 0} 98 | m_SortingLayerID: 0 99 | m_SortingLayer: 0 100 | m_SortingOrder: 0 101 | --- !u!64 &5440666592941423038 102 | MeshCollider: 103 | m_ObjectHideFlags: 0 104 | m_CorrespondingSourceObject: {fileID: 0} 105 | m_PrefabInstance: {fileID: 0} 106 | m_PrefabAsset: {fileID: 0} 107 | m_GameObject: {fileID: 5440666592941423039} 108 | m_Material: {fileID: 0} 109 | m_IsTrigger: 0 110 | m_Enabled: 1 111 | serializedVersion: 3 112 | m_Convex: 0 113 | m_CookingOptions: 14 114 | m_Mesh: {fileID: 0} 115 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Chunk.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System.Collections; 3 | using System.Collections.Generic; 4 | using System; 5 | using System.Threading; 6 | using Voxel.Blocks; 7 | 8 | namespace Voxel 9 | { 10 | [RequireComponent(typeof(MeshFilter))] 11 | [RequireComponent(typeof(MeshRenderer))] 12 | [RequireComponent(typeof(MeshCollider))] 13 | public class Chunk : MonoBehaviour 14 | { 15 | public Block[,,] blocks = new Block[chunkSize,chunkSize,chunkSize]; 16 | public static int chunkSize = 16; 17 | public bool update = false; 18 | public bool rendered; 19 | public World world; 20 | public WorldPosition position; 21 | 22 | private MeshFilter meshFilter; 23 | private MeshCollider meshCollider; 24 | 25 | void Start() 26 | { 27 | meshFilter = gameObject.GetComponent(); 28 | meshCollider = gameObject.GetComponent(); 29 | } 30 | 31 | void Update() 32 | { 33 | if (update) 34 | { 35 | update = false; 36 | UpdateChunk(); 37 | rendered = true; 38 | } 39 | } 40 | 41 | public Block GetBlock(int x, int y, int z) 42 | { 43 | if (InRange(x) && InRange(y) && InRange(z)) 44 | return blocks[x, y, z]; 45 | 46 | return world.GetBlock(position.x + x, position.y + y, position.z + z); 47 | } 48 | 49 | public void SetBlock(int x, int y, int z, Block block) 50 | { 51 | if (InRange(x) && InRange(y) && InRange(z)) 52 | { 53 | blocks[x, y, z] = block; 54 | } 55 | else 56 | { 57 | world.SetBlock(position.x + x, position.y + y, position.z + z, block); 58 | } 59 | } 60 | 61 | public void SetBlocksUnmodified() 62 | { 63 | foreach (Block block in blocks) 64 | { 65 | block.changed = false; 66 | } 67 | } 68 | 69 | private void UpdateChunk() 70 | { 71 | MeshData meshData = new MeshData(); 72 | 73 | for (int x = 0; x < chunkSize; x++) 74 | { 75 | for (int y = 0; y < chunkSize; y++) 76 | { 77 | for (int z = 0; z < chunkSize; z++) 78 | { 79 | meshData = blocks[x, y, z].BlockData(this, x, y, z, meshData); 80 | } 81 | } 82 | } 83 | RenderMesh(meshData); 84 | } 85 | 86 | private void RenderMesh(MeshData meshData) 87 | { 88 | meshFilter.mesh.Clear(); 89 | meshFilter.mesh.vertices = meshData.vertices.ToArray(); 90 | meshFilter.mesh.triangles = meshData.triangles.ToArray(); 91 | meshFilter.mesh.colors = meshData.colors.ToArray(); 92 | 93 | meshFilter.mesh.uv = meshData.uv.ToArray(); 94 | meshFilter.mesh.RecalculateNormals(); 95 | 96 | meshCollider.sharedMesh = null; 97 | Mesh mesh = new Mesh(); 98 | mesh.vertices = meshData.colliderVertices.ToArray(); 99 | mesh.triangles = meshData.colliderTriangles.ToArray(); 100 | mesh.RecalculateNormals(); 101 | 102 | meshCollider.sharedMesh = mesh; 103 | 104 | } 105 | 106 | public static bool InRange(int index) 107 | { 108 | if (index < 0 || index >= chunkSize) 109 | return false; 110 | 111 | return true; 112 | } 113 | 114 | } 115 | } -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/World.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using Voxel.Blocks; 4 | 5 | namespace Voxel 6 | { 7 | public class World : MonoBehaviour 8 | { 9 | public string worldName = "world"; 10 | public GameObject chunkPrefab; 11 | public Dictionary chunks = new Dictionary(); 12 | 13 | public void CreateChunk(int x, int y, int z) 14 | { 15 | WorldPosition worldPosition = new WorldPosition(x, y, z); 16 | GameObject newChunkObject = Instantiate(chunkPrefab, new Vector3(x, y, z), Quaternion.Euler(Vector3.zero)) as GameObject; 17 | Chunk newChunk = newChunkObject.GetComponent(); 18 | newChunk.position = worldPosition; 19 | newChunk.world = this; 20 | chunks.Add(worldPosition, newChunk); 21 | 22 | var terrainGen = new TerrainGen(); 23 | newChunk = terrainGen.ChunkGen(newChunk); 24 | 25 | newChunk.SetBlocksUnmodified(); 26 | Serialization.Load(newChunk); 27 | } 28 | 29 | public void DestroyChunk(int x, int y, int z) 30 | { 31 | Chunk chunk = null; 32 | if (chunks.TryGetValue(new WorldPosition(x, y, z), out chunk)) 33 | { 34 | Serialization.SaveChunk(chunk); 35 | Object.Destroy(chunk.gameObject); 36 | chunks.Remove(new WorldPosition(x, y, z)); 37 | } 38 | } 39 | 40 | public Chunk GetChunk(int x, int y, int z) 41 | { 42 | WorldPosition pos = new WorldPosition(); 43 | float multiple = Chunk.chunkSize; 44 | pos.x = Mathf.FloorToInt(x / multiple) * Chunk.chunkSize; 45 | pos.y = Mathf.FloorToInt(y / multiple) * Chunk.chunkSize; 46 | pos.z = Mathf.FloorToInt(z / multiple) * Chunk.chunkSize; 47 | Chunk containerChunk = null; 48 | chunks.TryGetValue(pos, out containerChunk); 49 | 50 | return containerChunk; 51 | } 52 | 53 | public Block GetBlock(int x, int y, int z) 54 | { 55 | Chunk containerChunk = GetChunk(x, y, z); 56 | if (containerChunk != null) 57 | { 58 | Block block = containerChunk.GetBlock(x - containerChunk.position.x, y - containerChunk.position.y, z - containerChunk.position.z); 59 | return block; 60 | } 61 | else 62 | { 63 | return new Block_Air(); 64 | } 65 | 66 | } 67 | 68 | public void SetBlock(int x, int y, int z, Block block) 69 | { 70 | Chunk chunk = GetChunk(x, y, z); 71 | 72 | if (chunk != null) 73 | { 74 | chunk.SetBlock(x - chunk.position.x, y - chunk.position.y, z - chunk.position.z, block); 75 | chunk.update = true; 76 | 77 | UpdateIfEqual(x - chunk.position.x, 0, new WorldPosition(x - 1, y, z)); 78 | UpdateIfEqual(x - chunk.position.x, Chunk.chunkSize - 1, new WorldPosition(x + 1, y, z)); 79 | UpdateIfEqual(y - chunk.position.y, 0, new WorldPosition(x, y - 1, z)); 80 | UpdateIfEqual(y - chunk.position.y, Chunk.chunkSize - 1, new WorldPosition(x, y + 1, z)); 81 | UpdateIfEqual(z - chunk.position.z, 0, new WorldPosition(x, y, z - 1)); 82 | UpdateIfEqual(z - chunk.position.z, Chunk.chunkSize - 1, new WorldPosition(x, y, z + 1)); 83 | } 84 | } 85 | 86 | void UpdateIfEqual(int value1, int value2, WorldPosition pos) 87 | { 88 | if (value1 == value2) 89 | { 90 | Chunk chunk = GetChunk(pos.x, pos.y, pos.z); 91 | if (chunk != null) 92 | chunk.update = true; 93 | } 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/TerrainGen.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Voxel; 5 | using Voxel.Blocks; 6 | using Noise; 7 | 8 | public class TerrainGen 9 | { 10 | float stoneBaseHeight = -48; 11 | float stoneBaseNoise = 0.01f; 12 | float stoneBaseNoiseHeight = 8; 13 | float stoneMountainHeight = 48; 14 | float stoneMountainFrequency = 0.008f; 15 | float stoneMinHeight = -12; 16 | 17 | float dirtBaseHeight = 5; 18 | float dirtNoise = 0.02f; 19 | float dirtNoiseHeight = 3; 20 | 21 | float caveFrequency = 0.025f; 22 | int caveSize = 7; 23 | 24 | float treeFrequency = 0.2f; 25 | int treeDensity = 3; 26 | 27 | public Chunk ChunkGen(Chunk chunk) 28 | { 29 | for (int x = chunk.position.x - 3; x < chunk.position.x + Chunk.chunkSize + 3; x++) 30 | { 31 | for (int z = chunk.position.z - 3; z < chunk.position.z + Chunk.chunkSize + 3; z++) 32 | { 33 | chunk = ChunkColumnGen(chunk, x, z); 34 | } 35 | } 36 | return chunk; 37 | } 38 | 39 | public Chunk ChunkColumnGen(Chunk chunk, int x, int z) 40 | { 41 | int stoneHeight = Mathf.FloorToInt(stoneBaseHeight); 42 | stoneHeight += GetSimplexNoise(x, 0, z, stoneMountainFrequency, Mathf.FloorToInt(stoneMountainHeight)); 43 | 44 | if (stoneHeight < stoneMinHeight) 45 | stoneHeight = Mathf.FloorToInt(stoneMinHeight); 46 | 47 | stoneHeight += GetSimplexNoise(x, 0, z, stoneBaseNoise, Mathf.FloorToInt(stoneBaseNoiseHeight)); 48 | int dirtHeight = stoneHeight + Mathf.FloorToInt(dirtBaseHeight); 49 | dirtHeight += GetSimplexNoise(x, 100, z, dirtNoise, Mathf.FloorToInt(dirtNoiseHeight)); 50 | 51 | for (int y = chunk.position.y - 8; y < chunk.position.y + Chunk.chunkSize; y++) 52 | { 53 | int caveChance = GetSimplexNoise(x, y, z, caveFrequency, 75); 54 | if (y <= stoneHeight && caveSize < caveChance) 55 | { 56 | SetBlock(x, y, z, new Block_Stone(), chunk); 57 | } 58 | else if (y <= dirtHeight && caveSize < caveChance) 59 | { 60 | SetBlock(x, y, z, new Block_Grass(), chunk); 61 | 62 | if (y == dirtHeight && GetSimplexNoise(x, 0, z, treeFrequency, 100) < treeDensity) 63 | CreateTree(x, y + 1, z, chunk); 64 | } 65 | else 66 | { 67 | SetBlock(x, y, z, new Block_Air(), chunk); 68 | } 69 | } 70 | return chunk; 71 | } 72 | 73 | void CreateTree(int x, int y, int z, Chunk chunk) 74 | { 75 | for (int xi = -2; xi <= 2; xi++) 76 | { 77 | for (int yi = 4; yi <= 8; yi++) 78 | { 79 | for (int zi = -2; zi <= 2; zi++) 80 | { 81 | SetBlock(x + xi, y + yi, z + zi, new Block_Oak_Leaves(), chunk, true); 82 | } 83 | } 84 | } 85 | 86 | for (int yt = 0; yt < 6; yt++) 87 | { 88 | SetBlock(x, y + yt, z, new Block_Oak(), chunk, true); 89 | } 90 | } 91 | 92 | public static void SetBlock(int x, int y, int z, Block block, Chunk chunk, bool replaceBlocks = false) 93 | { 94 | x -= chunk.position.x; 95 | y -= chunk.position.y; 96 | z -= chunk.position.z; 97 | if (Chunk.InRange(x) && Chunk.InRange(y) && Chunk.InRange(z)) 98 | { 99 | if (replaceBlocks || chunk.blocks[x, y, z] == null) 100 | chunk.SetBlock(x, y, z, block); 101 | } 102 | } 103 | 104 | public int GetSimplexNoise(int x, int y, int z, float scale, int max) 105 | { 106 | return Mathf.FloorToInt((SimplexNoise.Generate(x * scale, y * scale, z * scale) + 1f) * (max / 2f)); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /Voxel/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 | -------------------------------------------------------------------------------- /Voxel/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: 4 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Very Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | blendWeights: 1 22 | textureQuality: 1 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.3 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 4 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | excludedTargetPlatforms: [] 44 | - serializedVersion: 2 45 | name: Low 46 | pixelLightCount: 0 47 | shadows: 0 48 | shadowResolution: 0 49 | shadowProjection: 1 50 | shadowCascades: 1 51 | shadowDistance: 20 52 | shadowNearPlaneOffset: 3 53 | shadowCascade2Split: 0.33333334 54 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 55 | shadowmaskMode: 0 56 | blendWeights: 2 57 | textureQuality: 0 58 | anisotropicTextures: 0 59 | antiAliasing: 0 60 | softParticles: 0 61 | softVegetation: 0 62 | realtimeReflectionProbes: 0 63 | billboardsFaceCameraPosition: 0 64 | vSyncCount: 0 65 | lodBias: 0.4 66 | maximumLODLevel: 0 67 | streamingMipmapsActive: 0 68 | streamingMipmapsAddAllCameras: 1 69 | streamingMipmapsMemoryBudget: 512 70 | streamingMipmapsRenderersPerFrame: 512 71 | streamingMipmapsMaxLevelReduction: 2 72 | streamingMipmapsMaxFileIORequests: 1024 73 | particleRaycastBudget: 16 74 | asyncUploadTimeSlice: 2 75 | asyncUploadBufferSize: 16 76 | asyncUploadPersistentBuffer: 1 77 | resolutionScalingFixedDPIFactor: 1 78 | excludedTargetPlatforms: [] 79 | - serializedVersion: 2 80 | name: Medium 81 | pixelLightCount: 1 82 | shadows: 1 83 | shadowResolution: 0 84 | shadowProjection: 1 85 | shadowCascades: 1 86 | shadowDistance: 20 87 | shadowNearPlaneOffset: 3 88 | shadowCascade2Split: 0.33333334 89 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 90 | shadowmaskMode: 0 91 | blendWeights: 2 92 | textureQuality: 0 93 | anisotropicTextures: 1 94 | antiAliasing: 0 95 | softParticles: 0 96 | softVegetation: 0 97 | realtimeReflectionProbes: 0 98 | billboardsFaceCameraPosition: 0 99 | vSyncCount: 1 100 | lodBias: 0.7 101 | maximumLODLevel: 0 102 | streamingMipmapsActive: 0 103 | streamingMipmapsAddAllCameras: 1 104 | streamingMipmapsMemoryBudget: 512 105 | streamingMipmapsRenderersPerFrame: 512 106 | streamingMipmapsMaxLevelReduction: 2 107 | streamingMipmapsMaxFileIORequests: 1024 108 | particleRaycastBudget: 64 109 | asyncUploadTimeSlice: 2 110 | asyncUploadBufferSize: 16 111 | asyncUploadPersistentBuffer: 1 112 | resolutionScalingFixedDPIFactor: 1 113 | excludedTargetPlatforms: [] 114 | - serializedVersion: 2 115 | name: High 116 | pixelLightCount: 2 117 | shadows: 2 118 | shadowResolution: 1 119 | shadowProjection: 1 120 | shadowCascades: 2 121 | shadowDistance: 40 122 | shadowNearPlaneOffset: 3 123 | shadowCascade2Split: 0.33333334 124 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 125 | shadowmaskMode: 1 126 | blendWeights: 2 127 | textureQuality: 0 128 | anisotropicTextures: 1 129 | antiAliasing: 2 130 | softParticles: 0 131 | softVegetation: 1 132 | realtimeReflectionProbes: 1 133 | billboardsFaceCameraPosition: 1 134 | vSyncCount: 1 135 | lodBias: 1 136 | maximumLODLevel: 0 137 | streamingMipmapsActive: 0 138 | streamingMipmapsAddAllCameras: 1 139 | streamingMipmapsMemoryBudget: 512 140 | streamingMipmapsRenderersPerFrame: 512 141 | streamingMipmapsMaxLevelReduction: 2 142 | streamingMipmapsMaxFileIORequests: 1024 143 | particleRaycastBudget: 256 144 | asyncUploadTimeSlice: 2 145 | asyncUploadBufferSize: 16 146 | asyncUploadPersistentBuffer: 1 147 | resolutionScalingFixedDPIFactor: 1 148 | excludedTargetPlatforms: [] 149 | - serializedVersion: 2 150 | name: Very High 151 | pixelLightCount: 3 152 | shadows: 2 153 | shadowResolution: 2 154 | shadowProjection: 1 155 | shadowCascades: 2 156 | shadowDistance: 40 157 | shadowNearPlaneOffset: 3 158 | shadowCascade2Split: 0.33333334 159 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 160 | shadowmaskMode: 1 161 | blendWeights: 4 162 | textureQuality: 0 163 | anisotropicTextures: 1 164 | antiAliasing: 4 165 | softParticles: 1 166 | softVegetation: 1 167 | realtimeReflectionProbes: 1 168 | billboardsFaceCameraPosition: 1 169 | vSyncCount: 1 170 | lodBias: 1.5 171 | maximumLODLevel: 0 172 | streamingMipmapsActive: 0 173 | streamingMipmapsAddAllCameras: 1 174 | streamingMipmapsMemoryBudget: 512 175 | streamingMipmapsRenderersPerFrame: 512 176 | streamingMipmapsMaxLevelReduction: 2 177 | streamingMipmapsMaxFileIORequests: 1024 178 | particleRaycastBudget: 1024 179 | asyncUploadTimeSlice: 2 180 | asyncUploadBufferSize: 16 181 | asyncUploadPersistentBuffer: 1 182 | resolutionScalingFixedDPIFactor: 1 183 | excludedTargetPlatforms: [] 184 | - serializedVersion: 2 185 | name: Ultra 186 | pixelLightCount: 4 187 | shadows: 2 188 | shadowResolution: 2 189 | shadowProjection: 1 190 | shadowCascades: 4 191 | shadowDistance: 150 192 | shadowNearPlaneOffset: 3 193 | shadowCascade2Split: 0.33333334 194 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 195 | shadowmaskMode: 1 196 | blendWeights: 4 197 | textureQuality: 0 198 | anisotropicTextures: 1 199 | antiAliasing: 4 200 | softParticles: 1 201 | softVegetation: 1 202 | realtimeReflectionProbes: 1 203 | billboardsFaceCameraPosition: 1 204 | vSyncCount: 1 205 | lodBias: 2 206 | maximumLODLevel: 0 207 | streamingMipmapsActive: 0 208 | streamingMipmapsAddAllCameras: 1 209 | streamingMipmapsMemoryBudget: 512 210 | streamingMipmapsRenderersPerFrame: 512 211 | streamingMipmapsMaxLevelReduction: 2 212 | streamingMipmapsMaxFileIORequests: 1024 213 | particleRaycastBudget: 4096 214 | asyncUploadTimeSlice: 2 215 | asyncUploadBufferSize: 16 216 | asyncUploadPersistentBuffer: 1 217 | resolutionScalingFixedDPIFactor: 1 218 | excludedTargetPlatforms: [] 219 | m_PerPlatformDefaultQuality: {} 220 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Player/PlayerController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | [RequireComponent(typeof(CharacterController))] 6 | public class PlayerController : MonoBehaviour 7 | { 8 | public PlayerLook playerLook; 9 | public Transform playerCamera; 10 | [Tooltip("How fast the player moves when walking (default move speed).")] 11 | [SerializeField] 12 | private float m_WalkSpeed = 6.0f; 13 | 14 | [Tooltip("How fast the player moves when running.")] 15 | [SerializeField] 16 | private float m_RunSpeed = 11.0f; 17 | 18 | [Tooltip("If true, diagonal speed (when strafing + moving forward or back) can't exceed normal move speed; otherwise it's about 1.4 times faster.")] 19 | [SerializeField] 20 | public bool m_LimitDiagonalSpeed = true; 21 | 22 | [Tooltip("If checked, the run key toggles between running and walking. Otherwise player runs if the key is held down.")] 23 | [SerializeField] 24 | private bool m_ToggleRun = false; 25 | 26 | [Tooltip("How high the player jumps when hitting the jump button.")] 27 | [SerializeField] 28 | private float m_JumpSpeed = 8.0f; 29 | 30 | [Tooltip("How fast the player falls when not standing on anything.")] 31 | [SerializeField] 32 | private float m_Gravity = 20.0f; 33 | 34 | [Tooltip("Units that player can fall before a falling function is run. To disable, type \"infinity\" in the inspector.")] 35 | [SerializeField] 36 | private float m_FallingThreshold = 10.0f; 37 | 38 | [Tooltip("If the player ends up on a slope which is at least the Slope Limit as set on the character controller, then he will slide down.")] 39 | [SerializeField] 40 | private bool m_SlideWhenOverSlopeLimit = false; 41 | 42 | [Tooltip("If checked and the player is on an object tagged \"Slide\", he will slide down it regardless of the slope limit.")] 43 | [SerializeField] 44 | private bool m_SlideOnTaggedObjects = false; 45 | 46 | [Tooltip("How fast the player slides when on slopes as defined above.")] 47 | [SerializeField] 48 | private float m_SlideSpeed = 12.0f; 49 | 50 | [Tooltip("If checked, then the player can change direction while in the air.")] 51 | [SerializeField] 52 | private bool m_AirControl = false; 53 | 54 | [Tooltip("Small amounts of this results in bumping when walking down slopes, but large amounts results in falling too fast.")] 55 | [SerializeField] 56 | private float m_AntiBumpFactor = .75f; 57 | 58 | [Tooltip("Player must be grounded for at least this many physics frames before being able to jump again; set to 0 to allow bunny hopping.")] 59 | [SerializeField] 60 | private int m_AntiBunnyHopFactor = 1; 61 | 62 | private Vector3 m_MoveDirection = Vector3.zero; 63 | private bool m_Grounded = false; 64 | private CharacterController m_Controller; 65 | private Transform m_Transform; 66 | private float m_Speed; 67 | private RaycastHit m_Hit; 68 | private float m_FallStartLevel; 69 | private bool m_Falling; 70 | private float m_SlideLimit; 71 | private float m_RayDistance; 72 | private Vector3 m_ContactPoint; 73 | private bool m_PlayerControl = false; 74 | private int m_JumpTimer; 75 | 76 | 77 | private void Start() 78 | { 79 | // Saving component references to improve performance. 80 | m_Transform = GetComponent(); 81 | m_Controller = GetComponent(); 82 | 83 | // Setting initial values. 84 | m_Speed = m_WalkSpeed; 85 | m_RayDistance = m_Controller.height * .5f + m_Controller.radius; 86 | m_SlideLimit = m_Controller.slopeLimit - .1f; 87 | m_JumpTimer = m_AntiBunnyHopFactor; 88 | 89 | if(playerCamera == null) 90 | { 91 | playerCamera = Camera.main.gameObject.transform; 92 | } 93 | playerLook.Init(transform, playerCamera); 94 | } 95 | 96 | 97 | private void Update() 98 | { 99 | // If the run button is set to toggle, then switch between walk/run speed. (We use Update for this... 100 | // FixedUpdate is a poor place to use GetButtonDown, since it doesn't necessarily run every frame and can miss the event) 101 | if (m_ToggleRun && m_Grounded && Input.GetButtonDown("Run")) 102 | { 103 | m_Speed = (m_Speed == m_WalkSpeed ? m_RunSpeed : m_WalkSpeed); 104 | } 105 | 106 | playerLook.LookRotation(transform, playerCamera.transform); 107 | } 108 | 109 | 110 | private void FixedUpdate() 111 | { 112 | float inputX = Input.GetAxis("Horizontal"); 113 | float inputY = Input.GetAxis("Vertical"); 114 | 115 | // If both horizontal and vertical are used simultaneously, limit speed (if allowed), so the total doesn't exceed normal move speed 116 | float inputModifyFactor = (inputX != 0.0f && inputY != 0.0f && m_LimitDiagonalSpeed) ? .7071f : 1.0f; 117 | 118 | if (m_Grounded) 119 | { 120 | bool sliding = false; 121 | // See if surface immediately below should be slid down. We use this normally rather than a ControllerColliderHit point, 122 | // because that interferes with step climbing amongst other annoyances 123 | if (Physics.Raycast(m_Transform.position, -Vector3.up, out m_Hit, m_RayDistance)) 124 | { 125 | if (Vector3.Angle(m_Hit.normal, Vector3.up) > m_SlideLimit) 126 | { 127 | sliding = true; 128 | } 129 | } 130 | // However, just raycasting straight down from the center can fail when on steep slopes 131 | // So if the above raycast didn't catch anything, raycast down from the stored ControllerColliderHit point instead 132 | else 133 | { 134 | Physics.Raycast(m_ContactPoint + Vector3.up, -Vector3.up, out m_Hit); 135 | if (Vector3.Angle(m_Hit.normal, Vector3.up) > m_SlideLimit) 136 | { 137 | sliding = true; 138 | } 139 | } 140 | 141 | // If we were falling, and we fell a vertical distance greater than the threshold, run a falling damage routine 142 | if (m_Falling) 143 | { 144 | m_Falling = false; 145 | if (m_Transform.position.y < m_FallStartLevel - m_FallingThreshold) 146 | { 147 | OnFell(m_FallStartLevel - m_Transform.position.y); 148 | } 149 | } 150 | 151 | // If running isn't on a toggle, then use the appropriate speed depending on whether the run button is down 152 | if (!m_ToggleRun) 153 | { 154 | m_Speed = Input.GetKey(KeyCode.LeftShift) ? m_RunSpeed : m_WalkSpeed; 155 | } 156 | 157 | // If sliding (and it's allowed), or if we're on an object tagged "Slide", get a vector pointing down the slope we're on 158 | if ((sliding && m_SlideWhenOverSlopeLimit) || (m_SlideOnTaggedObjects && m_Hit.collider.tag == "Slide")) 159 | { 160 | Vector3 hitNormal = m_Hit.normal; 161 | m_MoveDirection = new Vector3(hitNormal.x, -hitNormal.y, hitNormal.z); 162 | Vector3.OrthoNormalize(ref hitNormal, ref m_MoveDirection); 163 | m_MoveDirection *= m_SlideSpeed; 164 | m_PlayerControl = false; 165 | } 166 | // Otherwise recalculate moveDirection directly from axes, adding a bit of -y to avoid bumping down inclines 167 | else 168 | { 169 | m_MoveDirection = new Vector3(inputX * inputModifyFactor, -m_AntiBumpFactor, inputY * inputModifyFactor); 170 | m_MoveDirection = m_Transform.TransformDirection(m_MoveDirection) * m_Speed; 171 | m_PlayerControl = true; 172 | } 173 | 174 | // Jump! But only if the jump button has been released and player has been grounded for a given number of frames 175 | if (!Input.GetButton("Jump")) 176 | { 177 | m_JumpTimer++; 178 | } 179 | else if (m_JumpTimer >= m_AntiBunnyHopFactor) 180 | { 181 | m_MoveDirection.y = m_JumpSpeed; 182 | m_JumpTimer = 0; 183 | } 184 | } 185 | else 186 | { 187 | // If we stepped over a cliff or something, set the height at which we started falling 188 | if (!m_Falling) 189 | { 190 | m_Falling = true; 191 | m_FallStartLevel = m_Transform.position.y; 192 | } 193 | 194 | // If air control is allowed, check movement but don't touch the y component 195 | if (m_AirControl && m_PlayerControl) 196 | { 197 | m_MoveDirection.x = inputX * m_Speed * inputModifyFactor; 198 | m_MoveDirection.z = inputY * m_Speed * inputModifyFactor; 199 | m_MoveDirection = m_Transform.TransformDirection(m_MoveDirection); 200 | } 201 | } 202 | 203 | // Apply gravity 204 | m_MoveDirection.y -= m_Gravity * Time.deltaTime; 205 | 206 | // Move the controller, and set grounded true or false depending on whether we're standing on something 207 | m_Grounded = (m_Controller.Move(m_MoveDirection * Time.deltaTime) & CollisionFlags.Below) != 0; 208 | 209 | } 210 | 211 | 212 | // Store point that we're in contact with for use in FixedUpdate if needed 213 | private void OnControllerColliderHit(ControllerColliderHit hit) 214 | { 215 | m_ContactPoint = hit.point; 216 | } 217 | 218 | 219 | // This is the place to apply things like fall damage. You can give the player hitpoints and remove some 220 | // of them based on the distance fallen, play sound effects, etc. 221 | private void OnFell(float fallDistance) 222 | { 223 | 224 | } 225 | } 226 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/LoadChunks.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | using Voxel; 4 | 5 | public class LoadChunks : MonoBehaviour 6 | { 7 | public World world; 8 | private int timer = 0; 9 | private List updateList = new List(); 10 | private List buildList = new List(); 11 | 12 | private static WorldPosition[] chunkPositions = 13 | { 14 | new WorldPosition( 0, 0, 0), new WorldPosition(-1, 0, 0), new WorldPosition( 0, 0, -1), new WorldPosition( 0, 0, 1), new WorldPosition( 1, 0, 0), 15 | new WorldPosition(-1, 0, -1), new WorldPosition(-1, 0, 1), new WorldPosition( 1, 0, -1), new WorldPosition( 1, 0, 1), new WorldPosition(-2, 0, 0), 16 | new WorldPosition( 0, 0, -2), new WorldPosition( 0, 0, 2), new WorldPosition( 2, 0, 0), new WorldPosition(-2, 0, -1), new WorldPosition(-2, 0, 1), 17 | new WorldPosition(-1, 0, -2), new WorldPosition(-1, 0, 2), new WorldPosition( 1, 0, -2), new WorldPosition( 1, 0, 2), new WorldPosition( 2, 0, -1), 18 | new WorldPosition( 2, 0, 1), new WorldPosition(-2, 0, -2), new WorldPosition(-2, 0, 2), new WorldPosition( 2, 0, -2), new WorldPosition( 2, 0, 2), 19 | new WorldPosition(-3, 0, 0), new WorldPosition( 0, 0, -3), new WorldPosition( 0, 0, 3), new WorldPosition( 3, 0, 0), new WorldPosition(-3, 0, -1), 20 | new WorldPosition(-3, 0, 1), new WorldPosition(-1, 0, -3), new WorldPosition(-1, 0, 3), new WorldPosition( 1, 0, -3), new WorldPosition( 1, 0, 3), 21 | new WorldPosition( 3, 0, -1), new WorldPosition( 3, 0, 1), new WorldPosition(-3, 0, -2), new WorldPosition(-3, 0, 2), new WorldPosition(-2, 0, -3), 22 | new WorldPosition(-2, 0, 3), new WorldPosition( 2, 0, -3), new WorldPosition( 2, 0, 3), new WorldPosition( 3, 0, -2), new WorldPosition( 3, 0, 2), 23 | new WorldPosition(-4, 0, 0), new WorldPosition( 0, 0, -4), new WorldPosition( 0, 0, 4), new WorldPosition( 4, 0, 0), new WorldPosition(-4, 0, -1), 24 | new WorldPosition(-4, 0, 1), new WorldPosition(-1, 0, -4), new WorldPosition(-1, 0, 4), new WorldPosition( 1, 0, -4), new WorldPosition( 1, 0, 4), 25 | new WorldPosition( 4, 0, -1), new WorldPosition( 4, 0, 1), new WorldPosition(-3, 0, -3), new WorldPosition(-3, 0, 3), new WorldPosition( 3, 0, -3), 26 | new WorldPosition( 3, 0, 3), new WorldPosition(-4, 0, -2), new WorldPosition(-4, 0, 2), new WorldPosition(-2, 0, -4), new WorldPosition(-2, 0, 4), 27 | new WorldPosition( 2, 0, -4), new WorldPosition( 2, 0, 4), new WorldPosition( 4, 0, -2), new WorldPosition( 4, 0, 2), new WorldPosition(-5, 0, 0), 28 | new WorldPosition(-4, 0, -3), new WorldPosition(-4, 0, 3), new WorldPosition(-3, 0, -4), new WorldPosition(-3, 0, 4), new WorldPosition( 0, 0, -5), 29 | new WorldPosition( 0, 0, 5), new WorldPosition( 3, 0, -4), new WorldPosition( 3, 0, 4), new WorldPosition( 4, 0, -3), new WorldPosition( 4, 0, 3), 30 | new WorldPosition( 5, 0, 0), new WorldPosition(-5, 0, -1), new WorldPosition(-5, 0, 1), new WorldPosition(-1, 0, -5), new WorldPosition(-1, 0, 5), 31 | new WorldPosition( 1, 0, -5), new WorldPosition( 1, 0, 5), new WorldPosition( 5, 0, -1), new WorldPosition( 5, 0, 1), new WorldPosition(-5, 0, -2), 32 | new WorldPosition(-5, 0, 2), new WorldPosition(-2, 0, -5), new WorldPosition(-2, 0, 5), new WorldPosition( 2, 0, -5), new WorldPosition( 2, 0, 5), 33 | new WorldPosition( 5, 0, -2), new WorldPosition( 5, 0, 2), new WorldPosition(-4, 0, -4), new WorldPosition(-4, 0, 4), new WorldPosition( 4, 0, -4), 34 | new WorldPosition( 4, 0, 4), new WorldPosition(-5, 0, -3), new WorldPosition(-5, 0, 3), new WorldPosition(-3, 0, -5), new WorldPosition(-3, 0, 5), 35 | new WorldPosition( 3, 0, -5), new WorldPosition( 3, 0, 5), new WorldPosition( 5, 0, -3), new WorldPosition( 5, 0, 3), new WorldPosition(-6, 0, 0), 36 | new WorldPosition( 0, 0, -6), new WorldPosition( 0, 0, 6), new WorldPosition( 6, 0, 0), new WorldPosition(-6, 0, -1), new WorldPosition(-6, 0, 1), 37 | new WorldPosition(-1, 0, -6), new WorldPosition(-1, 0, 6), new WorldPosition( 1, 0, -6), new WorldPosition( 1, 0, 6), new WorldPosition( 6, 0, -1), 38 | new WorldPosition( 6, 0, 1), new WorldPosition(-6, 0, -2), new WorldPosition(-6, 0, 2), new WorldPosition(-2, 0, -6), new WorldPosition(-2, 0, 6), 39 | new WorldPosition( 2, 0, -6), new WorldPosition( 2, 0, 6), new WorldPosition( 6, 0, -2), new WorldPosition( 6, 0, 2), new WorldPosition(-5, 0, -4), 40 | new WorldPosition(-5, 0, 4), new WorldPosition(-4, 0, -5), new WorldPosition(-4, 0, 5), new WorldPosition( 4, 0, -5), new WorldPosition( 4, 0, 5), 41 | new WorldPosition( 5, 0, -4), new WorldPosition( 5, 0, 4), new WorldPosition(-6, 0, -3), new WorldPosition(-6, 0, 3), new WorldPosition(-3, 0, -6), 42 | new WorldPosition(-3, 0, 6), new WorldPosition( 3, 0, -6), new WorldPosition( 3, 0, 6), new WorldPosition( 6, 0, -3), new WorldPosition( 6, 0, 3), 43 | new WorldPosition(-7, 0, 0), new WorldPosition( 0, 0, -7), new WorldPosition( 0, 0, 7), new WorldPosition( 7, 0, 0), new WorldPosition(-7, 0, -1), 44 | new WorldPosition(-7, 0, 1), new WorldPosition(-5, 0, -5), new WorldPosition(-5, 0, 5), new WorldPosition(-1, 0, -7), new WorldPosition(-1, 0, 7), 45 | new WorldPosition( 1, 0, -7), new WorldPosition( 1, 0, 7), new WorldPosition( 5, 0, -5), new WorldPosition( 5, 0, 5), new WorldPosition( 7, 0, -1), 46 | new WorldPosition( 7, 0, 1), new WorldPosition(-6, 0, -4), new WorldPosition(-6, 0, 4), new WorldPosition(-4, 0, -6), new WorldPosition(-4, 0, 6), 47 | new WorldPosition( 4, 0, -6), new WorldPosition( 4, 0, 6), new WorldPosition( 6, 0, -4), new WorldPosition( 6, 0, 4), new WorldPosition(-7, 0, -2), 48 | new WorldPosition(-7, 0, 2), new WorldPosition(-2, 0, -7), new WorldPosition(-2, 0, 7), new WorldPosition( 2, 0, -7), new WorldPosition( 2, 0, 7), 49 | new WorldPosition( 7, 0, -2), new WorldPosition( 7, 0, 2), new WorldPosition(-7, 0, -3), new WorldPosition(-7, 0, 3), new WorldPosition(-3, 0, -7), 50 | new WorldPosition(-3, 0, 7), new WorldPosition( 3, 0, -7), new WorldPosition( 3, 0, 7), new WorldPosition( 7, 0, -3), new WorldPosition( 7, 0, 3), 51 | new WorldPosition(-6, 0, -5), new WorldPosition(-6, 0, 5), new WorldPosition(-5, 0, -6), new WorldPosition(-5, 0, 6), new WorldPosition( 5, 0, -6), 52 | new WorldPosition( 5, 0, 6), new WorldPosition( 6, 0, -5), new WorldPosition( 6, 0, 5) 53 | }; 54 | 55 | private void Update() 56 | { 57 | if (DeleteChunks()) 58 | return; 59 | 60 | FindChunksToLoad(); 61 | LoadAndRenderChunks(); 62 | } 63 | 64 | private void FindChunksToLoad() 65 | { 66 | WorldPosition playerPos = new WorldPosition( 67 | Mathf.FloorToInt(transform.position.x / Chunk.chunkSize) * Chunk.chunkSize, 68 | Mathf.FloorToInt(transform.position.y / Chunk.chunkSize) * Chunk.chunkSize, 69 | Mathf.FloorToInt(transform.position.z / Chunk.chunkSize) * Chunk.chunkSize 70 | ); 71 | 72 | if (updateList.Count == 0) 73 | { 74 | for (int i = 0; i < chunkPositions.Length; i++) 75 | { 76 | WorldPosition newChunkPos = new WorldPosition(chunkPositions[i].x * Chunk.chunkSize + playerPos.x, 0, chunkPositions[i].z * Chunk.chunkSize + playerPos.z); 77 | Chunk newChunk = world.GetChunk(newChunkPos.x, newChunkPos.y, newChunkPos.z); 78 | if (newChunk != null 79 | && (newChunk.rendered || updateList.Contains(newChunkPos))) 80 | continue; 81 | 82 | for (int y = -8; y < 8; y++) 83 | { 84 | for (int x = newChunkPos.x - Chunk.chunkSize; x <= newChunkPos.x + Chunk.chunkSize; x += Chunk.chunkSize) 85 | { 86 | for (int z = newChunkPos.z - Chunk.chunkSize; z <= newChunkPos.z + Chunk.chunkSize; z += Chunk.chunkSize) 87 | { 88 | buildList.Add(new WorldPosition(x, y * Chunk.chunkSize, z)); 89 | } 90 | } 91 | updateList.Add(new WorldPosition(newChunkPos.x, y * Chunk.chunkSize, newChunkPos.z)); 92 | } 93 | return; 94 | } 95 | } 96 | } 97 | 98 | private void BuildChunk(WorldPosition pos) 99 | { 100 | if (world.GetChunk(pos.x, pos.y, pos.z) == null) 101 | world.CreateChunk(pos.x, pos.y, pos.z); 102 | } 103 | 104 | private bool DeleteChunks() 105 | { 106 | if (timer == 10) 107 | { 108 | var chunksToDelete = new List(); 109 | foreach (var chunk in world.chunks) 110 | { 111 | float distance = Vector3.Distance( 112 | new Vector3(chunk.Value.position.x, 0, chunk.Value.position.z), 113 | new Vector3(transform.position.x, 0, transform.position.z)); 114 | if (distance > 256) 115 | chunksToDelete.Add(chunk.Key); 116 | } 117 | foreach (var chunk in chunksToDelete) 118 | world.DestroyChunk(chunk.x, chunk.y, chunk.z); 119 | timer = 0; 120 | return true; 121 | } 122 | timer++; 123 | return false; 124 | } 125 | 126 | private void LoadAndRenderChunks() 127 | { 128 | if (buildList.Count != 0) 129 | { 130 | for (int i = 0; i < buildList.Count && i < 8; i++) 131 | { 132 | BuildChunk(buildList[0]); 133 | buildList.RemoveAt(0); 134 | } 135 | return; 136 | } 137 | if (updateList.Count != 0) 138 | { 139 | Chunk chunk = world.GetChunk(updateList[0].x, updateList[0].y, updateList[0].z); 140 | if (chunk != null) 141 | chunk.update = true; 142 | updateList.RemoveAt(0); 143 | } 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Noise/SimplexNoise.cs: -------------------------------------------------------------------------------- 1 | // SimplexNoise for C# 2 | // Author: Heikki Törmälä 3 | 4 | //This is free and unencumbered software released into the public domain. 5 | 6 | //Anyone is free to copy, modify, publish, use, compile, sell, or 7 | //distribute this software, either in source code form or as a compiled 8 | //binary, for any purpose, commercial or non-commercial, and by any 9 | //means. 10 | 11 | //In jurisdictions that recognize copyright laws, the author or authors 12 | //of this software dedicate any and all copyright interest in the 13 | //software to the public domain. We make this dedication for the benefit 14 | //of the public at large and to the detriment of our heirs and 15 | //successors. We intend this dedication to be an overt act of 16 | //relinquishment in perpetuity of all present and future rights to this 17 | //software under copyright law. 18 | 19 | //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | //EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 21 | //MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 22 | //IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 23 | //OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 24 | //ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | //OTHER DEALINGS IN THE SOFTWARE. 26 | 27 | //For more information, please refer to 28 | 29 | 30 | namespace Noise 31 | { 32 | /// 33 | /// Implementation of the Perlin simplex noise, an improved Perlin noise algorithm. 34 | /// Based loosely on SimplexNoise1234 by Stefan Gustavson 35 | /// 36 | /// 37 | public class SimplexNoise 38 | { 39 | /// 40 | /// 1D simplex noise 41 | /// 42 | /// 43 | /// 44 | public static float Generate(float x) 45 | { 46 | int i0 = FastFloor(x); 47 | int i1 = i0 + 1; 48 | float x0 = x - i0; 49 | float x1 = x0 - 1.0f; 50 | 51 | float n0, n1; 52 | 53 | float t0 = 1.0f - x0*x0; 54 | t0 *= t0; 55 | n0 = t0 * t0 * grad(perm[i0 & 0xff], x0); 56 | 57 | float t1 = 1.0f - x1*x1; 58 | t1 *= t1; 59 | n1 = t1 * t1 * grad(perm[i1 & 0xff], x1); 60 | // The maximum value of this noise is 8*(3/4)^4 = 2.53125 61 | // A factor of 0.395 scales to fit exactly within [-1,1] 62 | return 0.395f * (n0 + n1); 63 | } 64 | 65 | /// 66 | /// 2D simplex noise 67 | /// 68 | /// 69 | /// 70 | /// 71 | public static float Generate(float x, float y) 72 | { 73 | const float F2 = 0.366025403f; // F2 = 0.5*(sqrt(3.0)-1.0) 74 | const float G2 = 0.211324865f; // G2 = (3.0-Math.sqrt(3.0))/6.0 75 | 76 | float n0, n1, n2; // Noise contributions from the three corners 77 | 78 | // Skew the input space to determine which simplex cell we're in 79 | float s = (x+y)*F2; // Hairy factor for 2D 80 | float xs = x + s; 81 | float ys = y + s; 82 | int i = FastFloor(xs); 83 | int j = FastFloor(ys); 84 | 85 | float t = (float)(i+j)*G2; 86 | float X0 = i-t; // Unskew the cell origin back to (x,y) space 87 | float Y0 = j-t; 88 | float x0 = x-X0; // The x,y distances from the cell origin 89 | float y0 = y-Y0; 90 | 91 | // For the 2D case, the simplex shape is an equilateral triangle. 92 | // Determine which simplex we are in. 93 | int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords 94 | if(x0>y0) {i1=1; j1=0;} // lower triangle, XY order: (0,0)->(1,0)->(1,1) 95 | else {i1=0; j1=1;} // upper triangle, YX order: (0,0)->(0,1)->(1,1) 96 | 97 | // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and 98 | // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where 99 | // c = (3-sqrt(3))/6 100 | 101 | float x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords 102 | float y1 = y0 - j1 + G2; 103 | float x2 = x0 - 1.0f + 2.0f * G2; // Offsets for last corner in (x,y) unskewed coords 104 | float y2 = y0 - 1.0f + 2.0f * G2; 105 | 106 | // Wrap the integer indices at 256, to avoid indexing perm[] out of bounds 107 | int ii = i % 256; 108 | int jj = j % 256; 109 | 110 | // Calculate the contribution from the three corners 111 | float t0 = 0.5f - x0*x0-y0*y0; 112 | if(t0 < 0.0f) n0 = 0.0f; 113 | else { 114 | t0 *= t0; 115 | n0 = t0 * t0 * grad(perm[ii+perm[jj]], x0, y0); 116 | } 117 | 118 | float t1 = 0.5f - x1*x1-y1*y1; 119 | if(t1 < 0.0f) n1 = 0.0f; 120 | else { 121 | t1 *= t1; 122 | n1 = t1 * t1 * grad(perm[ii+i1+perm[jj+j1]], x1, y1); 123 | } 124 | 125 | float t2 = 0.5f - x2*x2-y2*y2; 126 | if(t2 < 0.0f) n2 = 0.0f; 127 | else { 128 | t2 *= t2; 129 | n2 = t2 * t2 * grad(perm[ii+1+perm[jj+1]], x2, y2); 130 | } 131 | 132 | // Add contributions from each corner to get the final noise value. 133 | // The result is scaled to return values in the interval [-1,1]. 134 | return 40.0f * (n0 + n1 + n2); // TODO: The scale factor is preliminary! 135 | } 136 | 137 | 138 | public static float Generate(float x, float y, float z) 139 | { 140 | // Simple skewing factors for the 3D case 141 | const float F3 = 0.333333333f; 142 | const float G3 = 0.166666667f; 143 | 144 | float n0, n1, n2, n3; // Noise contributions from the four corners 145 | 146 | // Skew the input space to determine which simplex cell we're in 147 | float s = (x+y+z)*F3; // Very nice and simple skew factor for 3D 148 | float xs = x+s; 149 | float ys = y+s; 150 | float zs = z+s; 151 | int i = FastFloor(xs); 152 | int j = FastFloor(ys); 153 | int k = FastFloor(zs); 154 | 155 | float t = (float)(i+j+k)*G3; 156 | float X0 = i-t; // Unskew the cell origin back to (x,y,z) space 157 | float Y0 = j-t; 158 | float Z0 = k-t; 159 | float x0 = x-X0; // The x,y,z distances from the cell origin 160 | float y0 = y-Y0; 161 | float z0 = z-Z0; 162 | 163 | // For the 3D case, the simplex shape is a slightly irregular tetrahedron. 164 | // Determine which simplex we are in. 165 | int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords 166 | int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords 167 | 168 | /* This code would benefit from a backport from the GLSL version! */ 169 | if(x0>=y0) { 170 | if(y0>=z0) 171 | { i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } // X Y Z order 172 | else if(x0>=z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } // X Z Y order 173 | else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } // Z X Y order 174 | } 175 | else { // x0 0) ? ((int)x) : (((int)x) - 1); 266 | } 267 | 268 | private static int Mod(int x, int m) 269 | { 270 | int a = x % m; 271 | return a < 0 ? a + m : a; 272 | } 273 | 274 | private static float grad( int hash, float x ) 275 | { 276 | int h = hash & 15; 277 | float grad = 1.0f + (h & 7); // Gradient value 1.0, 2.0, ..., 8.0 278 | if ((h & 8) != 0) grad = -grad; // Set a random sign for the gradient 279 | return ( grad * x ); // Multiply the gradient with the distance 280 | } 281 | 282 | private static float grad( int hash, float x, float y ) 283 | { 284 | int h = hash & 7; // Convert low 3 bits of hash code 285 | float u = h<4 ? x : y; // into 8 simple gradient directions, 286 | float v = h<4 ? y : x; // and compute the dot product with (x,y). 287 | return ((h&1) != 0 ? -u : u) + ((h&2) != 0 ? -2.0f*v : 2.0f*v); 288 | } 289 | 290 | private static float grad( int hash, float x, float y , float z ) { 291 | int h = hash & 15; // Convert low 4 bits of hash code into 12 simple 292 | float u = h<8 ? x : y; // gradient directions, and compute dot product. 293 | float v = h<4 ? y : h==12||h==14 ? x : z; // Fix repeats at h = 12 to 15 294 | return ((h&1) != 0 ? -u : u) + ((h&2) != 0 ? -v : v); 295 | } 296 | 297 | private static float grad( int hash, float x, float y, float z, float t ) { 298 | int h = hash & 31; // Convert low 5 bits of hash code into 32 simple 299 | float u = h<24 ? x : y; // gradient directions, and compute dot product. 300 | float v = h<16 ? y : z; 301 | float w = h<8 ? z : t; 302 | return ((h&1) != 0 ? -u : u) + ((h&2) != 0 ? -v : v) + ((h&4) != 0 ? -w : w); 303 | } 304 | } 305 | } 306 | -------------------------------------------------------------------------------- /Voxel/Assets/Core/Voxel/Block.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using System; 3 | using System.Threading; 4 | 5 | namespace Voxel.Blocks 6 | { 7 | public enum Direction { North, East, South, West, Up, Down } 8 | 9 | [Serializable] 10 | public class Block 11 | { 12 | private const float tileSize = 0.25f; 13 | private Color ssaoColor = Color.gray; 14 | public bool changed = true; 15 | 16 | public Block() 17 | { 18 | if (DeveloperScreen.DebugSSAO) 19 | ssaoColor = Color.blue; 20 | } 21 | 22 | public virtual bool IsSolid(Direction direction) 23 | { 24 | switch (direction) 25 | { 26 | case Direction.North: 27 | return true; 28 | case Direction.East: 29 | return true; 30 | case Direction.South: 31 | return true; 32 | case Direction.West: 33 | return true; 34 | case Direction.Up: 35 | return true; 36 | case Direction.Down: 37 | return true; 38 | } 39 | return false; 40 | } 41 | 42 | #region UV 43 | 44 | public virtual Tile TexturePosition(Direction direction) 45 | { 46 | Tile tile = new Tile(); 47 | tile.x = 0; 48 | tile.y = 0; 49 | return tile; 50 | } 51 | 52 | public virtual Vector2[] FaceUVs(Direction direction) 53 | { 54 | Vector2[] UVs = new Vector2[4]; 55 | Tile tilePos = TexturePosition(direction); 56 | UVs[0] = new Vector2(tileSize * tilePos.x + tileSize, tileSize * tilePos.y); 57 | UVs[1] = new Vector2(tileSize * tilePos.x + tileSize, tileSize * tilePos.y + tileSize); 58 | UVs[2] = new Vector2(tileSize * tilePos.x, tileSize * tilePos.y + tileSize); 59 | UVs[3] = new Vector2(tileSize * tilePos.x, tileSize * tilePos.y); 60 | 61 | return UVs; 62 | } 63 | 64 | #endregion 65 | 66 | public virtual MeshData BlockData(Chunk chunk, int x, int y, int z, MeshData meshData) 67 | { 68 | if (!chunk.GetBlock(x, y + 1, z).IsSolid(Direction.Down)) 69 | { 70 | meshData = FaceDataUp(chunk, x, y, z, meshData); 71 | CheckSSAO(chunk, meshData, x, y, z, Direction.Up); 72 | } 73 | 74 | if (!chunk.GetBlock(x, y - 1, z).IsSolid(Direction.Up)) 75 | { 76 | meshData = FaceDataDown(chunk, x, y, z, meshData); 77 | CheckSSAO(chunk, meshData, x, y, z, Direction.Down); 78 | } 79 | 80 | if (!chunk.GetBlock(x, y, z + 1).IsSolid(Direction.South)) 81 | { 82 | meshData = FaceDataNorth(chunk, x, y, z, meshData); 83 | CheckSSAO(chunk, meshData, x, y, z, Direction.North); 84 | } 85 | 86 | if (!chunk.GetBlock(x, y, z - 1).IsSolid(Direction.North)) 87 | { 88 | meshData = FaceDataSouth(chunk, x, y, z, meshData); 89 | CheckSSAO(chunk, meshData, x, y, z, Direction.South); 90 | } 91 | 92 | if (!chunk.GetBlock(x + 1, y, z).IsSolid(Direction.West)) 93 | { 94 | meshData = FaceDataEast(chunk, x, y, z, meshData); 95 | CheckSSAO(chunk, meshData, x, y, z, Direction.East); 96 | } 97 | 98 | if (!chunk.GetBlock(x - 1, y, z).IsSolid(Direction.East)) 99 | { 100 | meshData = FaceDataWest(chunk, x, y, z, meshData); 101 | CheckSSAO(chunk, meshData, x, y, z, Direction.West); 102 | } 103 | 104 | meshData.useRenderDataForCollider = true; 105 | return meshData; 106 | } 107 | 108 | #region BlockMesh 109 | 110 | protected virtual MeshData FaceDataUp(Chunk chunk, int x, int y, int z, MeshData meshData) 111 | { 112 | meshData.AddVertex(new Vector3(x - 0.5f, y + 0.5f, z + 0.5f)); 113 | meshData.AddVertex(new Vector3(x + 0.5f, y + 0.5f, z + 0.5f)); 114 | meshData.AddVertex(new Vector3(x + 0.5f, y + 0.5f, z - 0.5f)); 115 | meshData.AddVertex(new Vector3(x - 0.5f, y + 0.5f, z - 0.5f)); 116 | meshData.uv.AddRange(FaceUVs(Direction.Up)); 117 | 118 | meshData.AddQuadTriangles(); 119 | return meshData; 120 | } 121 | 122 | protected virtual MeshData FaceDataDown(Chunk chunk, int x, int y, int z, MeshData meshData) 123 | { 124 | meshData.AddVertex(new Vector3(x - 0.5f, y - 0.5f, z - 0.5f)); 125 | meshData.AddVertex(new Vector3(x + 0.5f, y - 0.5f, z - 0.5f)); 126 | meshData.AddVertex(new Vector3(x + 0.5f, y - 0.5f, z + 0.5f)); 127 | meshData.AddVertex(new Vector3(x - 0.5f, y - 0.5f, z + 0.5f)); 128 | meshData.uv.AddRange(FaceUVs(Direction.Down)); 129 | 130 | meshData.AddQuadTriangles(); 131 | return meshData; 132 | } 133 | 134 | protected virtual MeshData FaceDataNorth(Chunk chunk, int x, int y, int z, MeshData meshData) 135 | { 136 | meshData.AddVertex(new Vector3(x + 0.5f, y - 0.5f, z + 0.5f)); 137 | meshData.AddVertex(new Vector3(x + 0.5f, y + 0.5f, z + 0.5f)); 138 | meshData.AddVertex(new Vector3(x - 0.5f, y + 0.5f, z + 0.5f)); 139 | meshData.AddVertex(new Vector3(x - 0.5f, y - 0.5f, z + 0.5f)); 140 | meshData.uv.AddRange(FaceUVs(Direction.North)); 141 | 142 | meshData.AddQuadTriangles(); 143 | return meshData; 144 | } 145 | 146 | protected virtual MeshData FaceDataEast(Chunk chunk, int x, int y, int z, MeshData meshData) 147 | { 148 | meshData.AddVertex(new Vector3(x + 0.5f, y - 0.5f, z - 0.5f)); 149 | meshData.AddVertex(new Vector3(x + 0.5f, y + 0.5f, z - 0.5f)); 150 | meshData.AddVertex(new Vector3(x + 0.5f, y + 0.5f, z + 0.5f)); 151 | meshData.AddVertex(new Vector3(x + 0.5f, y - 0.5f, z + 0.5f)); 152 | meshData.uv.AddRange(FaceUVs(Direction.East)); 153 | 154 | meshData.AddQuadTriangles(); 155 | return meshData; 156 | } 157 | 158 | protected virtual MeshData FaceDataSouth(Chunk chunk, int x, int y, int z, MeshData meshData) 159 | { 160 | meshData.AddVertex(new Vector3(x - 0.5f, y - 0.5f, z - 0.5f)); 161 | meshData.AddVertex(new Vector3(x - 0.5f, y + 0.5f, z - 0.5f)); 162 | meshData.AddVertex(new Vector3(x + 0.5f, y + 0.5f, z - 0.5f)); 163 | meshData.AddVertex(new Vector3(x + 0.5f, y - 0.5f, z - 0.5f)); 164 | meshData.uv.AddRange(FaceUVs(Direction.South)); 165 | 166 | meshData.AddQuadTriangles(); 167 | return meshData; 168 | } 169 | 170 | protected virtual MeshData FaceDataWest(Chunk chunk, int x, int y, int z, MeshData meshData) 171 | { 172 | meshData.AddVertex(new Vector3(x - 0.5f, y - 0.5f, z + 0.5f)); 173 | meshData.AddVertex(new Vector3(x - 0.5f, y + 0.5f, z + 0.5f)); 174 | meshData.AddVertex(new Vector3(x - 0.5f, y + 0.5f, z - 0.5f)); 175 | meshData.AddVertex(new Vector3(x - 0.5f, y - 0.5f, z - 0.5f)); 176 | meshData.uv.AddRange(FaceUVs(Direction.West)); 177 | 178 | meshData.AddQuadTriangles(); 179 | return meshData; 180 | } 181 | 182 | #endregion 183 | 184 | private void AddSSAO(MeshData meshData, bool ssaoSouth, bool ssaoNorth, bool ssaoWest, bool ssaoEast, bool ssaoNorthWest, bool ssaoNorthEast, bool ssaoSouthWest, bool ssaoSouthEast) 185 | { 186 | if (ssaoEast || ssaoSouth || ssaoSouthWest) 187 | meshData.AddColor(ssaoColor); 188 | else 189 | meshData.AddColor(Color.white); 190 | 191 | if (ssaoSouth || ssaoWest || ssaoSouthEast) 192 | meshData.AddColor(ssaoColor); 193 | else 194 | meshData.AddColor(Color.white); 195 | 196 | if (ssaoNorth || ssaoWest || ssaoNorthEast) 197 | meshData.AddColor(ssaoColor); 198 | else 199 | meshData.AddColor(Color.white); 200 | 201 | if (ssaoNorth || ssaoEast || ssaoNorthWest) 202 | meshData.AddColor(ssaoColor); 203 | else 204 | meshData.AddColor(Color.white); 205 | } 206 | 207 | private void CheckSSAO(Chunk chunk, MeshData meshData, int x, int y, int z, Direction direction) 208 | { 209 | bool ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast; 210 | 211 | switch (direction) 212 | { 213 | case Direction.Up: 214 | 215 | if (chunk.GetBlock(x, y + 1, z + 1).IsSolid(Direction.South)) 216 | ssaoSouth = true; 217 | else ssaoSouth = false; 218 | 219 | if (chunk.GetBlock(x, y + 1, z - 1).IsSolid(Direction.North)) 220 | ssaoNorth = true; 221 | else ssaoNorth = false; 222 | 223 | if (chunk.GetBlock(x + 1, y + 1, z).IsSolid(Direction.West)) 224 | ssaoWest = true; 225 | else ssaoWest = false; 226 | 227 | if (chunk.GetBlock(x - 1, y + 1, z).IsSolid(Direction.East)) 228 | ssaoEast = true; 229 | else ssaoEast = false; 230 | 231 | if (chunk.GetBlock(x - 1, y + 1, z + 1).IsSolid(Direction.North) || chunk.GetBlock(x - 1, y + 1, z + 1).IsSolid(Direction.East)) 232 | ssaoSouthWest = true; 233 | else ssaoSouthWest = false; 234 | 235 | if (chunk.GetBlock(x + 1, y + 1, z + 1).IsSolid(Direction.North) || chunk.GetBlock(x + 1, y + 1, z + 1).IsSolid(Direction.West)) 236 | ssaoSouthEast = true; 237 | else ssaoSouthEast = false; 238 | 239 | if (chunk.GetBlock(x - 1, y + 1, z - 1).IsSolid(Direction.South) || chunk.GetBlock(x - 1, y + 1, z - 1).IsSolid(Direction.East)) 240 | ssaoNorthWest = true; 241 | else ssaoNorthWest = false; 242 | 243 | if (chunk.GetBlock(x + 1, y + 1, z - 1).IsSolid(Direction.South) || chunk.GetBlock(x + 1, y + 1, z - 1).IsSolid(Direction.West)) 244 | ssaoNorthEast = true; 245 | else ssaoNorthEast = false; 246 | 247 | AddSSAO(meshData, ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast); 248 | return; 249 | 250 | case Direction.Down: 251 | if (chunk.GetBlock(x, y - 1, z - 1).IsSolid(Direction.South)) 252 | ssaoSouth = true; 253 | else ssaoSouth = false; 254 | 255 | if (chunk.GetBlock(x, y - 1, z + 1).IsSolid(Direction.North)) 256 | ssaoNorth = true; 257 | else ssaoNorth = false; 258 | 259 | if (chunk.GetBlock(x + 1, y - 1, z).IsSolid(Direction.West)) 260 | ssaoWest = true; 261 | else ssaoWest = false; 262 | 263 | if (chunk.GetBlock(x - 1, y - 1, z).IsSolid(Direction.East)) 264 | ssaoEast = true; 265 | else ssaoEast = false; 266 | 267 | if (chunk.GetBlock(x - 1, y - 1, z - 1).IsSolid(Direction.North) || chunk.GetBlock(x - 1, y - 1, z - 1).IsSolid(Direction.East)) 268 | ssaoSouthWest = true; 269 | else ssaoSouthWest = false; 270 | 271 | if (chunk.GetBlock(x + 1, y - 1, z - 1).IsSolid(Direction.North) || chunk.GetBlock(x + 1, y - 1, z - 1).IsSolid(Direction.West)) 272 | ssaoSouthEast = true; 273 | else ssaoSouthEast = false; 274 | 275 | if (chunk.GetBlock(x - 1, y - 1, z + 1).IsSolid(Direction.South) || chunk.GetBlock(x - 1, y - 1, z + 1).IsSolid(Direction.East)) 276 | ssaoNorthWest = true; 277 | else ssaoNorthWest = false; 278 | 279 | if (chunk.GetBlock(x + 1, y - 1, z + 1).IsSolid(Direction.South) || chunk.GetBlock(x + 1, y - 1, z + 1).IsSolid(Direction.West)) 280 | ssaoNorthEast = true; 281 | else ssaoNorthEast = false; 282 | 283 | AddSSAO(meshData, ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast); 284 | return; 285 | 286 | case Direction.North: 287 | if (chunk.GetBlock(x + 1, y, z + 1).IsSolid(Direction.South)) 288 | ssaoSouth = true; 289 | else ssaoSouth = false; 290 | 291 | if (chunk.GetBlock(x - 1, y, z + 1).IsSolid(Direction.North)) 292 | ssaoNorth = true; 293 | else ssaoNorth = false; 294 | 295 | if (chunk.GetBlock(x, y + 1, z + 1).IsSolid(Direction.West)) 296 | ssaoWest = true; 297 | else ssaoWest = false; 298 | 299 | if (chunk.GetBlock(x, y - 1, z + 1).IsSolid(Direction.East)) 300 | ssaoEast = true; 301 | else ssaoEast = false; 302 | 303 | if (chunk.GetBlock(x + 1, y - 1, z + 1).IsSolid(Direction.North) || chunk.GetBlock(x + 1, y - 1, z + 1).IsSolid(Direction.East)) 304 | ssaoSouthWest = true; 305 | else ssaoSouthWest = false; 306 | 307 | if (chunk.GetBlock(x + 1, y + 1, z + 1).IsSolid(Direction.North) || chunk.GetBlock(x + 1, y + 1, z + 1).IsSolid(Direction.West)) 308 | ssaoSouthEast = true; 309 | else ssaoSouthEast = false; 310 | 311 | if (chunk.GetBlock(x - 1, y - 1, z + 1).IsSolid(Direction.South) || chunk.GetBlock(x - 1, y - 1, z + 1).IsSolid(Direction.East)) 312 | ssaoNorthWest = true; 313 | else ssaoNorthWest = false; 314 | 315 | if (chunk.GetBlock(x - 1, y + 1, z + 1).IsSolid(Direction.South) || chunk.GetBlock(x - 1, y + 1, z + 1).IsSolid(Direction.West)) 316 | ssaoNorthEast = true; 317 | else ssaoNorthEast = false; 318 | 319 | AddSSAO(meshData, ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast); 320 | return; 321 | 322 | case Direction.South: 323 | if (chunk.GetBlock(x - 1, y, z - 1).IsSolid(Direction.South)) 324 | ssaoSouth = true; 325 | else ssaoSouth = false; 326 | 327 | if (chunk.GetBlock(x + 1, y, z - 1).IsSolid(Direction.North)) 328 | ssaoNorth = true; 329 | else ssaoNorth = false; 330 | 331 | if (chunk.GetBlock(x, y + 1, z - 1).IsSolid(Direction.West)) 332 | ssaoWest = true; 333 | else ssaoWest = false; 334 | 335 | if (chunk.GetBlock(x, y - 1, z - 1).IsSolid(Direction.East)) 336 | ssaoEast = true; 337 | else ssaoEast = false; 338 | 339 | if (chunk.GetBlock(x - 1, y - 1, z - 1).IsSolid(Direction.North) || chunk.GetBlock(x - 1, y - 1, z - 1).IsSolid(Direction.East)) 340 | ssaoSouthWest = true; 341 | else ssaoSouthWest = false; 342 | 343 | if (chunk.GetBlock(x - 1, y + 1, z - 1).IsSolid(Direction.North) || chunk.GetBlock(x - 1, y + 1, z - 1).IsSolid(Direction.West)) 344 | ssaoSouthEast = true; 345 | else ssaoSouthEast = false; 346 | 347 | if (chunk.GetBlock(x + 1, y - 1, z - 1).IsSolid(Direction.South) || chunk.GetBlock(x + 1, y - 1, z - 1).IsSolid(Direction.East)) 348 | ssaoNorthWest = true; 349 | else ssaoNorthWest = false; 350 | 351 | if (chunk.GetBlock(x + 1, y + 1, z - 1).IsSolid(Direction.South) || chunk.GetBlock(x + 1, y + 1, z - 1).IsSolid(Direction.West)) 352 | ssaoNorthEast = true; 353 | else ssaoNorthEast = false; 354 | 355 | AddSSAO(meshData, ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast); 356 | return; 357 | 358 | case Direction.East: 359 | if (chunk.GetBlock(x + 1, y, z - 1).IsSolid(Direction.South)) 360 | ssaoSouth = true; 361 | else ssaoSouth = false; 362 | 363 | if (chunk.GetBlock(x + 1, y, z + 1).IsSolid(Direction.North)) 364 | ssaoNorth = true; 365 | else ssaoNorth = false; 366 | 367 | if (chunk.GetBlock(x + 1, y + 1, z).IsSolid(Direction.West)) 368 | ssaoWest = true; 369 | else ssaoWest = false; 370 | 371 | if (chunk.GetBlock(x + 1, y - 1, z).IsSolid(Direction.East)) 372 | ssaoEast = true; 373 | else ssaoEast = false; 374 | 375 | if (chunk.GetBlock(x + 1, y - 1, z - 1).IsSolid(Direction.North) || chunk.GetBlock(x + 1, y - 1, z - 1).IsSolid(Direction.East)) 376 | ssaoSouthWest = true; 377 | else ssaoSouthWest = false; 378 | 379 | if (chunk.GetBlock(x + 1, y + 1, z - 1).IsSolid(Direction.North) || chunk.GetBlock(x + 1, y + 1, z - 1).IsSolid(Direction.West)) 380 | ssaoSouthEast = true; 381 | else ssaoSouthEast = false; 382 | 383 | if (chunk.GetBlock(x + 1, y - 1, z + 1).IsSolid(Direction.South) || chunk.GetBlock(x + 1, y - 1, z + 1).IsSolid(Direction.East)) 384 | ssaoNorthWest = true; 385 | else ssaoNorthWest = false; 386 | 387 | if (chunk.GetBlock(x + 1, y + 1, z + 1).IsSolid(Direction.South) || chunk.GetBlock(x + 1, y + 1, z + 1).IsSolid(Direction.West)) 388 | ssaoNorthEast = true; 389 | else ssaoNorthEast = false; 390 | 391 | AddSSAO(meshData, ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast); 392 | return; 393 | 394 | case Direction.West: 395 | if (chunk.GetBlock(x - 1, y, z + 1).IsSolid(Direction.South)) 396 | ssaoSouth = true; 397 | else ssaoSouth = false; 398 | 399 | if (chunk.GetBlock(x - 1, y, z - 1).IsSolid(Direction.North)) 400 | ssaoNorth = true; 401 | else ssaoNorth = false; 402 | 403 | if (chunk.GetBlock(x - 1, y + 1, z).IsSolid(Direction.West)) 404 | ssaoWest = true; 405 | else ssaoWest = false; 406 | 407 | if (chunk.GetBlock(x - 1, y - 1, z).IsSolid(Direction.East)) 408 | ssaoEast = true; 409 | else ssaoEast = false; 410 | 411 | if (chunk.GetBlock(x - 1, y - 1, z + 1).IsSolid(Direction.North) || chunk.GetBlock(x - 1, y - 1, z + 1).IsSolid(Direction.East)) 412 | ssaoSouthWest = true; 413 | else ssaoSouthWest = false; 414 | 415 | if (chunk.GetBlock(x - 1, y + 1, z + 1).IsSolid(Direction.North) || chunk.GetBlock(x - 1, y + 1, z + 1).IsSolid(Direction.West)) 416 | ssaoSouthEast = true; 417 | else ssaoSouthEast = false; 418 | 419 | if (chunk.GetBlock(x - 1, y - 1, z - 1).IsSolid(Direction.South) || chunk.GetBlock(x - 1, y - 1, z - 1).IsSolid(Direction.East)) 420 | ssaoNorthWest = true; 421 | else ssaoNorthWest = false; 422 | 423 | if (chunk.GetBlock(x - 1, y + 1, z - 1).IsSolid(Direction.South) || chunk.GetBlock(x - 1, y + 1, z - 1).IsSolid(Direction.West)) 424 | ssaoNorthEast = true; 425 | else ssaoNorthEast = false; 426 | 427 | AddSSAO(meshData, ssaoSouth, ssaoNorth, ssaoWest, ssaoEast, ssaoNorthWest, ssaoNorthEast, ssaoSouthWest, ssaoSouthEast); 428 | return; 429 | } 430 | } 431 | 432 | } 433 | 434 | public struct Tile 435 | { 436 | public int x; 437 | public int y; 438 | } 439 | } 440 | -------------------------------------------------------------------------------- /Voxel/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: 15 7 | productGUID: 3331cd3d2c0fb654a80a2ea52a18e1fa 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: DefaultCompany 16 | productName: Voxel 17 | defaultCursor: {fileID: 0} 18 | cursorHotspot: {x: 0, y: 0} 19 | m_SplashScreenBackgroundColor: {r: 0.13725491, g: 0.12156863, b: 0.1254902, a: 1} 20 | m_ShowUnitySplashScreen: 1 21 | m_ShowUnitySplashLogo: 1 22 | m_SplashScreenOverlayOpacity: 1 23 | m_SplashScreenAnimation: 1 24 | m_SplashScreenLogoStyle: 1 25 | m_SplashScreenDrawMode: 0 26 | m_SplashScreenBackgroundAnimationZoom: 1 27 | m_SplashScreenLogoAnimationZoom: 1 28 | m_SplashScreenBackgroundLandscapeAspect: 1 29 | m_SplashScreenBackgroundPortraitAspect: 1 30 | m_SplashScreenBackgroundLandscapeUvs: 31 | serializedVersion: 2 32 | x: 0 33 | y: 0 34 | width: 1 35 | height: 1 36 | m_SplashScreenBackgroundPortraitUvs: 37 | serializedVersion: 2 38 | x: 0 39 | y: 0 40 | width: 1 41 | height: 1 42 | m_SplashScreenLogos: [] 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 0 51 | m_MTRendering: 1 52 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 53 | iosShowActivityIndicatorOnLoading: -1 54 | androidShowActivityIndicatorOnLoading: -1 55 | iosAppInBackgroundBehavior: 0 56 | displayResolutionDialog: 1 57 | iosAllowHTTPDownload: 1 58 | allowedAutorotateToPortrait: 1 59 | allowedAutorotateToPortraitUpsideDown: 1 60 | allowedAutorotateToLandscapeRight: 1 61 | allowedAutorotateToLandscapeLeft: 1 62 | useOSAutorotation: 1 63 | use32BitDisplayBuffer: 1 64 | preserveFramebufferAlpha: 0 65 | disableDepthAndStencilBuffers: 0 66 | androidStartInFullscreen: 1 67 | androidRenderOutsideSafeArea: 0 68 | androidBlitType: 0 69 | defaultIsNativeResolution: 1 70 | macRetinaSupport: 1 71 | runInBackground: 1 72 | captureSingleScreen: 0 73 | muteOtherAudioSources: 0 74 | Prepare IOS For Recording: 0 75 | Force IOS Speakers When Recording: 0 76 | deferSystemGesturesMode: 0 77 | hideHomeButton: 0 78 | submitAnalytics: 1 79 | usePlayerLog: 1 80 | bakeCollisionMeshes: 0 81 | forceSingleInstance: 0 82 | resizableWindow: 0 83 | useMacAppStoreValidation: 0 84 | macAppStoreCategory: public.app-category.games 85 | gpuSkinning: 1 86 | graphicsJobs: 0 87 | xboxPIXTextureCapture: 0 88 | xboxEnableAvatar: 0 89 | xboxEnableKinect: 0 90 | xboxEnableKinectAutoTracking: 0 91 | xboxEnableFitness: 0 92 | visibleInBackground: 1 93 | allowFullscreenSwitch: 1 94 | graphicsJobMode: 0 95 | fullscreenMode: 1 96 | xboxSpeechDB: 0 97 | xboxEnableHeadOrientation: 0 98 | xboxEnableGuest: 0 99 | xboxEnablePIXSampling: 0 100 | metalFramebufferOnly: 0 101 | xboxOneResolution: 0 102 | xboxOneSResolution: 0 103 | xboxOneXResolution: 3 104 | xboxOneMonoLoggingLevel: 0 105 | xboxOneLoggingLevel: 1 106 | xboxOneDisableEsram: 0 107 | xboxOnePresentImmediateThreshold: 0 108 | switchQueueCommandMemory: 0 109 | switchQueueControlMemory: 16384 110 | switchQueueComputeMemory: 262144 111 | switchNVNShaderPoolsGranularity: 33554432 112 | switchNVNDefaultPoolsGranularity: 16777216 113 | switchNVNOtherPoolsGranularity: 16777216 114 | vulkanEnableSetSRGBWrite: 0 115 | m_SupportedAspectRatios: 116 | 4:3: 1 117 | 5:4: 1 118 | 16:10: 1 119 | 16:9: 1 120 | Others: 1 121 | bundleVersion: 0.1 122 | preloadedAssets: [] 123 | metroInputSource: 0 124 | wsaTransparentSwapchain: 0 125 | m_HolographicPauseOnTrackingLoss: 1 126 | xboxOneDisableKinectGpuReservation: 1 127 | xboxOneEnable7thCore: 1 128 | isWsaHolographicRemotingEnabled: 0 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 | oculus: 144 | sharedDepthBuffer: 1 145 | dashSupport: 1 146 | enable360StereoCapture: 0 147 | protectGraphicsMemory: 0 148 | enableFrameTimingStats: 0 149 | useHDRDisplay: 0 150 | m_ColorGamuts: 00000000 151 | targetPixelDensity: 30 152 | resolutionScalingMode: 0 153 | androidSupportedAspectRatio: 1 154 | androidMaxAspectRatio: 2.1 155 | applicationIdentifier: {} 156 | buildNumber: {} 157 | AndroidBundleVersionCode: 1 158 | AndroidMinSdkVersion: 16 159 | AndroidTargetSdkVersion: 0 160 | AndroidPreferredInstallLocation: 1 161 | aotOptions: 162 | stripEngineCode: 1 163 | iPhoneStrippingLevel: 0 164 | iPhoneScriptCallOptimization: 0 165 | ForceInternetPermission: 0 166 | ForceSDCardPermission: 0 167 | CreateWallpaper: 0 168 | APKExpansionFiles: 0 169 | keepLoadedShadersAlive: 0 170 | StripUnusedMeshComponents: 1 171 | VertexChannelCompressionMask: 4054 172 | iPhoneSdkVersion: 988 173 | iOSTargetOSVersionString: 9.0 174 | tvOSSdkVersion: 0 175 | tvOSRequireExtendedGameController: 0 176 | tvOSTargetOSVersionString: 9.0 177 | uIPrerenderedIcon: 0 178 | uIRequiresPersistentWiFi: 0 179 | uIRequiresFullScreen: 1 180 | uIStatusBarHidden: 1 181 | uIExitOnSuspend: 0 182 | uIStatusBarStyle: 0 183 | iPhoneSplashScreen: {fileID: 0} 184 | iPhoneHighResSplashScreen: {fileID: 0} 185 | iPhoneTallHighResSplashScreen: {fileID: 0} 186 | iPhone47inSplashScreen: {fileID: 0} 187 | iPhone55inPortraitSplashScreen: {fileID: 0} 188 | iPhone55inLandscapeSplashScreen: {fileID: 0} 189 | iPhone58inPortraitSplashScreen: {fileID: 0} 190 | iPhone58inLandscapeSplashScreen: {fileID: 0} 191 | iPadPortraitSplashScreen: {fileID: 0} 192 | iPadHighResPortraitSplashScreen: {fileID: 0} 193 | iPadLandscapeSplashScreen: {fileID: 0} 194 | iPadHighResLandscapeSplashScreen: {fileID: 0} 195 | appleTVSplashScreen: {fileID: 0} 196 | appleTVSplashScreen2x: {fileID: 0} 197 | tvOSSmallIconLayers: [] 198 | tvOSSmallIconLayers2x: [] 199 | tvOSLargeIconLayers: [] 200 | tvOSLargeIconLayers2x: [] 201 | tvOSTopShelfImageLayers: [] 202 | tvOSTopShelfImageLayers2x: [] 203 | tvOSTopShelfImageWideLayers: [] 204 | tvOSTopShelfImageWideLayers2x: [] 205 | iOSLaunchScreenType: 0 206 | iOSLaunchScreenPortrait: {fileID: 0} 207 | iOSLaunchScreenLandscape: {fileID: 0} 208 | iOSLaunchScreenBackgroundColor: 209 | serializedVersion: 2 210 | rgba: 0 211 | iOSLaunchScreenFillPct: 100 212 | iOSLaunchScreenSize: 100 213 | iOSLaunchScreenCustomXibPath: 214 | iOSLaunchScreeniPadType: 0 215 | iOSLaunchScreeniPadImage: {fileID: 0} 216 | iOSLaunchScreeniPadBackgroundColor: 217 | serializedVersion: 2 218 | rgba: 0 219 | iOSLaunchScreeniPadFillPct: 100 220 | iOSLaunchScreeniPadSize: 100 221 | iOSLaunchScreeniPadCustomXibPath: 222 | iOSUseLaunchScreenStoryboard: 0 223 | iOSLaunchScreenCustomStoryboardPath: 224 | iOSDeviceRequirements: [] 225 | iOSURLSchemes: [] 226 | iOSBackgroundModes: 0 227 | iOSMetalForceHardShadows: 0 228 | metalEditorSupport: 1 229 | metalAPIValidation: 1 230 | iOSRenderExtraFrameOnPause: 0 231 | appleDeveloperTeamID: 232 | iOSManualSigningProvisioningProfileID: 233 | tvOSManualSigningProvisioningProfileID: 234 | iOSManualSigningProvisioningProfileType: 0 235 | tvOSManualSigningProvisioningProfileType: 0 236 | appleEnableAutomaticSigning: 0 237 | iOSRequireARKit: 0 238 | iOSAutomaticallyDetectAndAddCapabilities: 1 239 | appleEnableProMotion: 0 240 | clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea 241 | templatePackageId: com.unity.template.3d@1.3.0 242 | templateDefaultScene: Assets/Scenes/SampleScene.unity 243 | AndroidTargetArchitectures: 5 244 | AndroidSplashScreenScale: 0 245 | androidSplashScreen: {fileID: 0} 246 | AndroidKeystoreName: 247 | AndroidKeyaliasName: 248 | AndroidBuildApkPerCpuArchitecture: 0 249 | AndroidTVCompatibility: 1 250 | AndroidIsGame: 1 251 | AndroidEnableTango: 0 252 | androidEnableBanner: 1 253 | androidUseLowAccuracyLocation: 0 254 | m_AndroidBanners: 255 | - width: 320 256 | height: 180 257 | banner: {fileID: 0} 258 | androidGamepadSupportLevel: 0 259 | resolutionDialogBanner: {fileID: 0} 260 | m_BuildTargetIcons: [] 261 | m_BuildTargetPlatformIcons: [] 262 | m_BuildTargetBatching: 263 | - m_BuildTarget: Standalone 264 | m_StaticBatching: 1 265 | m_DynamicBatching: 0 266 | - m_BuildTarget: tvOS 267 | m_StaticBatching: 1 268 | m_DynamicBatching: 0 269 | - m_BuildTarget: Android 270 | m_StaticBatching: 1 271 | m_DynamicBatching: 0 272 | - m_BuildTarget: iPhone 273 | m_StaticBatching: 1 274 | m_DynamicBatching: 0 275 | - m_BuildTarget: WebGL 276 | m_StaticBatching: 0 277 | m_DynamicBatching: 0 278 | m_BuildTargetGraphicsAPIs: 279 | - m_BuildTarget: AndroidPlayer 280 | m_APIs: 0b00000008000000 281 | m_Automatic: 1 282 | - m_BuildTarget: iOSSupport 283 | m_APIs: 10000000 284 | m_Automatic: 1 285 | - m_BuildTarget: AppleTVSupport 286 | m_APIs: 10000000 287 | m_Automatic: 0 288 | - m_BuildTarget: WebGLSupport 289 | m_APIs: 0b000000 290 | m_Automatic: 1 291 | m_BuildTargetVRSettings: 292 | - m_BuildTarget: Standalone 293 | m_Enabled: 0 294 | m_Devices: 295 | - Oculus 296 | - OpenVR 297 | m_BuildTargetEnableVuforiaSettings: [] 298 | openGLRequireES31: 0 299 | openGLRequireES31AEP: 0 300 | m_TemplateCustomTags: {} 301 | mobileMTRendering: 302 | Android: 1 303 | iPhone: 1 304 | tvOS: 1 305 | m_BuildTargetGroupLightmapEncodingQuality: [] 306 | m_BuildTargetGroupLightmapSettings: [] 307 | playModeTestRunnerEnabled: 0 308 | runPlayModeTestAsEditModeTest: 0 309 | actionOnDotNetUnhandledException: 1 310 | enableInternalProfiler: 0 311 | logObjCUncaughtExceptions: 1 312 | enableCrashReportAPI: 0 313 | cameraUsageDescription: 314 | locationUsageDescription: 315 | microphoneUsageDescription: 316 | switchNetLibKey: 317 | switchSocketMemoryPoolSize: 6144 318 | switchSocketAllocatorPoolSize: 128 319 | switchSocketConcurrencyLimit: 14 320 | switchScreenResolutionBehavior: 2 321 | switchUseCPUProfiler: 0 322 | switchApplicationID: 0x01004b9000490000 323 | switchNSODependencies: 324 | switchTitleNames_0: 325 | switchTitleNames_1: 326 | switchTitleNames_2: 327 | switchTitleNames_3: 328 | switchTitleNames_4: 329 | switchTitleNames_5: 330 | switchTitleNames_6: 331 | switchTitleNames_7: 332 | switchTitleNames_8: 333 | switchTitleNames_9: 334 | switchTitleNames_10: 335 | switchTitleNames_11: 336 | switchTitleNames_12: 337 | switchTitleNames_13: 338 | switchTitleNames_14: 339 | switchPublisherNames_0: 340 | switchPublisherNames_1: 341 | switchPublisherNames_2: 342 | switchPublisherNames_3: 343 | switchPublisherNames_4: 344 | switchPublisherNames_5: 345 | switchPublisherNames_6: 346 | switchPublisherNames_7: 347 | switchPublisherNames_8: 348 | switchPublisherNames_9: 349 | switchPublisherNames_10: 350 | switchPublisherNames_11: 351 | switchPublisherNames_12: 352 | switchPublisherNames_13: 353 | switchPublisherNames_14: 354 | switchIcons_0: {fileID: 0} 355 | switchIcons_1: {fileID: 0} 356 | switchIcons_2: {fileID: 0} 357 | switchIcons_3: {fileID: 0} 358 | switchIcons_4: {fileID: 0} 359 | switchIcons_5: {fileID: 0} 360 | switchIcons_6: {fileID: 0} 361 | switchIcons_7: {fileID: 0} 362 | switchIcons_8: {fileID: 0} 363 | switchIcons_9: {fileID: 0} 364 | switchIcons_10: {fileID: 0} 365 | switchIcons_11: {fileID: 0} 366 | switchIcons_12: {fileID: 0} 367 | switchIcons_13: {fileID: 0} 368 | switchIcons_14: {fileID: 0} 369 | switchSmallIcons_0: {fileID: 0} 370 | switchSmallIcons_1: {fileID: 0} 371 | switchSmallIcons_2: {fileID: 0} 372 | switchSmallIcons_3: {fileID: 0} 373 | switchSmallIcons_4: {fileID: 0} 374 | switchSmallIcons_5: {fileID: 0} 375 | switchSmallIcons_6: {fileID: 0} 376 | switchSmallIcons_7: {fileID: 0} 377 | switchSmallIcons_8: {fileID: 0} 378 | switchSmallIcons_9: {fileID: 0} 379 | switchSmallIcons_10: {fileID: 0} 380 | switchSmallIcons_11: {fileID: 0} 381 | switchSmallIcons_12: {fileID: 0} 382 | switchSmallIcons_13: {fileID: 0} 383 | switchSmallIcons_14: {fileID: 0} 384 | switchManualHTML: 385 | switchAccessibleURLs: 386 | switchLegalInformation: 387 | switchMainThreadStackSize: 1048576 388 | switchPresenceGroupId: 389 | switchLogoHandling: 0 390 | switchReleaseVersion: 0 391 | switchDisplayVersion: 1.0.0 392 | switchStartupUserAccount: 0 393 | switchTouchScreenUsage: 0 394 | switchSupportedLanguagesMask: 0 395 | switchLogoType: 0 396 | switchApplicationErrorCodeCategory: 397 | switchUserAccountSaveDataSize: 0 398 | switchUserAccountSaveDataJournalSize: 0 399 | switchApplicationAttribute: 0 400 | switchCardSpecSize: -1 401 | switchCardSpecClock: -1 402 | switchRatingsMask: 0 403 | switchRatingsInt_0: 0 404 | switchRatingsInt_1: 0 405 | switchRatingsInt_2: 0 406 | switchRatingsInt_3: 0 407 | switchRatingsInt_4: 0 408 | switchRatingsInt_5: 0 409 | switchRatingsInt_6: 0 410 | switchRatingsInt_7: 0 411 | switchRatingsInt_8: 0 412 | switchRatingsInt_9: 0 413 | switchRatingsInt_10: 0 414 | switchRatingsInt_11: 0 415 | switchLocalCommunicationIds_0: 416 | switchLocalCommunicationIds_1: 417 | switchLocalCommunicationIds_2: 418 | switchLocalCommunicationIds_3: 419 | switchLocalCommunicationIds_4: 420 | switchLocalCommunicationIds_5: 421 | switchLocalCommunicationIds_6: 422 | switchLocalCommunicationIds_7: 423 | switchParentalControl: 0 424 | switchAllowsScreenshot: 1 425 | switchAllowsVideoCapturing: 1 426 | switchAllowsRuntimeAddOnContentInstall: 0 427 | switchDataLossConfirmation: 0 428 | switchUserAccountLockEnabled: 0 429 | switchSystemResourceMemory: 16777216 430 | switchSupportedNpadStyles: 3 431 | switchNativeFsCacheSize: 32 432 | switchIsHoldTypeHorizontal: 0 433 | switchSupportedNpadCount: 8 434 | switchSocketConfigEnabled: 0 435 | switchTcpInitialSendBufferSize: 32 436 | switchTcpInitialReceiveBufferSize: 64 437 | switchTcpAutoSendBufferSizeMax: 256 438 | switchTcpAutoReceiveBufferSizeMax: 256 439 | switchUdpSendBufferSize: 9 440 | switchUdpReceiveBufferSize: 42 441 | switchSocketBufferEfficiency: 4 442 | switchSocketInitializeEnabled: 1 443 | switchNetworkInterfaceManagerInitializeEnabled: 1 444 | switchPlayerConnectionEnabled: 1 445 | ps4NPAgeRating: 12 446 | ps4NPTitleSecret: 447 | ps4NPTrophyPackPath: 448 | ps4ParentalLevel: 11 449 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 450 | ps4Category: 0 451 | ps4MasterVersion: 01.00 452 | ps4AppVersion: 01.00 453 | ps4AppType: 0 454 | ps4ParamSfxPath: 455 | ps4VideoOutPixelFormat: 0 456 | ps4VideoOutInitialWidth: 1920 457 | ps4VideoOutBaseModeInitialWidth: 1920 458 | ps4VideoOutReprojectionRate: 60 459 | ps4PronunciationXMLPath: 460 | ps4PronunciationSIGPath: 461 | ps4BackgroundImagePath: 462 | ps4StartupImagePath: 463 | ps4StartupImagesFolder: 464 | ps4IconImagesFolder: 465 | ps4SaveDataImagePath: 466 | ps4SdkOverride: 467 | ps4BGMPath: 468 | ps4ShareFilePath: 469 | ps4ShareOverlayImagePath: 470 | ps4PrivacyGuardImagePath: 471 | ps4NPtitleDatPath: 472 | ps4RemotePlayKeyAssignment: -1 473 | ps4RemotePlayKeyMappingDir: 474 | ps4PlayTogetherPlayerCount: 0 475 | ps4EnterButtonAssignment: 1 476 | ps4ApplicationParam1: 0 477 | ps4ApplicationParam2: 0 478 | ps4ApplicationParam3: 0 479 | ps4ApplicationParam4: 0 480 | ps4DownloadDataSize: 0 481 | ps4GarlicHeapSize: 2048 482 | ps4ProGarlicHeapSize: 2560 483 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 484 | ps4pnSessions: 1 485 | ps4pnPresence: 1 486 | ps4pnFriends: 1 487 | ps4pnGameCustomData: 1 488 | playerPrefsSupport: 0 489 | enableApplicationExit: 0 490 | resetTempFolder: 1 491 | restrictedAudioUsageRights: 0 492 | ps4UseResolutionFallback: 0 493 | ps4ReprojectionSupport: 0 494 | ps4UseAudio3dBackend: 0 495 | ps4SocialScreenEnabled: 0 496 | ps4ScriptOptimizationLevel: 0 497 | ps4Audio3dVirtualSpeakerCount: 14 498 | ps4attribCpuUsage: 0 499 | ps4PatchPkgPath: 500 | ps4PatchLatestPkgPath: 501 | ps4PatchChangeinfoPath: 502 | ps4PatchDayOne: 0 503 | ps4attribUserManagement: 0 504 | ps4attribMoveSupport: 0 505 | ps4attrib3DSupport: 0 506 | ps4attribShareSupport: 0 507 | ps4attribExclusiveVR: 0 508 | ps4disableAutoHideSplash: 0 509 | ps4videoRecordingFeaturesUsed: 0 510 | ps4contentSearchFeaturesUsed: 0 511 | ps4attribEyeToEyeDistanceSettingVR: 0 512 | ps4IncludedModules: [] 513 | monoEnv: 514 | splashScreenBackgroundSourceLandscape: {fileID: 0} 515 | splashScreenBackgroundSourcePortrait: {fileID: 0} 516 | spritePackerPolicy: 517 | webGLMemorySize: 256 518 | webGLExceptionSupport: 1 519 | webGLNameFilesAsHashes: 0 520 | webGLDataCaching: 1 521 | webGLDebugSymbols: 0 522 | webGLEmscriptenArgs: 523 | webGLModulesDirectory: 524 | webGLTemplate: APPLICATION:Default 525 | webGLAnalyzeBuildSize: 0 526 | webGLUseEmbeddedResources: 0 527 | webGLCompressionFormat: 1 528 | webGLLinkerTarget: 1 529 | webGLThreadsSupport: 0 530 | scriptingDefineSymbols: 531 | 1: UNITY_POST_PROCESSING_STACK_V2 532 | 7: UNITY_POST_PROCESSING_STACK_V2 533 | 13: UNITY_POST_PROCESSING_STACK_V2 534 | 19: UNITY_POST_PROCESSING_STACK_V2 535 | 21: UNITY_POST_PROCESSING_STACK_V2 536 | 25: UNITY_POST_PROCESSING_STACK_V2 537 | 26: UNITY_POST_PROCESSING_STACK_V2 538 | 27: UNITY_POST_PROCESSING_STACK_V2 539 | 28: UNITY_POST_PROCESSING_STACK_V2 540 | platformArchitecture: {} 541 | scriptingBackend: {} 542 | il2cppCompilerConfiguration: {} 543 | managedStrippingLevel: {} 544 | incrementalIl2cppBuild: {} 545 | allowUnsafeCode: 0 546 | additionalIl2CppArgs: 547 | scriptingRuntimeVersion: 1 548 | apiCompatibilityLevelPerPlatform: {} 549 | m_RenderingPath: 1 550 | m_MobileRenderingPath: 1 551 | metroPackageName: Template_3D 552 | metroPackageVersion: 553 | metroCertificatePath: 554 | metroCertificatePassword: 555 | metroCertificateSubject: 556 | metroCertificateIssuer: 557 | metroCertificateNotAfter: 0000000000000000 558 | metroApplicationDescription: Template_3D 559 | wsaImages: {} 560 | metroTileShortName: 561 | metroTileShowName: 0 562 | metroMediumTileShowName: 0 563 | metroLargeTileShowName: 0 564 | metroWideTileShowName: 0 565 | metroSupportStreamingInstall: 0 566 | metroLastRequiredScene: 0 567 | metroDefaultTileSize: 1 568 | metroTileForegroundText: 2 569 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 570 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 571 | a: 1} 572 | metroSplashScreenUseBackgroundColor: 0 573 | platformCapabilities: {} 574 | metroTargetDeviceFamilies: {} 575 | metroFTAName: 576 | metroFTAFileTypes: [] 577 | metroProtocolName: 578 | metroCompilationOverrides: 1 579 | XboxOneProductId: 580 | XboxOneUpdateKey: 581 | XboxOneSandboxId: 582 | XboxOneContentId: 583 | XboxOneTitleId: 584 | XboxOneSCId: 585 | XboxOneGameOsOverridePath: 586 | XboxOnePackagingOverridePath: 587 | XboxOneAppManifestOverridePath: 588 | XboxOneVersion: 1.0.0.0 589 | XboxOnePackageEncryption: 0 590 | XboxOnePackageUpdateGranularity: 2 591 | XboxOneDescription: 592 | XboxOneLanguage: 593 | - enus 594 | XboxOneCapability: [] 595 | XboxOneGameRating: {} 596 | XboxOneIsContentPackage: 0 597 | XboxOneEnableGPUVariability: 1 598 | XboxOneSockets: {} 599 | XboxOneSplashScreen: {fileID: 0} 600 | XboxOneAllowedProductIds: [] 601 | XboxOnePersistentLocalStorageSize: 0 602 | XboxOneXTitleMemory: 8 603 | xboxOneScriptCompiler: 1 604 | XboxOneOverrideIdentityName: 605 | vrEditorSettings: 606 | daydream: 607 | daydreamIconForeground: {fileID: 0} 608 | daydreamIconBackground: {fileID: 0} 609 | cloudServicesEnabled: 610 | UNet: 1 611 | luminIcon: 612 | m_Name: 613 | m_ModelFolderPath: 614 | m_PortalFolderPath: 615 | luminCert: 616 | m_CertPath: 617 | m_PrivateKeyPath: 618 | luminIsChannelApp: 0 619 | luminVersion: 620 | m_VersionCode: 1 621 | m_VersionName: 622 | facebookSdkVersion: 7.9.4 623 | facebookAppId: 624 | facebookCookies: 1 625 | facebookLogging: 1 626 | facebookStatus: 1 627 | facebookXfbml: 0 628 | facebookFrictionlessRequests: 1 629 | apiCompatibilityLevel: 6 630 | cloudProjectId: 631 | framebufferDepthMemorylessMode: 0 632 | projectName: 633 | organizationId: 634 | cloudEnabled: 0 635 | enableNativePlatformBackendsForNewInputSystem: 0 636 | disableOldInputManagerSupport: 0 637 | legacyClampBlendShapeWeights: 0 638 | -------------------------------------------------------------------------------- /Voxel/Assets/Scenes/Game.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 2100000, guid: 0e5a2c967c0b25549990aaa1fa59b900, type: 2} 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: 0 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 170076734} 41 | m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 0} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 0 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_EnvironmentLightingMode: 0 54 | m_EnableBakedLightmaps: 1 55 | m_EnableRealtimeLightmaps: 0 56 | m_LightmapEditorSettings: 57 | serializedVersion: 10 58 | m_Resolution: 2 59 | m_BakeResolution: 10 60 | m_AtlasSize: 512 61 | m_AO: 0 62 | m_AOMaxDistance: 1 63 | m_CompAOExponent: 1 64 | m_CompAOExponentDirect: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 1 69 | m_FinalGather: 0 70 | m_FinalGatherFiltering: 1 71 | m_FinalGatherRayCount: 256 72 | m_ReflectionCompression: 2 73 | m_MixedBakeMode: 2 74 | m_BakeBackend: 1 75 | m_PVRSampling: 1 76 | m_PVRDirectSampleCount: 32 77 | m_PVRSampleCount: 256 78 | m_PVRBounces: 2 79 | m_PVRFilterTypeDirect: 0 80 | m_PVRFilterTypeIndirect: 0 81 | m_PVRFilterTypeAO: 0 82 | m_PVRFilteringMode: 1 83 | m_PVRCulling: 1 84 | m_PVRFilteringGaussRadiusDirect: 1 85 | m_PVRFilteringGaussRadiusIndirect: 5 86 | m_PVRFilteringGaussRadiusAO: 2 87 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 88 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 89 | m_PVRFilteringAtrousPositionSigmaAO: 1 90 | m_ShowResolutionOverlay: 1 91 | m_LightingDataAsset: {fileID: 0} 92 | m_UseShadowmask: 1 93 | --- !u!196 &4 94 | NavMeshSettings: 95 | serializedVersion: 2 96 | m_ObjectHideFlags: 0 97 | m_BuildSettings: 98 | serializedVersion: 2 99 | agentTypeID: 0 100 | agentRadius: 0.5 101 | agentHeight: 2 102 | agentSlope: 45 103 | agentClimb: 0.4 104 | ledgeDropHeight: 0 105 | maxJumpAcrossDistance: 0 106 | minRegionArea: 2 107 | manualCellSize: 0 108 | cellSize: 0.16666667 109 | manualTileSize: 0 110 | tileSize: 256 111 | accuratePlacement: 0 112 | debug: 113 | m_Flags: 0 114 | m_NavMeshData: {fileID: 0} 115 | --- !u!1 &170076733 116 | GameObject: 117 | m_ObjectHideFlags: 0 118 | m_CorrespondingSourceObject: {fileID: 0} 119 | m_PrefabInstance: {fileID: 0} 120 | m_PrefabAsset: {fileID: 0} 121 | serializedVersion: 6 122 | m_Component: 123 | - component: {fileID: 170076735} 124 | - component: {fileID: 170076734} 125 | m_Layer: 0 126 | m_Name: Directional Light 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!108 &170076734 133 | Light: 134 | m_ObjectHideFlags: 0 135 | m_CorrespondingSourceObject: {fileID: 0} 136 | m_PrefabInstance: {fileID: 0} 137 | m_PrefabAsset: {fileID: 0} 138 | m_GameObject: {fileID: 170076733} 139 | m_Enabled: 1 140 | serializedVersion: 8 141 | m_Type: 1 142 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 143 | m_Intensity: 1 144 | m_Range: 10 145 | m_SpotAngle: 30 146 | m_CookieSize: 10 147 | m_Shadows: 148 | m_Type: 0 149 | m_Resolution: -1 150 | m_CustomResolution: -1 151 | m_Strength: 1 152 | m_Bias: 0.05 153 | m_NormalBias: 0.4 154 | m_NearPlane: 0.2 155 | m_Cookie: {fileID: 0} 156 | m_DrawHalo: 0 157 | m_Flare: {fileID: 0} 158 | m_RenderMode: 0 159 | m_CullingMask: 160 | serializedVersion: 2 161 | m_Bits: 4294967295 162 | m_Lightmapping: 1 163 | m_LightShadowCasterMode: 0 164 | m_AreaSize: {x: 1, y: 1} 165 | m_BounceIntensity: 1 166 | m_ColorTemperature: 6570 167 | m_UseColorTemperature: 0 168 | m_ShadowRadius: 0 169 | m_ShadowAngle: 0 170 | --- !u!4 &170076735 171 | Transform: 172 | m_ObjectHideFlags: 0 173 | m_CorrespondingSourceObject: {fileID: 0} 174 | m_PrefabInstance: {fileID: 0} 175 | m_PrefabAsset: {fileID: 0} 176 | m_GameObject: {fileID: 170076733} 177 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 178 | m_LocalPosition: {x: 0, y: 3, z: 0} 179 | m_LocalScale: {x: 1, y: 1, z: 1} 180 | m_Children: [] 181 | m_Father: {fileID: 0} 182 | m_RootOrder: 2 183 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 184 | --- !u!1 &288327011 185 | GameObject: 186 | m_ObjectHideFlags: 0 187 | m_CorrespondingSourceObject: {fileID: 0} 188 | m_PrefabInstance: {fileID: 0} 189 | m_PrefabAsset: {fileID: 0} 190 | serializedVersion: 6 191 | m_Component: 192 | - component: {fileID: 288327014} 193 | - component: {fileID: 288327013} 194 | - component: {fileID: 288327012} 195 | - component: {fileID: 288327016} 196 | - component: {fileID: 288327015} 197 | m_Layer: 2 198 | m_Name: Player 199 | m_TagString: Player 200 | m_Icon: {fileID: 0} 201 | m_NavMeshLayer: 0 202 | m_StaticEditorFlags: 0 203 | m_IsActive: 1 204 | --- !u!143 &288327012 205 | CharacterController: 206 | m_ObjectHideFlags: 0 207 | m_CorrespondingSourceObject: {fileID: 0} 208 | m_PrefabInstance: {fileID: 0} 209 | m_PrefabAsset: {fileID: 0} 210 | m_GameObject: {fileID: 288327011} 211 | m_Material: {fileID: 0} 212 | m_IsTrigger: 0 213 | m_Enabled: 1 214 | serializedVersion: 2 215 | m_Height: 1.75 216 | m_Radius: 0.4 217 | m_SlopeLimit: 45 218 | m_StepOffset: 0.3 219 | m_SkinWidth: 0.08 220 | m_MinMoveDistance: 0.001 221 | m_Center: {x: 0, y: 0, z: 0} 222 | --- !u!114 &288327013 223 | MonoBehaviour: 224 | m_ObjectHideFlags: 0 225 | m_CorrespondingSourceObject: {fileID: 0} 226 | m_PrefabInstance: {fileID: 0} 227 | m_PrefabAsset: {fileID: 0} 228 | m_GameObject: {fileID: 288327011} 229 | m_Enabled: 1 230 | m_EditorHideFlags: 0 231 | m_Script: {fileID: 11500000, guid: d7db33ff3a5ff73419f59b111751ad63, type: 3} 232 | m_Name: 233 | m_EditorClassIdentifier: 234 | playerLook: 235 | XSensitivity: 2 236 | YSensitivity: 2 237 | clampVerticalRotation: 1 238 | MinimumX: -90 239 | MaximumX: 90 240 | smooth: 0 241 | smoothTime: 5 242 | lockCursor: 1 243 | playerCamera: {fileID: 534669905} 244 | m_WalkSpeed: 4 245 | m_RunSpeed: 6 246 | m_LimitDiagonalSpeed: 1 247 | m_ToggleRun: 0 248 | m_JumpSpeed: 7 249 | m_Gravity: 20 250 | m_FallingThreshold: 10 251 | m_SlideWhenOverSlopeLimit: 0 252 | m_SlideOnTaggedObjects: 0 253 | m_SlideSpeed: 12 254 | m_AirControl: 1 255 | m_AntiBumpFactor: 0.75 256 | m_AntiBunnyHopFactor: 1 257 | --- !u!4 &288327014 258 | Transform: 259 | m_ObjectHideFlags: 0 260 | m_CorrespondingSourceObject: {fileID: 0} 261 | m_PrefabInstance: {fileID: 0} 262 | m_PrefabAsset: {fileID: 0} 263 | m_GameObject: {fileID: 288327011} 264 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 265 | m_LocalPosition: {x: -30, y: 100, z: 0} 266 | m_LocalScale: {x: 1, y: 1, z: 1} 267 | m_Children: 268 | - {fileID: 534669905} 269 | m_Father: {fileID: 0} 270 | m_RootOrder: 4 271 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 272 | --- !u!114 &288327015 273 | MonoBehaviour: 274 | m_ObjectHideFlags: 0 275 | m_CorrespondingSourceObject: {fileID: 0} 276 | m_PrefabInstance: {fileID: 0} 277 | m_PrefabAsset: {fileID: 0} 278 | m_GameObject: {fileID: 288327011} 279 | m_Enabled: 1 280 | m_EditorHideFlags: 0 281 | m_Script: {fileID: 11500000, guid: 33aa02f814a36ce4a9065919f5bccf6f, type: 3} 282 | m_Name: 283 | m_EditorClassIdentifier: 284 | playerCamera: {fileID: 534669904} 285 | --- !u!114 &288327016 286 | MonoBehaviour: 287 | m_ObjectHideFlags: 0 288 | m_CorrespondingSourceObject: {fileID: 0} 289 | m_PrefabInstance: {fileID: 0} 290 | m_PrefabAsset: {fileID: 0} 291 | m_GameObject: {fileID: 288327011} 292 | m_Enabled: 1 293 | m_EditorHideFlags: 0 294 | m_Script: {fileID: 11500000, guid: 188ffa21e92af4f4597df06948600156, type: 3} 295 | m_Name: 296 | m_EditorClassIdentifier: 297 | position: {x: 0, y: 0, z: 0} 298 | standingOn: 299 | changed: 1 300 | --- !u!1 &508571599 301 | GameObject: 302 | m_ObjectHideFlags: 0 303 | m_CorrespondingSourceObject: {fileID: 0} 304 | m_PrefabInstance: {fileID: 0} 305 | m_PrefabAsset: {fileID: 0} 306 | serializedVersion: 6 307 | m_Component: 308 | - component: {fileID: 508571603} 309 | - component: {fileID: 508571602} 310 | - component: {fileID: 508571601} 311 | - component: {fileID: 508571600} 312 | m_Layer: 5 313 | m_Name: Canvas 314 | m_TagString: Untagged 315 | m_Icon: {fileID: 0} 316 | m_NavMeshLayer: 0 317 | m_StaticEditorFlags: 0 318 | m_IsActive: 1 319 | --- !u!114 &508571600 320 | MonoBehaviour: 321 | m_ObjectHideFlags: 0 322 | m_CorrespondingSourceObject: {fileID: 0} 323 | m_PrefabInstance: {fileID: 0} 324 | m_PrefabAsset: {fileID: 0} 325 | m_GameObject: {fileID: 508571599} 326 | m_Enabled: 1 327 | m_EditorHideFlags: 0 328 | m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} 329 | m_Name: 330 | m_EditorClassIdentifier: 331 | m_IgnoreReversedGraphics: 1 332 | m_BlockingObjects: 0 333 | m_BlockingMask: 334 | serializedVersion: 2 335 | m_Bits: 4294967295 336 | --- !u!114 &508571601 337 | MonoBehaviour: 338 | m_ObjectHideFlags: 0 339 | m_CorrespondingSourceObject: {fileID: 0} 340 | m_PrefabInstance: {fileID: 0} 341 | m_PrefabAsset: {fileID: 0} 342 | m_GameObject: {fileID: 508571599} 343 | m_Enabled: 1 344 | m_EditorHideFlags: 0 345 | m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} 346 | m_Name: 347 | m_EditorClassIdentifier: 348 | m_UiScaleMode: 0 349 | m_ReferencePixelsPerUnit: 100 350 | m_ScaleFactor: 1 351 | m_ReferenceResolution: {x: 800, y: 600} 352 | m_ScreenMatchMode: 0 353 | m_MatchWidthOrHeight: 0 354 | m_PhysicalUnit: 3 355 | m_FallbackScreenDPI: 96 356 | m_DefaultSpriteDPI: 96 357 | m_DynamicPixelsPerUnit: 1 358 | --- !u!223 &508571602 359 | Canvas: 360 | m_ObjectHideFlags: 0 361 | m_CorrespondingSourceObject: {fileID: 0} 362 | m_PrefabInstance: {fileID: 0} 363 | m_PrefabAsset: {fileID: 0} 364 | m_GameObject: {fileID: 508571599} 365 | m_Enabled: 1 366 | serializedVersion: 3 367 | m_RenderMode: 0 368 | m_Camera: {fileID: 0} 369 | m_PlaneDistance: 100 370 | m_PixelPerfect: 0 371 | m_ReceivesEvents: 1 372 | m_OverrideSorting: 0 373 | m_OverridePixelPerfect: 0 374 | m_SortingBucketNormalizedSize: 0 375 | m_AdditionalShaderChannelsFlag: 0 376 | m_SortingLayerID: 0 377 | m_SortingOrder: 0 378 | m_TargetDisplay: 0 379 | --- !u!224 &508571603 380 | RectTransform: 381 | m_ObjectHideFlags: 0 382 | m_CorrespondingSourceObject: {fileID: 0} 383 | m_PrefabInstance: {fileID: 0} 384 | m_PrefabAsset: {fileID: 0} 385 | m_GameObject: {fileID: 508571599} 386 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 387 | m_LocalPosition: {x: 0, y: 0, z: 0} 388 | m_LocalScale: {x: 0, y: 0, z: 0} 389 | m_Children: 390 | - {fileID: 2086110202} 391 | m_Father: {fileID: 0} 392 | m_RootOrder: 0 393 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 394 | m_AnchorMin: {x: 0, y: 0} 395 | m_AnchorMax: {x: 0, y: 0} 396 | m_AnchoredPosition: {x: 0, y: 0} 397 | m_SizeDelta: {x: 0, y: 0} 398 | m_Pivot: {x: 0, y: 0} 399 | --- !u!1 &534669902 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: 534669905} 408 | - component: {fileID: 534669904} 409 | - component: {fileID: 534669908} 410 | - component: {fileID: 534669903} 411 | - component: {fileID: 534669907} 412 | - component: {fileID: 534669906} 413 | m_Layer: 2 414 | m_Name: Main Camera 415 | m_TagString: MainCamera 416 | m_Icon: {fileID: 0} 417 | m_NavMeshLayer: 0 418 | m_StaticEditorFlags: 0 419 | m_IsActive: 1 420 | --- !u!81 &534669903 421 | AudioListener: 422 | m_ObjectHideFlags: 0 423 | m_CorrespondingSourceObject: {fileID: 0} 424 | m_PrefabInstance: {fileID: 0} 425 | m_PrefabAsset: {fileID: 0} 426 | m_GameObject: {fileID: 534669902} 427 | m_Enabled: 1 428 | --- !u!20 &534669904 429 | Camera: 430 | m_ObjectHideFlags: 0 431 | m_CorrespondingSourceObject: {fileID: 0} 432 | m_PrefabInstance: {fileID: 0} 433 | m_PrefabAsset: {fileID: 0} 434 | m_GameObject: {fileID: 534669902} 435 | m_Enabled: 1 436 | serializedVersion: 2 437 | m_ClearFlags: 1 438 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 439 | m_projectionMatrixMode: 1 440 | m_SensorSize: {x: 36, y: 24} 441 | m_LensShift: {x: 0, y: 0} 442 | m_GateFitMode: 2 443 | m_FocalLength: 50 444 | m_NormalizedViewPortRect: 445 | serializedVersion: 2 446 | x: 0 447 | y: 0 448 | width: 1 449 | height: 1 450 | near clip plane: 0.01 451 | far clip plane: 1000 452 | field of view: 70 453 | orthographic: 0 454 | orthographic size: 5 455 | m_Depth: -1 456 | m_CullingMask: 457 | serializedVersion: 2 458 | m_Bits: 4294967295 459 | m_RenderingPath: -1 460 | m_TargetTexture: {fileID: 0} 461 | m_TargetDisplay: 0 462 | m_TargetEye: 3 463 | m_HDR: 0 464 | m_AllowMSAA: 0 465 | m_AllowDynamicResolution: 0 466 | m_ForceIntoRT: 1 467 | m_OcclusionCulling: 1 468 | m_StereoConvergence: 10 469 | m_StereoSeparation: 0.022 470 | --- !u!4 &534669905 471 | Transform: 472 | m_ObjectHideFlags: 0 473 | m_CorrespondingSourceObject: {fileID: 0} 474 | m_PrefabInstance: {fileID: 0} 475 | m_PrefabAsset: {fileID: 0} 476 | m_GameObject: {fileID: 534669902} 477 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 478 | m_LocalPosition: {x: 0, y: 0.7, z: 0} 479 | m_LocalScale: {x: 1, y: 1, z: 1} 480 | m_Children: [] 481 | m_Father: {fileID: 288327014} 482 | m_RootOrder: 0 483 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 484 | --- !u!114 &534669906 485 | MonoBehaviour: 486 | m_ObjectHideFlags: 0 487 | m_CorrespondingSourceObject: {fileID: 0} 488 | m_PrefabInstance: {fileID: 0} 489 | m_PrefabAsset: {fileID: 0} 490 | m_GameObject: {fileID: 534669902} 491 | m_Enabled: 1 492 | m_EditorHideFlags: 0 493 | m_Script: {fileID: 11500000, guid: 8b9a305e18de0c04dbd257a21cd47087, type: 3} 494 | m_Name: 495 | m_EditorClassIdentifier: 496 | sharedProfile: {fileID: 11400000, guid: 3e9c6aedcfa7000468cdc02082bc9139, type: 2} 497 | isGlobal: 1 498 | blendDistance: 0 499 | weight: 1 500 | priority: 0 501 | --- !u!114 &534669907 502 | MonoBehaviour: 503 | m_ObjectHideFlags: 0 504 | m_CorrespondingSourceObject: {fileID: 0} 505 | m_PrefabInstance: {fileID: 0} 506 | m_PrefabAsset: {fileID: 0} 507 | m_GameObject: {fileID: 534669902} 508 | m_Enabled: 1 509 | m_EditorHideFlags: 0 510 | m_Script: {fileID: 11500000, guid: 948f4100a11a5c24981795d21301da5c, type: 3} 511 | m_Name: 512 | m_EditorClassIdentifier: 513 | volumeTrigger: {fileID: 534669905} 514 | volumeLayer: 515 | serializedVersion: 2 516 | m_Bits: 4 517 | stopNaNPropagation: 1 518 | finalBlitToCameraTarget: 1 519 | antialiasingMode: 0 520 | temporalAntialiasing: 521 | jitterSpread: 0.75 522 | sharpness: 0.25 523 | stationaryBlending: 0.95 524 | motionBlending: 0.85 525 | subpixelMorphologicalAntialiasing: 526 | quality: 2 527 | fastApproximateAntialiasing: 528 | fastMode: 0 529 | keepAlpha: 0 530 | fog: 531 | enabled: 1 532 | excludeSkybox: 1 533 | debugLayer: 534 | lightMeter: 535 | width: 512 536 | height: 256 537 | showCurves: 1 538 | histogram: 539 | width: 512 540 | height: 256 541 | channel: 3 542 | waveform: 543 | exposure: 0.12 544 | height: 256 545 | vectorscope: 546 | size: 256 547 | exposure: 0.12 548 | overlaySettings: 549 | linearDepth: 0 550 | motionColorIntensity: 4 551 | motionGridSize: 64 552 | colorBlindnessType: 0 553 | colorBlindnessStrength: 1 554 | m_Resources: {fileID: 11400000, guid: d82512f9c8e5d4a4d938b575d47f88d4, type: 2} 555 | m_ShowToolkit: 0 556 | m_ShowCustomSorter: 0 557 | breakBeforeColorGrading: 0 558 | m_BeforeTransparentBundles: [] 559 | m_BeforeStackBundles: [] 560 | m_AfterStackBundles: [] 561 | --- !u!114 &534669908 562 | MonoBehaviour: 563 | m_ObjectHideFlags: 0 564 | m_CorrespondingSourceObject: {fileID: 0} 565 | m_PrefabInstance: {fileID: 0} 566 | m_PrefabAsset: {fileID: 0} 567 | m_GameObject: {fileID: 534669902} 568 | m_Enabled: 1 569 | m_EditorHideFlags: 0 570 | m_Script: {fileID: 11500000, guid: bb5f21faba890f045972b47f98aa72d5, type: 3} 571 | m_Name: 572 | m_EditorClassIdentifier: 573 | world: {fileID: 650665970} 574 | --- !u!1 &650665969 575 | GameObject: 576 | m_ObjectHideFlags: 0 577 | m_CorrespondingSourceObject: {fileID: 0} 578 | m_PrefabInstance: {fileID: 0} 579 | m_PrefabAsset: {fileID: 0} 580 | serializedVersion: 6 581 | m_Component: 582 | - component: {fileID: 650665971} 583 | - component: {fileID: 650665970} 584 | m_Layer: 0 585 | m_Name: World 586 | m_TagString: Untagged 587 | m_Icon: {fileID: 0} 588 | m_NavMeshLayer: 0 589 | m_StaticEditorFlags: 0 590 | m_IsActive: 1 591 | --- !u!114 &650665970 592 | MonoBehaviour: 593 | m_ObjectHideFlags: 0 594 | m_CorrespondingSourceObject: {fileID: 0} 595 | m_PrefabInstance: {fileID: 0} 596 | m_PrefabAsset: {fileID: 0} 597 | m_GameObject: {fileID: 650665969} 598 | m_Enabled: 1 599 | m_EditorHideFlags: 0 600 | m_Script: {fileID: 11500000, guid: 62dd3de82f68bbe478bbc6773cca9ea5, type: 3} 601 | m_Name: 602 | m_EditorClassIdentifier: 603 | worldName: world 604 | chunkPrefab: {fileID: 5440666592941423039, guid: a4b0ff65209415c43b069acc9c1e39dd, 605 | type: 3} 606 | --- !u!4 &650665971 607 | Transform: 608 | m_ObjectHideFlags: 0 609 | m_CorrespondingSourceObject: {fileID: 0} 610 | m_PrefabInstance: {fileID: 0} 611 | m_PrefabAsset: {fileID: 0} 612 | m_GameObject: {fileID: 650665969} 613 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 614 | m_LocalPosition: {x: -1.0713471, y: 1.202103, z: -4.518061} 615 | m_LocalScale: {x: 1, y: 1, z: 1} 616 | m_Children: [] 617 | m_Father: {fileID: 0} 618 | m_RootOrder: 3 619 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 620 | --- !u!1 &851725208 621 | GameObject: 622 | m_ObjectHideFlags: 0 623 | m_CorrespondingSourceObject: {fileID: 0} 624 | m_PrefabInstance: {fileID: 0} 625 | m_PrefabAsset: {fileID: 0} 626 | serializedVersion: 6 627 | m_Component: 628 | - component: {fileID: 851725211} 629 | - component: {fileID: 851725210} 630 | - component: {fileID: 851725209} 631 | m_Layer: 0 632 | m_Name: EventSystem 633 | m_TagString: Untagged 634 | m_Icon: {fileID: 0} 635 | m_NavMeshLayer: 0 636 | m_StaticEditorFlags: 0 637 | m_IsActive: 1 638 | --- !u!114 &851725209 639 | MonoBehaviour: 640 | m_ObjectHideFlags: 0 641 | m_CorrespondingSourceObject: {fileID: 0} 642 | m_PrefabInstance: {fileID: 0} 643 | m_PrefabAsset: {fileID: 0} 644 | m_GameObject: {fileID: 851725208} 645 | m_Enabled: 1 646 | m_EditorHideFlags: 0 647 | m_Script: {fileID: 1077351063, guid: f70555f144d8491a825f0804e09c671c, type: 3} 648 | m_Name: 649 | m_EditorClassIdentifier: 650 | m_HorizontalAxis: Horizontal 651 | m_VerticalAxis: Vertical 652 | m_SubmitButton: Submit 653 | m_CancelButton: Cancel 654 | m_InputActionsPerSecond: 10 655 | m_RepeatDelay: 0.5 656 | m_ForceModuleActive: 0 657 | --- !u!114 &851725210 658 | MonoBehaviour: 659 | m_ObjectHideFlags: 0 660 | m_CorrespondingSourceObject: {fileID: 0} 661 | m_PrefabInstance: {fileID: 0} 662 | m_PrefabAsset: {fileID: 0} 663 | m_GameObject: {fileID: 851725208} 664 | m_Enabled: 1 665 | m_EditorHideFlags: 0 666 | m_Script: {fileID: -619905303, guid: f70555f144d8491a825f0804e09c671c, type: 3} 667 | m_Name: 668 | m_EditorClassIdentifier: 669 | m_FirstSelected: {fileID: 0} 670 | m_sendNavigationEvents: 1 671 | m_DragThreshold: 10 672 | --- !u!4 &851725211 673 | Transform: 674 | m_ObjectHideFlags: 0 675 | m_CorrespondingSourceObject: {fileID: 0} 676 | m_PrefabInstance: {fileID: 0} 677 | m_PrefabAsset: {fileID: 0} 678 | m_GameObject: {fileID: 851725208} 679 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 680 | m_LocalPosition: {x: 0, y: 0, z: 0} 681 | m_LocalScale: {x: 1, y: 1, z: 1} 682 | m_Children: [] 683 | m_Father: {fileID: 0} 684 | m_RootOrder: 1 685 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 686 | --- !u!1 &2086110201 687 | GameObject: 688 | m_ObjectHideFlags: 0 689 | m_CorrespondingSourceObject: {fileID: 0} 690 | m_PrefabInstance: {fileID: 0} 691 | m_PrefabAsset: {fileID: 0} 692 | serializedVersion: 6 693 | m_Component: 694 | - component: {fileID: 2086110202} 695 | - component: {fileID: 2086110204} 696 | - component: {fileID: 2086110203} 697 | m_Layer: 5 698 | m_Name: Crosshair 699 | m_TagString: Untagged 700 | m_Icon: {fileID: 0} 701 | m_NavMeshLayer: 0 702 | m_StaticEditorFlags: 0 703 | m_IsActive: 1 704 | --- !u!224 &2086110202 705 | RectTransform: 706 | m_ObjectHideFlags: 0 707 | m_CorrespondingSourceObject: {fileID: 0} 708 | m_PrefabInstance: {fileID: 0} 709 | m_PrefabAsset: {fileID: 0} 710 | m_GameObject: {fileID: 2086110201} 711 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 712 | m_LocalPosition: {x: 0, y: 0, z: 0} 713 | m_LocalScale: {x: 2, y: 2, z: 2} 714 | m_Children: [] 715 | m_Father: {fileID: 508571603} 716 | m_RootOrder: 0 717 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 718 | m_AnchorMin: {x: 0.5, y: 0.5} 719 | m_AnchorMax: {x: 0.5, y: 0.5} 720 | m_AnchoredPosition: {x: 0, y: 0} 721 | m_SizeDelta: {x: 16, y: 16} 722 | m_Pivot: {x: 0.5, y: 0.5} 723 | --- !u!114 &2086110203 724 | MonoBehaviour: 725 | m_ObjectHideFlags: 0 726 | m_CorrespondingSourceObject: {fileID: 0} 727 | m_PrefabInstance: {fileID: 0} 728 | m_PrefabAsset: {fileID: 0} 729 | m_GameObject: {fileID: 2086110201} 730 | m_Enabled: 1 731 | m_EditorHideFlags: 0 732 | m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} 733 | m_Name: 734 | m_EditorClassIdentifier: 735 | m_Material: {fileID: 0} 736 | m_Color: {r: 1, g: 1, b: 1, a: 0.5882353} 737 | m_RaycastTarget: 0 738 | m_OnCullStateChanged: 739 | m_PersistentCalls: 740 | m_Calls: [] 741 | m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, 742 | Version=1.0.0.0, Culture=neutral, PublicKeyToken=null 743 | m_Sprite: {fileID: 21300000, guid: e96041d3962a4694287f4856ff460f3d, type: 3} 744 | m_Type: 0 745 | m_PreserveAspect: 0 746 | m_FillCenter: 1 747 | m_FillMethod: 4 748 | m_FillAmount: 1 749 | m_FillClockwise: 1 750 | m_FillOrigin: 0 751 | m_UseSpriteMesh: 0 752 | --- !u!222 &2086110204 753 | CanvasRenderer: 754 | m_ObjectHideFlags: 0 755 | m_CorrespondingSourceObject: {fileID: 0} 756 | m_PrefabInstance: {fileID: 0} 757 | m_PrefabAsset: {fileID: 0} 758 | m_GameObject: {fileID: 2086110201} 759 | m_CullTransparentMesh: 0 760 | -------------------------------------------------------------------------------- /Voxel/Assets/Post-Processing Main.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: 8e6292b2c06870d4495f009f912b9600, type: 3} 13 | m_Name: Post-Processing Main 14 | m_EditorClassIdentifier: 15 | settings: 16 | - {fileID: 114062782381184312} 17 | - {fileID: 114335928523954664} 18 | --- !u!114 &114062782381184312 19 | MonoBehaviour: 20 | m_ObjectHideFlags: 3 21 | m_CorrespondingSourceObject: {fileID: 0} 22 | m_PrefabInstance: {fileID: 0} 23 | m_PrefabAsset: {fileID: 0} 24 | m_GameObject: {fileID: 0} 25 | m_Enabled: 1 26 | m_EditorHideFlags: 0 27 | m_Script: {fileID: 11500000, guid: adb84e30e02715445aeb9959894e3b4d, type: 3} 28 | m_Name: ColorGrading 29 | m_EditorClassIdentifier: 30 | active: 1 31 | enabled: 32 | overrideState: 1 33 | value: 1 34 | gradingMode: 35 | overrideState: 1 36 | value: 0 37 | externalLut: 38 | overrideState: 0 39 | value: {fileID: 0} 40 | defaultState: 1 41 | tonemapper: 42 | overrideState: 0 43 | value: 0 44 | toneCurveToeStrength: 45 | overrideState: 0 46 | value: 0 47 | toneCurveToeLength: 48 | overrideState: 0 49 | value: 0.5 50 | toneCurveShoulderStrength: 51 | overrideState: 0 52 | value: 0 53 | toneCurveShoulderLength: 54 | overrideState: 0 55 | value: 0.5 56 | toneCurveShoulderAngle: 57 | overrideState: 0 58 | value: 0 59 | toneCurveGamma: 60 | overrideState: 0 61 | value: 1 62 | ldrLut: 63 | overrideState: 0 64 | value: {fileID: 0} 65 | defaultState: 4 66 | ldrLutContribution: 67 | overrideState: 0 68 | value: 1 69 | temperature: 70 | overrideState: 0 71 | value: 0 72 | tint: 73 | overrideState: 1 74 | value: -10 75 | colorFilter: 76 | overrideState: 1 77 | value: {r: 0.8235294, g: 0.8235294, b: 0.8235294, a: 1} 78 | hueShift: 79 | overrideState: 0 80 | value: 0 81 | saturation: 82 | overrideState: 0 83 | value: 0 84 | brightness: 85 | overrideState: 0 86 | value: 0 87 | postExposure: 88 | overrideState: 0 89 | value: 0 90 | contrast: 91 | overrideState: 0 92 | value: 0 93 | mixerRedOutRedIn: 94 | overrideState: 0 95 | value: 100 96 | mixerRedOutGreenIn: 97 | overrideState: 0 98 | value: 0 99 | mixerRedOutBlueIn: 100 | overrideState: 0 101 | value: 0 102 | mixerGreenOutRedIn: 103 | overrideState: 0 104 | value: 0 105 | mixerGreenOutGreenIn: 106 | overrideState: 0 107 | value: 100 108 | mixerGreenOutBlueIn: 109 | overrideState: 0 110 | value: 0 111 | mixerBlueOutRedIn: 112 | overrideState: 0 113 | value: 0 114 | mixerBlueOutGreenIn: 115 | overrideState: 0 116 | value: 0 117 | mixerBlueOutBlueIn: 118 | overrideState: 0 119 | value: 100 120 | lift: 121 | overrideState: 0 122 | value: {x: 1, y: 1, z: 1, w: 0} 123 | gamma: 124 | overrideState: 0 125 | value: {x: 1, y: 1, z: 1, w: 0} 126 | gain: 127 | overrideState: 0 128 | value: {x: 1, y: 1, z: 1, w: 0} 129 | masterCurve: 130 | overrideState: 0 131 | value: 132 | curve: 133 | serializedVersion: 2 134 | m_Curve: 135 | - serializedVersion: 3 136 | time: 0 137 | value: 0 138 | inSlope: 1 139 | outSlope: 1 140 | tangentMode: 0 141 | weightedMode: 0 142 | inWeight: 0 143 | outWeight: 0 144 | - serializedVersion: 3 145 | time: 1 146 | value: 1 147 | inSlope: 1 148 | outSlope: 1 149 | tangentMode: 0 150 | weightedMode: 0 151 | inWeight: 0 152 | outWeight: 0 153 | m_PreInfinity: 2 154 | m_PostInfinity: 2 155 | m_RotationOrder: 4 156 | m_Loop: 0 157 | m_ZeroValue: 0 158 | m_Range: 1 159 | cachedData: 160 | - 0 161 | - 0.0078125 162 | - 0.015625 163 | - 0.0234375 164 | - 0.03125 165 | - 0.0390625 166 | - 0.046875 167 | - 0.0546875 168 | - 0.0625 169 | - 0.0703125 170 | - 0.078125 171 | - 0.0859375 172 | - 0.09375 173 | - 0.1015625 174 | - 0.109375 175 | - 0.1171875 176 | - 0.125 177 | - 0.1328125 178 | - 0.140625 179 | - 0.1484375 180 | - 0.15625 181 | - 0.1640625 182 | - 0.171875 183 | - 0.1796875 184 | - 0.1875 185 | - 0.1953125 186 | - 0.203125 187 | - 0.2109375 188 | - 0.21875 189 | - 0.2265625 190 | - 0.234375 191 | - 0.2421875 192 | - 0.25 193 | - 0.2578125 194 | - 0.265625 195 | - 0.2734375 196 | - 0.28125 197 | - 0.2890625 198 | - 0.296875 199 | - 0.3046875 200 | - 0.3125 201 | - 0.3203125 202 | - 0.328125 203 | - 0.3359375 204 | - 0.34375 205 | - 0.3515625 206 | - 0.359375 207 | - 0.3671875 208 | - 0.375 209 | - 0.3828125 210 | - 0.390625 211 | - 0.3984375 212 | - 0.40625 213 | - 0.4140625 214 | - 0.421875 215 | - 0.4296875 216 | - 0.4375 217 | - 0.4453125 218 | - 0.453125 219 | - 0.4609375 220 | - 0.46875 221 | - 0.4765625 222 | - 0.484375 223 | - 0.4921875 224 | - 0.5 225 | - 0.5078125 226 | - 0.515625 227 | - 0.5234375 228 | - 0.53125 229 | - 0.5390625 230 | - 0.546875 231 | - 0.5546875 232 | - 0.5625 233 | - 0.5703125 234 | - 0.578125 235 | - 0.5859375 236 | - 0.59375 237 | - 0.6015625 238 | - 0.609375 239 | - 0.6171875 240 | - 0.625 241 | - 0.6328125 242 | - 0.640625 243 | - 0.6484375 244 | - 0.65625 245 | - 0.6640625 246 | - 0.671875 247 | - 0.6796875 248 | - 0.6875 249 | - 0.6953125 250 | - 0.703125 251 | - 0.7109375 252 | - 0.71875 253 | - 0.7265625 254 | - 0.734375 255 | - 0.7421875 256 | - 0.75 257 | - 0.7578125 258 | - 0.765625 259 | - 0.7734375 260 | - 0.78125 261 | - 0.7890625 262 | - 0.796875 263 | - 0.8046875 264 | - 0.8125 265 | - 0.8203125 266 | - 0.828125 267 | - 0.8359375 268 | - 0.84375 269 | - 0.8515625 270 | - 0.859375 271 | - 0.8671875 272 | - 0.875 273 | - 0.8828125 274 | - 0.890625 275 | - 0.8984375 276 | - 0.90625 277 | - 0.9140625 278 | - 0.921875 279 | - 0.9296875 280 | - 0.9375 281 | - 0.9453125 282 | - 0.953125 283 | - 0.9609375 284 | - 0.96875 285 | - 0.9765625 286 | - 0.984375 287 | - 0.9921875 288 | redCurve: 289 | overrideState: 0 290 | value: 291 | curve: 292 | serializedVersion: 2 293 | m_Curve: 294 | - serializedVersion: 3 295 | time: 0 296 | value: 0 297 | inSlope: 1 298 | outSlope: 1 299 | tangentMode: 0 300 | weightedMode: 0 301 | inWeight: 0 302 | outWeight: 0 303 | - serializedVersion: 3 304 | time: 1 305 | value: 1 306 | inSlope: 1 307 | outSlope: 1 308 | tangentMode: 0 309 | weightedMode: 0 310 | inWeight: 0 311 | outWeight: 0 312 | m_PreInfinity: 2 313 | m_PostInfinity: 2 314 | m_RotationOrder: 4 315 | m_Loop: 0 316 | m_ZeroValue: 0 317 | m_Range: 1 318 | cachedData: 319 | - 0 320 | - 0.0078125 321 | - 0.015625 322 | - 0.0234375 323 | - 0.03125 324 | - 0.0390625 325 | - 0.046875 326 | - 0.0546875 327 | - 0.0625 328 | - 0.0703125 329 | - 0.078125 330 | - 0.0859375 331 | - 0.09375 332 | - 0.1015625 333 | - 0.109375 334 | - 0.1171875 335 | - 0.125 336 | - 0.1328125 337 | - 0.140625 338 | - 0.1484375 339 | - 0.15625 340 | - 0.1640625 341 | - 0.171875 342 | - 0.1796875 343 | - 0.1875 344 | - 0.1953125 345 | - 0.203125 346 | - 0.2109375 347 | - 0.21875 348 | - 0.2265625 349 | - 0.234375 350 | - 0.2421875 351 | - 0.25 352 | - 0.2578125 353 | - 0.265625 354 | - 0.2734375 355 | - 0.28125 356 | - 0.2890625 357 | - 0.296875 358 | - 0.3046875 359 | - 0.3125 360 | - 0.3203125 361 | - 0.328125 362 | - 0.3359375 363 | - 0.34375 364 | - 0.3515625 365 | - 0.359375 366 | - 0.3671875 367 | - 0.375 368 | - 0.3828125 369 | - 0.390625 370 | - 0.3984375 371 | - 0.40625 372 | - 0.4140625 373 | - 0.421875 374 | - 0.4296875 375 | - 0.4375 376 | - 0.4453125 377 | - 0.453125 378 | - 0.4609375 379 | - 0.46875 380 | - 0.4765625 381 | - 0.484375 382 | - 0.4921875 383 | - 0.5 384 | - 0.5078125 385 | - 0.515625 386 | - 0.5234375 387 | - 0.53125 388 | - 0.5390625 389 | - 0.546875 390 | - 0.5546875 391 | - 0.5625 392 | - 0.5703125 393 | - 0.578125 394 | - 0.5859375 395 | - 0.59375 396 | - 0.6015625 397 | - 0.609375 398 | - 0.6171875 399 | - 0.625 400 | - 0.6328125 401 | - 0.640625 402 | - 0.6484375 403 | - 0.65625 404 | - 0.6640625 405 | - 0.671875 406 | - 0.6796875 407 | - 0.6875 408 | - 0.6953125 409 | - 0.703125 410 | - 0.7109375 411 | - 0.71875 412 | - 0.7265625 413 | - 0.734375 414 | - 0.7421875 415 | - 0.75 416 | - 0.7578125 417 | - 0.765625 418 | - 0.7734375 419 | - 0.78125 420 | - 0.7890625 421 | - 0.796875 422 | - 0.8046875 423 | - 0.8125 424 | - 0.8203125 425 | - 0.828125 426 | - 0.8359375 427 | - 0.84375 428 | - 0.8515625 429 | - 0.859375 430 | - 0.8671875 431 | - 0.875 432 | - 0.8828125 433 | - 0.890625 434 | - 0.8984375 435 | - 0.90625 436 | - 0.9140625 437 | - 0.921875 438 | - 0.9296875 439 | - 0.9375 440 | - 0.9453125 441 | - 0.953125 442 | - 0.9609375 443 | - 0.96875 444 | - 0.9765625 445 | - 0.984375 446 | - 0.9921875 447 | greenCurve: 448 | overrideState: 0 449 | value: 450 | curve: 451 | serializedVersion: 2 452 | m_Curve: 453 | - serializedVersion: 3 454 | time: 0 455 | value: 0 456 | inSlope: 1 457 | outSlope: 1 458 | tangentMode: 0 459 | weightedMode: 0 460 | inWeight: 0 461 | outWeight: 0 462 | - serializedVersion: 3 463 | time: 1 464 | value: 1 465 | inSlope: 1 466 | outSlope: 1 467 | tangentMode: 0 468 | weightedMode: 0 469 | inWeight: 0 470 | outWeight: 0 471 | m_PreInfinity: 2 472 | m_PostInfinity: 2 473 | m_RotationOrder: 4 474 | m_Loop: 0 475 | m_ZeroValue: 0 476 | m_Range: 1 477 | cachedData: 478 | - 0 479 | - 0.0078125 480 | - 0.015625 481 | - 0.0234375 482 | - 0.03125 483 | - 0.0390625 484 | - 0.046875 485 | - 0.0546875 486 | - 0.0625 487 | - 0.0703125 488 | - 0.078125 489 | - 0.0859375 490 | - 0.09375 491 | - 0.1015625 492 | - 0.109375 493 | - 0.1171875 494 | - 0.125 495 | - 0.1328125 496 | - 0.140625 497 | - 0.1484375 498 | - 0.15625 499 | - 0.1640625 500 | - 0.171875 501 | - 0.1796875 502 | - 0.1875 503 | - 0.1953125 504 | - 0.203125 505 | - 0.2109375 506 | - 0.21875 507 | - 0.2265625 508 | - 0.234375 509 | - 0.2421875 510 | - 0.25 511 | - 0.2578125 512 | - 0.265625 513 | - 0.2734375 514 | - 0.28125 515 | - 0.2890625 516 | - 0.296875 517 | - 0.3046875 518 | - 0.3125 519 | - 0.3203125 520 | - 0.328125 521 | - 0.3359375 522 | - 0.34375 523 | - 0.3515625 524 | - 0.359375 525 | - 0.3671875 526 | - 0.375 527 | - 0.3828125 528 | - 0.390625 529 | - 0.3984375 530 | - 0.40625 531 | - 0.4140625 532 | - 0.421875 533 | - 0.4296875 534 | - 0.4375 535 | - 0.4453125 536 | - 0.453125 537 | - 0.4609375 538 | - 0.46875 539 | - 0.4765625 540 | - 0.484375 541 | - 0.4921875 542 | - 0.5 543 | - 0.5078125 544 | - 0.515625 545 | - 0.5234375 546 | - 0.53125 547 | - 0.5390625 548 | - 0.546875 549 | - 0.5546875 550 | - 0.5625 551 | - 0.5703125 552 | - 0.578125 553 | - 0.5859375 554 | - 0.59375 555 | - 0.6015625 556 | - 0.609375 557 | - 0.6171875 558 | - 0.625 559 | - 0.6328125 560 | - 0.640625 561 | - 0.6484375 562 | - 0.65625 563 | - 0.6640625 564 | - 0.671875 565 | - 0.6796875 566 | - 0.6875 567 | - 0.6953125 568 | - 0.703125 569 | - 0.7109375 570 | - 0.71875 571 | - 0.7265625 572 | - 0.734375 573 | - 0.7421875 574 | - 0.75 575 | - 0.7578125 576 | - 0.765625 577 | - 0.7734375 578 | - 0.78125 579 | - 0.7890625 580 | - 0.796875 581 | - 0.8046875 582 | - 0.8125 583 | - 0.8203125 584 | - 0.828125 585 | - 0.8359375 586 | - 0.84375 587 | - 0.8515625 588 | - 0.859375 589 | - 0.8671875 590 | - 0.875 591 | - 0.8828125 592 | - 0.890625 593 | - 0.8984375 594 | - 0.90625 595 | - 0.9140625 596 | - 0.921875 597 | - 0.9296875 598 | - 0.9375 599 | - 0.9453125 600 | - 0.953125 601 | - 0.9609375 602 | - 0.96875 603 | - 0.9765625 604 | - 0.984375 605 | - 0.9921875 606 | blueCurve: 607 | overrideState: 0 608 | value: 609 | curve: 610 | serializedVersion: 2 611 | m_Curve: 612 | - serializedVersion: 3 613 | time: 0 614 | value: 0 615 | inSlope: 1 616 | outSlope: 1 617 | tangentMode: 0 618 | weightedMode: 0 619 | inWeight: 0 620 | outWeight: 0 621 | - serializedVersion: 3 622 | time: 1 623 | value: 1 624 | inSlope: 1 625 | outSlope: 1 626 | tangentMode: 0 627 | weightedMode: 0 628 | inWeight: 0 629 | outWeight: 0 630 | m_PreInfinity: 2 631 | m_PostInfinity: 2 632 | m_RotationOrder: 4 633 | m_Loop: 0 634 | m_ZeroValue: 0 635 | m_Range: 1 636 | cachedData: 637 | - 0 638 | - 0.0078125 639 | - 0.015625 640 | - 0.0234375 641 | - 0.03125 642 | - 0.0390625 643 | - 0.046875 644 | - 0.0546875 645 | - 0.0625 646 | - 0.0703125 647 | - 0.078125 648 | - 0.0859375 649 | - 0.09375 650 | - 0.1015625 651 | - 0.109375 652 | - 0.1171875 653 | - 0.125 654 | - 0.1328125 655 | - 0.140625 656 | - 0.1484375 657 | - 0.15625 658 | - 0.1640625 659 | - 0.171875 660 | - 0.1796875 661 | - 0.1875 662 | - 0.1953125 663 | - 0.203125 664 | - 0.2109375 665 | - 0.21875 666 | - 0.2265625 667 | - 0.234375 668 | - 0.2421875 669 | - 0.25 670 | - 0.2578125 671 | - 0.265625 672 | - 0.2734375 673 | - 0.28125 674 | - 0.2890625 675 | - 0.296875 676 | - 0.3046875 677 | - 0.3125 678 | - 0.3203125 679 | - 0.328125 680 | - 0.3359375 681 | - 0.34375 682 | - 0.3515625 683 | - 0.359375 684 | - 0.3671875 685 | - 0.375 686 | - 0.3828125 687 | - 0.390625 688 | - 0.3984375 689 | - 0.40625 690 | - 0.4140625 691 | - 0.421875 692 | - 0.4296875 693 | - 0.4375 694 | - 0.4453125 695 | - 0.453125 696 | - 0.4609375 697 | - 0.46875 698 | - 0.4765625 699 | - 0.484375 700 | - 0.4921875 701 | - 0.5 702 | - 0.5078125 703 | - 0.515625 704 | - 0.5234375 705 | - 0.53125 706 | - 0.5390625 707 | - 0.546875 708 | - 0.5546875 709 | - 0.5625 710 | - 0.5703125 711 | - 0.578125 712 | - 0.5859375 713 | - 0.59375 714 | - 0.6015625 715 | - 0.609375 716 | - 0.6171875 717 | - 0.625 718 | - 0.6328125 719 | - 0.640625 720 | - 0.6484375 721 | - 0.65625 722 | - 0.6640625 723 | - 0.671875 724 | - 0.6796875 725 | - 0.6875 726 | - 0.6953125 727 | - 0.703125 728 | - 0.7109375 729 | - 0.71875 730 | - 0.7265625 731 | - 0.734375 732 | - 0.7421875 733 | - 0.75 734 | - 0.7578125 735 | - 0.765625 736 | - 0.7734375 737 | - 0.78125 738 | - 0.7890625 739 | - 0.796875 740 | - 0.8046875 741 | - 0.8125 742 | - 0.8203125 743 | - 0.828125 744 | - 0.8359375 745 | - 0.84375 746 | - 0.8515625 747 | - 0.859375 748 | - 0.8671875 749 | - 0.875 750 | - 0.8828125 751 | - 0.890625 752 | - 0.8984375 753 | - 0.90625 754 | - 0.9140625 755 | - 0.921875 756 | - 0.9296875 757 | - 0.9375 758 | - 0.9453125 759 | - 0.953125 760 | - 0.9609375 761 | - 0.96875 762 | - 0.9765625 763 | - 0.984375 764 | - 0.9921875 765 | hueVsHueCurve: 766 | overrideState: 0 767 | value: 768 | curve: 769 | serializedVersion: 2 770 | m_Curve: [] 771 | m_PreInfinity: 2 772 | m_PostInfinity: 2 773 | m_RotationOrder: 4 774 | m_Loop: 1 775 | m_ZeroValue: 0.5 776 | m_Range: 1 777 | cachedData: 778 | - 0.5 779 | - 0.5 780 | - 0.5 781 | - 0.5 782 | - 0.5 783 | - 0.5 784 | - 0.5 785 | - 0.5 786 | - 0.5 787 | - 0.5 788 | - 0.5 789 | - 0.5 790 | - 0.5 791 | - 0.5 792 | - 0.5 793 | - 0.5 794 | - 0.5 795 | - 0.5 796 | - 0.5 797 | - 0.5 798 | - 0.5 799 | - 0.5 800 | - 0.5 801 | - 0.5 802 | - 0.5 803 | - 0.5 804 | - 0.5 805 | - 0.5 806 | - 0.5 807 | - 0.5 808 | - 0.5 809 | - 0.5 810 | - 0.5 811 | - 0.5 812 | - 0.5 813 | - 0.5 814 | - 0.5 815 | - 0.5 816 | - 0.5 817 | - 0.5 818 | - 0.5 819 | - 0.5 820 | - 0.5 821 | - 0.5 822 | - 0.5 823 | - 0.5 824 | - 0.5 825 | - 0.5 826 | - 0.5 827 | - 0.5 828 | - 0.5 829 | - 0.5 830 | - 0.5 831 | - 0.5 832 | - 0.5 833 | - 0.5 834 | - 0.5 835 | - 0.5 836 | - 0.5 837 | - 0.5 838 | - 0.5 839 | - 0.5 840 | - 0.5 841 | - 0.5 842 | - 0.5 843 | - 0.5 844 | - 0.5 845 | - 0.5 846 | - 0.5 847 | - 0.5 848 | - 0.5 849 | - 0.5 850 | - 0.5 851 | - 0.5 852 | - 0.5 853 | - 0.5 854 | - 0.5 855 | - 0.5 856 | - 0.5 857 | - 0.5 858 | - 0.5 859 | - 0.5 860 | - 0.5 861 | - 0.5 862 | - 0.5 863 | - 0.5 864 | - 0.5 865 | - 0.5 866 | - 0.5 867 | - 0.5 868 | - 0.5 869 | - 0.5 870 | - 0.5 871 | - 0.5 872 | - 0.5 873 | - 0.5 874 | - 0.5 875 | - 0.5 876 | - 0.5 877 | - 0.5 878 | - 0.5 879 | - 0.5 880 | - 0.5 881 | - 0.5 882 | - 0.5 883 | - 0.5 884 | - 0.5 885 | - 0.5 886 | - 0.5 887 | - 0.5 888 | - 0.5 889 | - 0.5 890 | - 0.5 891 | - 0.5 892 | - 0.5 893 | - 0.5 894 | - 0.5 895 | - 0.5 896 | - 0.5 897 | - 0.5 898 | - 0.5 899 | - 0.5 900 | - 0.5 901 | - 0.5 902 | - 0.5 903 | - 0.5 904 | - 0.5 905 | - 0.5 906 | hueVsSatCurve: 907 | overrideState: 0 908 | value: 909 | curve: 910 | serializedVersion: 2 911 | m_Curve: [] 912 | m_PreInfinity: 2 913 | m_PostInfinity: 2 914 | m_RotationOrder: 4 915 | m_Loop: 1 916 | m_ZeroValue: 0.5 917 | m_Range: 1 918 | cachedData: 919 | - 0.5 920 | - 0.5 921 | - 0.5 922 | - 0.5 923 | - 0.5 924 | - 0.5 925 | - 0.5 926 | - 0.5 927 | - 0.5 928 | - 0.5 929 | - 0.5 930 | - 0.5 931 | - 0.5 932 | - 0.5 933 | - 0.5 934 | - 0.5 935 | - 0.5 936 | - 0.5 937 | - 0.5 938 | - 0.5 939 | - 0.5 940 | - 0.5 941 | - 0.5 942 | - 0.5 943 | - 0.5 944 | - 0.5 945 | - 0.5 946 | - 0.5 947 | - 0.5 948 | - 0.5 949 | - 0.5 950 | - 0.5 951 | - 0.5 952 | - 0.5 953 | - 0.5 954 | - 0.5 955 | - 0.5 956 | - 0.5 957 | - 0.5 958 | - 0.5 959 | - 0.5 960 | - 0.5 961 | - 0.5 962 | - 0.5 963 | - 0.5 964 | - 0.5 965 | - 0.5 966 | - 0.5 967 | - 0.5 968 | - 0.5 969 | - 0.5 970 | - 0.5 971 | - 0.5 972 | - 0.5 973 | - 0.5 974 | - 0.5 975 | - 0.5 976 | - 0.5 977 | - 0.5 978 | - 0.5 979 | - 0.5 980 | - 0.5 981 | - 0.5 982 | - 0.5 983 | - 0.5 984 | - 0.5 985 | - 0.5 986 | - 0.5 987 | - 0.5 988 | - 0.5 989 | - 0.5 990 | - 0.5 991 | - 0.5 992 | - 0.5 993 | - 0.5 994 | - 0.5 995 | - 0.5 996 | - 0.5 997 | - 0.5 998 | - 0.5 999 | - 0.5 1000 | - 0.5 1001 | - 0.5 1002 | - 0.5 1003 | - 0.5 1004 | - 0.5 1005 | - 0.5 1006 | - 0.5 1007 | - 0.5 1008 | - 0.5 1009 | - 0.5 1010 | - 0.5 1011 | - 0.5 1012 | - 0.5 1013 | - 0.5 1014 | - 0.5 1015 | - 0.5 1016 | - 0.5 1017 | - 0.5 1018 | - 0.5 1019 | - 0.5 1020 | - 0.5 1021 | - 0.5 1022 | - 0.5 1023 | - 0.5 1024 | - 0.5 1025 | - 0.5 1026 | - 0.5 1027 | - 0.5 1028 | - 0.5 1029 | - 0.5 1030 | - 0.5 1031 | - 0.5 1032 | - 0.5 1033 | - 0.5 1034 | - 0.5 1035 | - 0.5 1036 | - 0.5 1037 | - 0.5 1038 | - 0.5 1039 | - 0.5 1040 | - 0.5 1041 | - 0.5 1042 | - 0.5 1043 | - 0.5 1044 | - 0.5 1045 | - 0.5 1046 | - 0.5 1047 | satVsSatCurve: 1048 | overrideState: 0 1049 | value: 1050 | curve: 1051 | serializedVersion: 2 1052 | m_Curve: [] 1053 | m_PreInfinity: 2 1054 | m_PostInfinity: 2 1055 | m_RotationOrder: 4 1056 | m_Loop: 0 1057 | m_ZeroValue: 0.5 1058 | m_Range: 1 1059 | cachedData: 1060 | - 0.5 1061 | - 0.5 1062 | - 0.5 1063 | - 0.5 1064 | - 0.5 1065 | - 0.5 1066 | - 0.5 1067 | - 0.5 1068 | - 0.5 1069 | - 0.5 1070 | - 0.5 1071 | - 0.5 1072 | - 0.5 1073 | - 0.5 1074 | - 0.5 1075 | - 0.5 1076 | - 0.5 1077 | - 0.5 1078 | - 0.5 1079 | - 0.5 1080 | - 0.5 1081 | - 0.5 1082 | - 0.5 1083 | - 0.5 1084 | - 0.5 1085 | - 0.5 1086 | - 0.5 1087 | - 0.5 1088 | - 0.5 1089 | - 0.5 1090 | - 0.5 1091 | - 0.5 1092 | - 0.5 1093 | - 0.5 1094 | - 0.5 1095 | - 0.5 1096 | - 0.5 1097 | - 0.5 1098 | - 0.5 1099 | - 0.5 1100 | - 0.5 1101 | - 0.5 1102 | - 0.5 1103 | - 0.5 1104 | - 0.5 1105 | - 0.5 1106 | - 0.5 1107 | - 0.5 1108 | - 0.5 1109 | - 0.5 1110 | - 0.5 1111 | - 0.5 1112 | - 0.5 1113 | - 0.5 1114 | - 0.5 1115 | - 0.5 1116 | - 0.5 1117 | - 0.5 1118 | - 0.5 1119 | - 0.5 1120 | - 0.5 1121 | - 0.5 1122 | - 0.5 1123 | - 0.5 1124 | - 0.5 1125 | - 0.5 1126 | - 0.5 1127 | - 0.5 1128 | - 0.5 1129 | - 0.5 1130 | - 0.5 1131 | - 0.5 1132 | - 0.5 1133 | - 0.5 1134 | - 0.5 1135 | - 0.5 1136 | - 0.5 1137 | - 0.5 1138 | - 0.5 1139 | - 0.5 1140 | - 0.5 1141 | - 0.5 1142 | - 0.5 1143 | - 0.5 1144 | - 0.5 1145 | - 0.5 1146 | - 0.5 1147 | - 0.5 1148 | - 0.5 1149 | - 0.5 1150 | - 0.5 1151 | - 0.5 1152 | - 0.5 1153 | - 0.5 1154 | - 0.5 1155 | - 0.5 1156 | - 0.5 1157 | - 0.5 1158 | - 0.5 1159 | - 0.5 1160 | - 0.5 1161 | - 0.5 1162 | - 0.5 1163 | - 0.5 1164 | - 0.5 1165 | - 0.5 1166 | - 0.5 1167 | - 0.5 1168 | - 0.5 1169 | - 0.5 1170 | - 0.5 1171 | - 0.5 1172 | - 0.5 1173 | - 0.5 1174 | - 0.5 1175 | - 0.5 1176 | - 0.5 1177 | - 0.5 1178 | - 0.5 1179 | - 0.5 1180 | - 0.5 1181 | - 0.5 1182 | - 0.5 1183 | - 0.5 1184 | - 0.5 1185 | - 0.5 1186 | - 0.5 1187 | - 0.5 1188 | lumVsSatCurve: 1189 | overrideState: 0 1190 | value: 1191 | curve: 1192 | serializedVersion: 2 1193 | m_Curve: [] 1194 | m_PreInfinity: 2 1195 | m_PostInfinity: 2 1196 | m_RotationOrder: 4 1197 | m_Loop: 0 1198 | m_ZeroValue: 0.5 1199 | m_Range: 1 1200 | cachedData: 1201 | - 0.5 1202 | - 0.5 1203 | - 0.5 1204 | - 0.5 1205 | - 0.5 1206 | - 0.5 1207 | - 0.5 1208 | - 0.5 1209 | - 0.5 1210 | - 0.5 1211 | - 0.5 1212 | - 0.5 1213 | - 0.5 1214 | - 0.5 1215 | - 0.5 1216 | - 0.5 1217 | - 0.5 1218 | - 0.5 1219 | - 0.5 1220 | - 0.5 1221 | - 0.5 1222 | - 0.5 1223 | - 0.5 1224 | - 0.5 1225 | - 0.5 1226 | - 0.5 1227 | - 0.5 1228 | - 0.5 1229 | - 0.5 1230 | - 0.5 1231 | - 0.5 1232 | - 0.5 1233 | - 0.5 1234 | - 0.5 1235 | - 0.5 1236 | - 0.5 1237 | - 0.5 1238 | - 0.5 1239 | - 0.5 1240 | - 0.5 1241 | - 0.5 1242 | - 0.5 1243 | - 0.5 1244 | - 0.5 1245 | - 0.5 1246 | - 0.5 1247 | - 0.5 1248 | - 0.5 1249 | - 0.5 1250 | - 0.5 1251 | - 0.5 1252 | - 0.5 1253 | - 0.5 1254 | - 0.5 1255 | - 0.5 1256 | - 0.5 1257 | - 0.5 1258 | - 0.5 1259 | - 0.5 1260 | - 0.5 1261 | - 0.5 1262 | - 0.5 1263 | - 0.5 1264 | - 0.5 1265 | - 0.5 1266 | - 0.5 1267 | - 0.5 1268 | - 0.5 1269 | - 0.5 1270 | - 0.5 1271 | - 0.5 1272 | - 0.5 1273 | - 0.5 1274 | - 0.5 1275 | - 0.5 1276 | - 0.5 1277 | - 0.5 1278 | - 0.5 1279 | - 0.5 1280 | - 0.5 1281 | - 0.5 1282 | - 0.5 1283 | - 0.5 1284 | - 0.5 1285 | - 0.5 1286 | - 0.5 1287 | - 0.5 1288 | - 0.5 1289 | - 0.5 1290 | - 0.5 1291 | - 0.5 1292 | - 0.5 1293 | - 0.5 1294 | - 0.5 1295 | - 0.5 1296 | - 0.5 1297 | - 0.5 1298 | - 0.5 1299 | - 0.5 1300 | - 0.5 1301 | - 0.5 1302 | - 0.5 1303 | - 0.5 1304 | - 0.5 1305 | - 0.5 1306 | - 0.5 1307 | - 0.5 1308 | - 0.5 1309 | - 0.5 1310 | - 0.5 1311 | - 0.5 1312 | - 0.5 1313 | - 0.5 1314 | - 0.5 1315 | - 0.5 1316 | - 0.5 1317 | - 0.5 1318 | - 0.5 1319 | - 0.5 1320 | - 0.5 1321 | - 0.5 1322 | - 0.5 1323 | - 0.5 1324 | - 0.5 1325 | - 0.5 1326 | - 0.5 1327 | - 0.5 1328 | - 0.5 1329 | --- !u!114 &114335928523954664 1330 | MonoBehaviour: 1331 | m_ObjectHideFlags: 3 1332 | m_CorrespondingSourceObject: {fileID: 0} 1333 | m_PrefabInstance: {fileID: 0} 1334 | m_PrefabAsset: {fileID: 0} 1335 | m_GameObject: {fileID: 0} 1336 | m_Enabled: 1 1337 | m_EditorHideFlags: 0 1338 | m_Script: {fileID: 11500000, guid: 40b924e2dad56384a8df2a1e111bb675, type: 3} 1339 | m_Name: Vignette 1340 | m_EditorClassIdentifier: 1341 | active: 1 1342 | enabled: 1343 | overrideState: 1 1344 | value: 1 1345 | mode: 1346 | overrideState: 1 1347 | value: 0 1348 | color: 1349 | overrideState: 1 1350 | value: {r: 0, g: 0, b: 0, a: 1} 1351 | center: 1352 | overrideState: 1 1353 | value: {x: 0.5, y: 0.5} 1354 | intensity: 1355 | overrideState: 1 1356 | value: 0.35 1357 | smoothness: 1358 | overrideState: 0 1359 | value: 0.2 1360 | roundness: 1361 | overrideState: 0 1362 | value: 1 1363 | rounded: 1364 | overrideState: 0 1365 | value: 0 1366 | mask: 1367 | overrideState: 0 1368 | value: {fileID: 0} 1369 | defaultState: 1 1370 | opacity: 1371 | overrideState: 0 1372 | value: 1 1373 | --------------------------------------------------------------------------------