├── ProjectSettings ├── ProjectVersion.txt ├── ClusterInputManager.asset ├── EditorBuildSettings.asset ├── NetworkManager.asset ├── TimeManager.asset ├── AudioManager.asset ├── EditorSettings.asset ├── TagManager.asset ├── UnityConnectSettings.asset ├── DynamicsManager.asset ├── NavMeshProjectSettings.asset ├── Physics2DSettings.asset ├── GraphicsSettings.asset ├── QualitySettings.asset ├── InputManager.asset └── ProjectSettings.asset ├── Assets ├── Default.unity.meta ├── Scripts.meta └── Scripts │ ├── PathNode.cs │ ├── Path.cs.meta │ ├── PathNode.cs.meta │ ├── MarchingCubes.cs.meta │ ├── MarchingCubesTest.cs.meta │ ├── TestPathGenerator.cs.meta │ ├── DistanceFieldSampler.cs.meta │ ├── Path.cs │ ├── TestPathGenerator.cs │ ├── MarchingCubesTest.cs │ ├── DistanceFieldSampler.cs │ └── MarchingCubes.cs ├── README.md ├── .gitignore └── LICENSE /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 5.5.0b6 2 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Default.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 253b7a7e893abae4fa719f56f609c12b 3 | timeCreated: 1484845653 4 | licenseType: Pro 5 | DefaultImporter: 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PointCloudMeshing 2 | Experimenting with building distance fields of vertical slices of a point cloud, then generating a mesh with marching cubes. 3 | 4 | ![](http://files.facepunch.com/ziks/2017/January/19/2017-01-19_19-52-07.gif) 5 | -------------------------------------------------------------------------------- /Assets/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f858f5def0e5044c9467e66d0bee114 3 | folderAsset: yes 4 | timeCreated: 1484822870 5 | licenseType: Pro 6 | DefaultImporter: 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.33333334 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /Assets/Scripts/PathNode.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | public class PathNode : MonoBehaviour 4 | { 5 | public const float DefaultRadius = 1f / 16f; 6 | 7 | public float Radius = DefaultRadius; 8 | public bool StartPoint; 9 | public Color Color = Color.white; 10 | } -------------------------------------------------------------------------------- /Assets/Scripts/Path.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0c06e203185740b4dae557ee12b55ab5 3 | timeCreated: 1484823042 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/PathNode.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 64cc86b0b93b34a45bd28648ae66df82 3 | timeCreated: 1484822905 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/MarchingCubes.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3eda63d72ebb61c40888936072a23ed8 3 | timeCreated: 1484831063 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/MarchingCubesTest.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1ecafb7e5b50d1047bafc8a874496be7 3 | timeCreated: 1484835026 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/TestPathGenerator.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8a9698a5d276f0e4a9bc0301965b288e 3 | timeCreated: 1484823153 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /Assets/Scripts/DistanceFieldSampler.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9ad2593b0731adb43b56953ac0cf86c2 3 | timeCreated: 1484825723 4 | licenseType: Pro 5 | MonoImporter: 6 | serializedVersion: 2 7 | defaultReferences: [] 8 | executionOrder: 0 9 | icon: {instanceID: 0} 10 | userData: 11 | assetBundleName: 12 | assetBundleVariant: 13 | -------------------------------------------------------------------------------- /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: 0 12 | m_VirtualVoiceCount: 512 13 | m_RealVoiceCount: 32 14 | m_SpatializerPlugin: 15 | m_DisableAudio: 0 16 | m_VirtualizeEffects: 1 17 | -------------------------------------------------------------------------------- /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: 3 7 | m_ExternalVersionControlSupport: Visible Meta Files 8 | m_SerializationMode: 2 9 | m_DefaultBehaviorMode: 0 10 | m_SpritePackerMode: 2 11 | m_SpritePackerPaddingPower: 1 12 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd 13 | m_ProjectGenerationRootNamespace: 14 | m_UserGeneratedProjectSuffix: 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /[Ll]ibrary/ 2 | /[Tt]emp/ 3 | /[Oo]bj/ 4 | /[Bb]uild/ 5 | /[Bb]uilds/ 6 | /Assets/AssetStoreTools* 7 | 8 | # Autogenerated VS/MD solution and project files 9 | ExportedObj/ 10 | *.csproj 11 | *.unityproj 12 | *.sln 13 | *.suo 14 | *.tmp 15 | *.user 16 | *.userprefs 17 | *.pidb 18 | *.booproj 19 | *.svd 20 | 21 | 22 | # Unity3D generated meta files 23 | *.pidb.meta 24 | 25 | # Unity3D Generated File On Crash Reports 26 | sysinfo.txt 27 | 28 | # Builds 29 | *.apk 30 | *.unitypackage 31 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | m_Enabled: 0 7 | m_TestMode: 0 8 | m_TestEventUrl: 9 | m_TestConfigUrl: 10 | CrashReportingSettings: 11 | m_EventUrl: https://perf-events.cloud.unity3d.com/api/events/crashes 12 | m_Enabled: 0 13 | UnityPurchasingSettings: 14 | m_Enabled: 0 15 | m_TestMode: 0 16 | UnityAnalyticsSettings: 17 | m_Enabled: 0 18 | m_InitializeOnStartup: 1 19 | m_TestMode: 0 20 | m_TestEventUrl: 21 | m_TestConfigUrl: 22 | UnityAdsSettings: 23 | m_Enabled: 0 24 | m_InitializeOnStartup: 1 25 | m_TestMode: 0 26 | m_EnabledPlatforms: 4294967295 27 | m_IosGameId: 28 | m_AndroidGameId: 29 | -------------------------------------------------------------------------------- /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: 3 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_EnablePCM: 1 18 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 James King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshProjectSettings.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 | -------------------------------------------------------------------------------- /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: 2 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_MinPenetrationForPenalty: 0.01 17 | m_BaumgarteScale: 0.2 18 | m_BaumgarteTimeOfImpactScale: 0.75 19 | m_TimeToSleep: 0.5 20 | m_LinearSleepTolerance: 0.01 21 | m_AngularSleepTolerance: 2 22 | m_QueriesHitTriggers: 1 23 | m_QueriesStartInColliders: 1 24 | m_ChangeStopsCallbacks: 0 25 | m_AlwaysShowColliders: 0 26 | m_ShowColliderSleep: 1 27 | m_ShowColliderContacts: 0 28 | m_ShowColliderAABB: 0 29 | m_ContactArrowScale: 0.2 30 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 31 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 32 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 33 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 34 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 35 | -------------------------------------------------------------------------------- /Assets/Scripts/Path.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using JetBrains.Annotations; 3 | using UnityEngine; 4 | 5 | public class Path : MonoBehaviour 6 | { 7 | public float CurrentRadius = PathNode.DefaultRadius; 8 | public Color CurrentColor = Color.white; 9 | 10 | private void AddNode( Vector3 pos, bool startPoint ) 11 | { 12 | var node = new GameObject( "Node " + transform.childCount, typeof(PathNode) ) 13 | .GetComponent(); 14 | 15 | node.StartPoint = startPoint; 16 | node.Radius = CurrentRadius; 17 | node.Color = CurrentColor; 18 | node.transform.SetParent( transform, false ); 19 | node.transform.localPosition = pos; 20 | } 21 | 22 | public void Clear() 23 | { 24 | foreach ( var node in transform.GetComponentsInChildren() ) 25 | { 26 | DestroyImmediate( node.gameObject ); 27 | } 28 | } 29 | 30 | public void MoveTo( float x, float y, float z ) 31 | { 32 | AddNode( new Vector3( x, y, z ), true ); 33 | } 34 | 35 | public void LineTo( float x, float y, float z ) 36 | { 37 | AddNode( new Vector3( x, y, z ), false ); 38 | } 39 | 40 | public void GetVertices( List dest ) 41 | { 42 | var pathNodes = GetComponentsInChildren(); 43 | foreach ( var pathNode in pathNodes ) 44 | { 45 | dest.Add( new DistanceFieldSampler.Vertex(pathNode) ); 46 | } 47 | } 48 | 49 | [UsedImplicitly] 50 | private void OnDrawGizmos() 51 | { 52 | var nodes = transform.GetComponentsInChildren(); 53 | if ( nodes.Length < 2 ) return; 54 | 55 | var prev = nodes[nodes.Length - 1]; 56 | foreach ( var next in nodes ) 57 | { 58 | if ( !next.StartPoint ) 59 | { 60 | Gizmos.color = Color.Lerp( prev.Color, next.Color, 0.5f ); 61 | Gizmos.DrawLine( prev.transform.position, next.transform.position ); 62 | } 63 | 64 | prev = next; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Assets/Scripts/TestPathGenerator.cs: -------------------------------------------------------------------------------- 1 | using JetBrains.Annotations; 2 | using UnityEngine; 3 | 4 | [ExecuteInEditMode] 5 | public class TestPathGenerator : MonoBehaviour 6 | { 7 | public bool Regenerate = false; 8 | 9 | [UsedImplicitly] 10 | private void Update() 11 | { 12 | if ( !Regenerate ) return; 13 | Regenerate = false; 14 | 15 | var path = GetComponent(); 16 | path.Clear(); 17 | 18 | const float thickness = 0.125f; 19 | 20 | path.CurrentRadius = PathNode.DefaultRadius; 21 | 22 | for ( var j = 0; j < 8; ++j ) 23 | { 24 | var y = j * path.CurrentRadius; 25 | 26 | path.CurrentColor = Color.white; 27 | 28 | path.MoveTo( 0f, y, 0f ); 29 | path.LineTo( 1f, y, 0f ); 30 | path.LineTo( 1f, y, 1f ); 31 | path.LineTo( 0f, y, 1f ); 32 | path.LineTo( 0f, y, PathNode.DefaultRadius ); 33 | 34 | path.MoveTo( thickness, y, thickness ); 35 | path.LineTo( 1f - thickness, y, thickness ); 36 | path.LineTo( 1f - thickness, y, 0.5f ); 37 | path.LineTo( 0.5f, y, 0.5f ); 38 | path.LineTo( thickness, y, 1f - thickness ); 39 | path.LineTo( thickness, y, thickness + PathNode.DefaultRadius ); 40 | 41 | path.CurrentColor = Color.red; 42 | 43 | path.MoveTo( 1f - thickness * 0.5f, y, 0.5f ); 44 | path.LineTo( 1f - thickness * 0.5f, y, thickness * 0.5f ); 45 | path.LineTo( thickness * 0.5f, y, thickness * 0.5f ); 46 | path.LineTo( thickness * 0.5f, y, 1f - thickness * 0.5f ); 47 | path.LineTo( 1f - thickness * 0.5f, y, 1f - thickness * 0.5f ); 48 | 49 | for ( var i = 1; i < 4; ++i ) 50 | { 51 | path.LineTo( 1f - thickness * 0.5f, y, 1f - i * thickness ); 52 | path.LineTo( i * thickness + thickness * 0.707f, y, 1f - i * thickness ); 53 | path.LineTo( (i + 0.5f) * thickness + thickness * 0.707f, y, 1f - (i + 0.5f) * thickness ); 54 | path.LineTo( 1 - thickness * 0.5f, y, 1f - (i + 0.5f) * thickness ); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /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: 9 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: 10782, guid: 0000000000000000f000000000000000, type: 0} 39 | m_PreloadedShaders: [] 40 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, 41 | type: 0} 42 | m_TierSettings_Tier1: 43 | renderingPath: 1 44 | useCascadedShadowMaps: 1 45 | m_TierSettings_Tier2: 46 | renderingPath: 1 47 | useCascadedShadowMaps: 1 48 | m_TierSettings_Tier3: 49 | renderingPath: 1 50 | useCascadedShadowMaps: 1 51 | m_DefaultRenderingPath: 1 52 | m_DefaultMobileRenderingPath: 1 53 | m_TierSettings: [] 54 | m_LightmapStripping: 0 55 | m_FogStripping: 0 56 | m_LightmapKeepPlain: 1 57 | m_LightmapKeepDirCombined: 1 58 | m_LightmapKeepDirSeparate: 1 59 | m_LightmapKeepDynamicPlain: 1 60 | m_LightmapKeepDynamicDirCombined: 1 61 | m_LightmapKeepDynamicDirSeparate: 1 62 | m_FogKeepLinear: 1 63 | m_FogKeepExp: 1 64 | m_FogKeepExp2: 1 65 | -------------------------------------------------------------------------------- /Assets/Scripts/MarchingCubesTest.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using JetBrains.Annotations; 4 | using UnityEngine; 5 | 6 | [ExecuteInEditMode, RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))] 7 | public class MarchingCubesTest : MonoBehaviour 8 | { 9 | public Path Path; 10 | 11 | [Range(0f, 1f)] 12 | public float Threshold = 0.5f; 13 | 14 | public Vector3 CaptureVolume = Vector3.one; 15 | 16 | public int DistanceFieldResolution = 32; 17 | public int VerticalResolution = 16; 18 | 19 | public bool UpdateMesh; 20 | 21 | [UsedImplicitly] 22 | private void Update() 23 | { 24 | if ( UpdateMesh ) 25 | { 26 | RebuildMesh(); 27 | } 28 | } 29 | 30 | [ThreadStatic] private static MarchingCubes _sCubes; 31 | [ThreadStatic] private static float[] _sBufferA; 32 | [ThreadStatic] private static float[] _sBufferB; 33 | [ThreadStatic] private static List _sVertices; 34 | 35 | private void RebuildMesh() 36 | { 37 | if ( Path == null ) return; 38 | 39 | var bufferSize = DistanceFieldResolution * DistanceFieldResolution; 40 | 41 | if ( _sBufferA == null || _sBufferA.Length < bufferSize ) 42 | { 43 | _sBufferA = new float[bufferSize]; 44 | _sBufferB = new float[bufferSize]; 45 | } 46 | 47 | if ( _sCubes == null ) _sCubes = new MarchingCubes(); 48 | else _sCubes.Clear(); 49 | 50 | if ( _sVertices == null ) _sVertices = new List(); 51 | else _sVertices.Clear(); 52 | 53 | Path.GetVertices( _sVertices ); 54 | 55 | _sCubes.Threshold = Threshold; 56 | _sCubes.CubeSize = new Vector3( 57 | CaptureVolume.x / DistanceFieldResolution, 58 | CaptureVolume.y / VerticalResolution, 59 | CaptureVolume.z / DistanceFieldResolution ); 60 | 61 | var origin = transform.position; 62 | var size = new Vector2( CaptureVolume.x, CaptureVolume.z ); 63 | 64 | var last = _sBufferA; 65 | var next = _sBufferB; 66 | 67 | var values = new float[8]; 68 | 69 | DistanceFieldSampler.SampleDistanceField( _sVertices, origin, size, DistanceFieldResolution, last ); 70 | for ( var yb = 1; yb < VerticalResolution; ++yb ) 71 | { 72 | var ya = yb - 1; 73 | 74 | var offset = new Vector3( 0f, (float) yb / VerticalResolution, 0f ); 75 | DistanceFieldSampler.SampleDistanceField( _sVertices, origin + offset, size, DistanceFieldResolution, next ); 76 | 77 | for ( var zb = 1; zb < DistanceFieldResolution; ++zb ) 78 | { 79 | var za = zb - 1; 80 | for ( var xb = 1; xb < DistanceFieldResolution; ++xb ) 81 | { 82 | var xa = xb - 1; 83 | 84 | values[0] = last[xa + za * DistanceFieldResolution]; 85 | values[1] = last[xb + za * DistanceFieldResolution]; 86 | values[2] = next[xa + za * DistanceFieldResolution]; 87 | values[3] = next[xb + za * DistanceFieldResolution]; 88 | values[4] = last[xa + zb * DistanceFieldResolution]; 89 | values[5] = last[xb + zb * DistanceFieldResolution]; 90 | values[6] = next[xa + zb * DistanceFieldResolution]; 91 | values[7] = next[xb + zb * DistanceFieldResolution]; 92 | 93 | _sCubes.MoveToCube( xa, ya, za ); 94 | _sCubes.Write( values ); 95 | } 96 | } 97 | 98 | var temp = last; 99 | last = next; 100 | next = temp; 101 | } 102 | 103 | var meshFilter = this.GetComponent(); 104 | 105 | if ( meshFilter.sharedMesh == null ) 106 | { 107 | meshFilter.sharedMesh = new Mesh(); 108 | } 109 | 110 | _sCubes.CopyToMesh( meshFilter.sharedMesh ); 111 | } 112 | 113 | [UsedImplicitly] 114 | private void OnDrawGizmos() 115 | { 116 | Gizmos.matrix = transform.localToWorldMatrix; 117 | 118 | var xs = CaptureVolume.x; 119 | var ys = CaptureVolume.y; 120 | var zs = CaptureVolume.z; 121 | 122 | Gizmos.color = Color.green; 123 | Gizmos.DrawLine( new Vector3(0f, 0f, 0f), new Vector3(xs, 0f, 0f)); 124 | Gizmos.DrawLine( new Vector3(0f, 0f, 0f), new Vector3(0f, ys, 0f)); 125 | Gizmos.DrawLine( new Vector3(0f, 0f, 0f), new Vector3(0f, 0f, zs)); 126 | Gizmos.DrawLine( new Vector3(xs, 0f, 0f), new Vector3(xs, ys, 0f)); 127 | Gizmos.DrawLine( new Vector3(xs, 0f, 0f), new Vector3(xs, 0f, zs)); 128 | Gizmos.DrawLine( new Vector3(0f, ys, 0f), new Vector3(xs, ys, 0f)); 129 | Gizmos.DrawLine( new Vector3(0f, ys, 0f), new Vector3(0f, ys, zs)); 130 | Gizmos.DrawLine( new Vector3(0f, 0f, zs), new Vector3(xs, 0f, zs)); 131 | Gizmos.DrawLine( new Vector3(0f, 0f, zs), new Vector3(0f, ys, zs)); 132 | Gizmos.DrawLine( new Vector3(xs, ys, 0f), new Vector3(xs, ys, zs)); 133 | Gizmos.DrawLine( new Vector3(xs, 0f, zs), new Vector3(xs, ys, zs)); 134 | Gizmos.DrawLine( new Vector3(0f, ys, zs), new Vector3(xs, ys, zs)); 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 5 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Fastest 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 15 17 | shadowNearPlaneOffset: 2 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | blendWeights: 1 21 | textureQuality: 1 22 | anisotropicTextures: 0 23 | antiAliasing: 0 24 | softParticles: 0 25 | softVegetation: 0 26 | realtimeReflectionProbes: 0 27 | billboardsFaceCameraPosition: 0 28 | vSyncCount: 0 29 | lodBias: 0.3 30 | maximumLODLevel: 0 31 | particleRaycastBudget: 4 32 | asyncUploadTimeSlice: 2 33 | asyncUploadBufferSize: 4 34 | excludedTargetPlatforms: [] 35 | - serializedVersion: 2 36 | name: Fast 37 | pixelLightCount: 0 38 | shadows: 0 39 | shadowResolution: 0 40 | shadowProjection: 1 41 | shadowCascades: 1 42 | shadowDistance: 20 43 | shadowNearPlaneOffset: 2 44 | shadowCascade2Split: 0.33333334 45 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 46 | blendWeights: 2 47 | textureQuality: 0 48 | anisotropicTextures: 0 49 | antiAliasing: 0 50 | softParticles: 0 51 | softVegetation: 0 52 | realtimeReflectionProbes: 0 53 | billboardsFaceCameraPosition: 0 54 | vSyncCount: 0 55 | lodBias: 0.4 56 | maximumLODLevel: 0 57 | particleRaycastBudget: 16 58 | asyncUploadTimeSlice: 2 59 | asyncUploadBufferSize: 4 60 | excludedTargetPlatforms: [] 61 | - serializedVersion: 2 62 | name: Simple 63 | pixelLightCount: 1 64 | shadows: 1 65 | shadowResolution: 0 66 | shadowProjection: 1 67 | shadowCascades: 1 68 | shadowDistance: 20 69 | shadowNearPlaneOffset: 2 70 | shadowCascade2Split: 0.33333334 71 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 72 | blendWeights: 2 73 | textureQuality: 0 74 | anisotropicTextures: 1 75 | antiAliasing: 0 76 | softParticles: 0 77 | softVegetation: 0 78 | realtimeReflectionProbes: 0 79 | billboardsFaceCameraPosition: 0 80 | vSyncCount: 1 81 | lodBias: 0.7 82 | maximumLODLevel: 0 83 | particleRaycastBudget: 64 84 | asyncUploadTimeSlice: 2 85 | asyncUploadBufferSize: 4 86 | excludedTargetPlatforms: [] 87 | - serializedVersion: 2 88 | name: Good 89 | pixelLightCount: 2 90 | shadows: 2 91 | shadowResolution: 1 92 | shadowProjection: 1 93 | shadowCascades: 2 94 | shadowDistance: 40 95 | shadowNearPlaneOffset: 2 96 | shadowCascade2Split: 0.33333334 97 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 98 | blendWeights: 2 99 | textureQuality: 0 100 | anisotropicTextures: 1 101 | antiAliasing: 0 102 | softParticles: 0 103 | softVegetation: 1 104 | realtimeReflectionProbes: 1 105 | billboardsFaceCameraPosition: 1 106 | vSyncCount: 1 107 | lodBias: 1 108 | maximumLODLevel: 0 109 | particleRaycastBudget: 256 110 | asyncUploadTimeSlice: 2 111 | asyncUploadBufferSize: 4 112 | excludedTargetPlatforms: [] 113 | - serializedVersion: 2 114 | name: Beautiful 115 | pixelLightCount: 3 116 | shadows: 2 117 | shadowResolution: 2 118 | shadowProjection: 1 119 | shadowCascades: 2 120 | shadowDistance: 70 121 | shadowNearPlaneOffset: 2 122 | shadowCascade2Split: 0.33333334 123 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 124 | blendWeights: 4 125 | textureQuality: 0 126 | anisotropicTextures: 2 127 | antiAliasing: 2 128 | softParticles: 1 129 | softVegetation: 1 130 | realtimeReflectionProbes: 1 131 | billboardsFaceCameraPosition: 1 132 | vSyncCount: 1 133 | lodBias: 1.5 134 | maximumLODLevel: 0 135 | particleRaycastBudget: 1024 136 | asyncUploadTimeSlice: 2 137 | asyncUploadBufferSize: 4 138 | excludedTargetPlatforms: [] 139 | - serializedVersion: 2 140 | name: Fantastic 141 | pixelLightCount: 4 142 | shadows: 2 143 | shadowResolution: 2 144 | shadowProjection: 1 145 | shadowCascades: 4 146 | shadowDistance: 150 147 | shadowNearPlaneOffset: 2 148 | shadowCascade2Split: 0.33333334 149 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 150 | blendWeights: 4 151 | textureQuality: 0 152 | anisotropicTextures: 2 153 | antiAliasing: 2 154 | softParticles: 1 155 | softVegetation: 1 156 | realtimeReflectionProbes: 1 157 | billboardsFaceCameraPosition: 1 158 | vSyncCount: 1 159 | lodBias: 2 160 | maximumLODLevel: 0 161 | particleRaycastBudget: 4096 162 | asyncUploadTimeSlice: 2 163 | asyncUploadBufferSize: 4 164 | excludedTargetPlatforms: [] 165 | m_PerPlatformDefaultQuality: 166 | Android: 2 167 | Nintendo 3DS: 5 168 | PS4: 5 169 | PSM: 5 170 | PSP2: 2 171 | Samsung TV: 2 172 | Standalone: 5 173 | Tizen: 2 174 | Web: 5 175 | WebGL: 3 176 | WiiU: 5 177 | Windows Store Apps: 5 178 | XboxOne: 5 179 | iPhone: 2 180 | tvOS: 5 181 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /Assets/Scripts/DistanceFieldSampler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using JetBrains.Annotations; 4 | using UnityEngine; 5 | 6 | [ExecuteInEditMode] 7 | public class DistanceFieldSampler : MonoBehaviour 8 | { 9 | #region Unity Junk 10 | public Path Path; 11 | public Texture2D Result; 12 | public int Resolution = 128; 13 | 14 | private Vector2 _lastSampleSize; 15 | private Vector3 _lastSampledPosition; 16 | 17 | private Vector2 SampleSize 18 | { 19 | get 20 | { 21 | var scale = transform.lossyScale; 22 | return new Vector2( scale.x, scale.y ); 23 | } 24 | } 25 | 26 | private bool NeedsUpdate 27 | { 28 | get 29 | { 30 | if ( Path == null ) return false; 31 | return Result == null || Result.width != Resolution || _lastSampledPosition != transform.position 32 | || Math.Abs( _lastSampleSize.x - SampleSize.x ) > float.Epsilon 33 | || Math.Abs( _lastSampleSize.y - SampleSize.y ) > float.Epsilon; 34 | } 35 | } 36 | #endregion 37 | 38 | /// 39 | /// Represents a point along a path. 40 | /// 41 | public struct Vertex 42 | { 43 | /// 44 | /// Position in 3D space of the vertex. 45 | /// 46 | public readonly Vector3 Pos; 47 | 48 | /// 49 | /// Radius of the line segment starting at this vertex. 50 | /// 51 | public readonly float Radius; 52 | 53 | /// 54 | /// If true, this vertex has no edge preceding it. 55 | /// 56 | public readonly bool StartPoint; 57 | 58 | public Vertex( Vector3 pos, float radius, bool start ) 59 | { 60 | Pos = pos; 61 | Radius = radius; 62 | StartPoint = start; 63 | } 64 | 65 | public Vertex( PathNode node ) 66 | { 67 | Pos = node.transform.position; 68 | Radius = node.Radius; 69 | StartPoint = node.StartPoint; 70 | } 71 | } 72 | 73 | /// 74 | /// A pair of vertices that define a line segment. 75 | /// 76 | private struct Edge 77 | { 78 | /// 79 | /// Start vertex of the line segment. 80 | /// 81 | public readonly Vertex First; 82 | 83 | /// 84 | /// End vertex of the line segment. 85 | /// 86 | public readonly Vertex Second; 87 | 88 | public Edge( Vertex first, Vertex second ) 89 | { 90 | First = first; 91 | Second = second; 92 | } 93 | } 94 | 95 | [ThreadStatic] private static List _sNearbyEdges; 96 | 97 | /// 98 | /// Find a list of edgest from the given vertex list that will possibly intesect with the 99 | /// given rectangle, defined by it's vertical position (), and 100 | /// minimum and maximum X and Z bounds ( and ). 101 | /// 102 | /// List of vertices to search through/ 103 | /// Vertical position of the rectangle to find edges near to. 104 | /// Minimum X and Z coordinates of the rectangle. 105 | /// Maximum X and Z coordinates of the rectangle. 106 | /// List to append the results to. 107 | private static void FindNearbyEdges( List path, float layerPos, Vector2 min, Vector2 max, List outEdges ) 108 | { 109 | var prev = path[path.Count - 1]; 110 | foreach ( var next in path ) 111 | { 112 | if ( !next.StartPoint ) 113 | { 114 | var edge = new Edge( prev, next ); 115 | if ( IsEdgeNearSampleRange( ref edge, layerPos, min, max ) ) 116 | { 117 | outEdges.Add( edge ); 118 | } 119 | } 120 | 121 | prev = next; 122 | } 123 | } 124 | 125 | private static bool IsEdgeNearSampleRange( ref Edge edge, float layerPos, Vector2 min, Vector2 max ) 126 | { 127 | // Check if completely above 128 | if ( edge.First.Pos.y - edge.First.Radius > layerPos && edge.Second.Pos.y - edge.First.Radius > layerPos ) return false; 129 | 130 | // Check if completely below 131 | if ( edge.First.Pos.y + edge.First.Radius < layerPos && edge.Second.Pos.y + edge.First.Radius < layerPos ) return false; 132 | 133 | // TODO: Check if edge is outside of the square. 134 | return true; 135 | } 136 | 137 | private static float GetDistance( Vector3 samplePos, Edge edge ) 138 | { 139 | var ap = samplePos - edge.First.Pos; 140 | var bp = samplePos - edge.Second.Pos; 141 | var ab = edge.Second.Pos - edge.First.Pos; 142 | 143 | if ( Vector3.Dot( ap, ab ) < 0f ) return ap.magnitude; 144 | if ( Vector3.Dot( bp, ab ) > 0f ) return bp.magnitude; 145 | 146 | return Mathf.Sqrt( Vector3.Cross( ap, bp ).sqrMagnitude / ab.sqrMagnitude ); 147 | } 148 | 149 | private static float DistanceToDistanceScore( float distance, float radius ) 150 | { 151 | return Mathf.Clamp01( 1f - distance * 0.5f / radius ); 152 | } 153 | 154 | private static float GetDistanceScore( Vector3 samplePos, List edges ) 155 | { 156 | var score = 0f; 157 | 158 | foreach ( var edge in edges ) 159 | { 160 | score = Math.Max( score, DistanceToDistanceScore( GetDistance( samplePos, edge ), edge.First.Radius ) ); 161 | } 162 | 163 | return score; 164 | } 165 | 166 | public static void SampleDistanceField( List path, Vector3 origin, Vector2 size, int resolution, float[] outSamples ) 167 | { 168 | if ( outSamples.Length < resolution * resolution ) 169 | { 170 | throw new ArgumentException("Expected outSamples to be at least " + resolution * resolution + " in length."); 171 | } 172 | 173 | Array.Clear( outSamples, 0, resolution * resolution ); 174 | 175 | if ( path.Count < 2 ) return; 176 | 177 | var layerPos = origin.y; 178 | var min = new Vector2( origin.x, origin.z ); 179 | var max = min + size; 180 | 181 | if ( _sNearbyEdges == null ) _sNearbyEdges = new List(); 182 | else _sNearbyEdges.Clear(); 183 | 184 | FindNearbyEdges( path, layerPos, min, max, _sNearbyEdges ); 185 | 186 | for ( var row = 0; row < resolution; ++row ) 187 | { 188 | var z = row * (max.y - min.y) / resolution + min.y; 189 | for ( var col = 0; col < resolution; ++col ) 190 | { 191 | var x = col * (max.x - min.x) / resolution + min.x; 192 | var pos = new Vector3( x, layerPos, z ); 193 | 194 | outSamples[col + row * resolution] = GetDistanceScore( pos, _sNearbyEdges ); 195 | } 196 | } 197 | } 198 | 199 | [ThreadStatic] private static float[] _sBuffer; 200 | [ThreadStatic] private static Color[] _sColors; 201 | [ThreadStatic] private static List _sPath; 202 | 203 | [UsedImplicitly] 204 | private void Update() 205 | { 206 | if ( !NeedsUpdate ) return; 207 | 208 | _lastSampledPosition = transform.position; 209 | _lastSampleSize = SampleSize; 210 | 211 | if ( Result == null ) 212 | { 213 | Result = new Texture2D( Resolution, Resolution, TextureFormat.RGB24, false ); 214 | } 215 | else if ( Resolution != Result.width ) 216 | { 217 | Result.Resize( Resolution, Resolution, TextureFormat.RGB24, false ); 218 | } 219 | 220 | if ( _sPath == null ) _sPath = new List(); 221 | else _sPath.Clear(); 222 | 223 | Path.GetVertices( _sPath ); 224 | 225 | if ( _sBuffer == null || _sBuffer.Length < Resolution * Resolution ) 226 | { 227 | _sBuffer = new float[Resolution * Resolution]; 228 | _sColors = new Color[Resolution * Resolution]; 229 | } 230 | 231 | var origin = _lastSampledPosition - new Vector3( _lastSampleSize.x * 0.5f, 0f, _lastSampleSize.y * 0.5f ); 232 | SampleDistanceField( _sPath, origin, _lastSampleSize, Resolution, _sBuffer ); 233 | 234 | for ( var i = 0; i < Resolution * Resolution; ++i ) 235 | { 236 | var value = _sBuffer[i]; 237 | _sColors[i] = new Color( value, value, value, 1f ); 238 | } 239 | 240 | Result.SetPixels( _sColors ); 241 | Result.Apply( false ); 242 | 243 | var meshRenderer = GetComponent(); 244 | if ( meshRenderer != null ) 245 | { 246 | meshRenderer.sharedMaterial.mainTexture = Result; 247 | } 248 | } 249 | } 250 | -------------------------------------------------------------------------------- /Assets/Scripts/MarchingCubes.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using UnityEngine; 6 | using UnityEngine.Assertions; 7 | 8 | public class MarchingCubes 9 | { 10 | private static string VertexIndexToString( int index ) 11 | { 12 | return string.Format( "{0}:{1}:{2}", index & 1, (index >> 1) & 1, (index >> 2) & 1 ); 13 | } 14 | 15 | private class MarchingCubesCase 16 | { 17 | private struct Vertex : IEquatable 18 | { 19 | public readonly int A; 20 | public readonly int B; 21 | 22 | public Vertex( int a, int b ) 23 | { 24 | A = a; 25 | B = b; 26 | } 27 | 28 | public override string ToString() 29 | { 30 | return string.Format( "{{{0}, {1}}}", VertexIndexToString( A ), VertexIndexToString( B ) ); 31 | } 32 | 33 | public override bool Equals( object obj ) 34 | { 35 | if ( ReferenceEquals( null, obj ) ) return false; 36 | return obj is Vertex && Equals( (Vertex) obj ); 37 | } 38 | 39 | public bool Equals( Vertex other ) 40 | { 41 | return A == other.A && B == other.B; 42 | } 43 | 44 | public override int GetHashCode() 45 | { 46 | unchecked 47 | { 48 | return (A * 397) ^ B; 49 | } 50 | } 51 | } 52 | 53 | private struct Edge : IEquatable 54 | { 55 | public readonly Vertex A; 56 | public readonly Vertex B; 57 | 58 | public bool IsValid { get { return !A.Equals( B ); } } 59 | public Edge Reverse { get { return new Edge( B, A ); } } 60 | 61 | public Edge( Vertex a, Vertex b ) 62 | { 63 | A = a; 64 | B = b; 65 | } 66 | 67 | public override string ToString() 68 | { 69 | return string.Format( "({0}, {1})", A, B ); 70 | } 71 | 72 | public bool Equals( Edge other ) 73 | { 74 | return A.Equals( other.A ) && B.Equals( other.B ); 75 | } 76 | 77 | public override bool Equals( object obj ) 78 | { 79 | if ( ReferenceEquals( null, obj ) ) return false; 80 | return obj is Edge && Equals( (Edge) obj ); 81 | } 82 | 83 | public override int GetHashCode() 84 | { 85 | unchecked 86 | { 87 | return (A.GetHashCode() * 397) ^ B.GetHashCode(); 88 | } 89 | } 90 | } 91 | 92 | private struct Triangle 93 | { 94 | public readonly int A; 95 | public readonly int B; 96 | public readonly int C; 97 | 98 | public Triangle( int a, int b, int c ) 99 | { 100 | A = a; 101 | B = b; 102 | C = c; 103 | } 104 | 105 | public override string ToString() 106 | { 107 | return string.Format( "({0}, {1}, {2})", A, B, C ); 108 | } 109 | } 110 | 111 | private static readonly Vector3[] _sVectorLookup = 112 | { 113 | new Vector3(0f, 0f, 0f), 114 | new Vector3(1f, 0f, 0f), 115 | new Vector3(0f, 1f, 0f), 116 | new Vector3(1f, 1f, 0f), 117 | new Vector3(0f, 0f, 1f), 118 | new Vector3(1f, 0f, 1f), 119 | new Vector3(0f, 1f, 1f), 120 | new Vector3(1f, 1f, 1f) 121 | }; 122 | 123 | private readonly Vertex[] _vertices; 124 | private readonly Edge[] _edges; 125 | private readonly Triangle[] _triangles; 126 | 127 | public MarchingCubesCase( bool[] corners ) 128 | { 129 | var verts = new List(); 130 | var faces = new List[6]; 131 | 132 | for ( var i = 0; i < 6; ++i ) faces[i] = new List(); 133 | for ( var i = 0; i < 8; ++i ) 134 | { 135 | var x = i ^ 0x1; 136 | var y = i ^ 0x2; 137 | var z = i ^ 0x4; 138 | 139 | Vertex vert; 140 | 141 | if ( corners[i] && !corners[x] ) 142 | { 143 | verts.Add( vert = new Vertex( i, x ) ); 144 | faces[(i & 0x2) == 0 ? 2 : 3].Add( vert ); 145 | faces[(i & 0x4) == 0 ? 4 : 5].Add( vert ); 146 | } 147 | if ( corners[i] && !corners[y] ) 148 | { 149 | verts.Add( vert = new Vertex( i, y ) ); 150 | faces[(i & 0x1) == 0 ? 0 : 1].Add( vert ); 151 | faces[(i & 0x4) == 0 ? 4 : 5].Add( vert ); 152 | } 153 | if ( corners[i] && !corners[z] ) 154 | { 155 | verts.Add( vert = new Vertex( i, z ) ); 156 | faces[(i & 0x1) == 0 ? 0 : 1].Add( vert ); 157 | faces[(i & 0x2) == 0 ? 2 : 3].Add( vert ); 158 | } 159 | } 160 | 161 | _vertices = verts.ToArray(); 162 | 163 | var edges = new List(); 164 | for ( var i = 0; i < 6; ++i ) 165 | { 166 | var face = faces[i]; 167 | if ( face.Count == 0 ) continue; 168 | if ( face.Count == 2 ) 169 | { 170 | edges.Add( new Edge( face[0], face[1] ) ); 171 | continue; 172 | } 173 | 174 | for ( var j = 0; j < face.Count - 1; ++j ) 175 | for ( var k = j + 1; k < face.Count; ++k ) 176 | { 177 | var a = face[j]; 178 | var b = face[k]; 179 | 180 | switch ( a.A ^ b.A ) 181 | { 182 | case 0x0: 183 | case 0x1: 184 | case 0x2: 185 | case 0x4: 186 | edges.Add( new Edge( a, b ) ); 187 | break; 188 | } 189 | } 190 | } 191 | 192 | var sortedEdges = new List(); 193 | var triangles = new List(); 194 | 195 | while ( edges.Count > 0 ) 196 | { 197 | var last = edges[0]; 198 | edges.RemoveAt( 0 ); 199 | 200 | if ( ShouldFlip( last ) ) last = last.Reverse; 201 | 202 | sortedEdges.Add( last ); 203 | 204 | var a = Array.IndexOf( _vertices, last.A ); 205 | var b = Array.IndexOf( _vertices, last.B ); 206 | 207 | while ( edges.Count > 0 ) 208 | { 209 | var next = edges.FirstOrDefault( x => x.A.Equals( last.B ) || x.B.Equals( last.B ) ); 210 | if ( !next.IsValid ) break; 211 | 212 | edges.Remove( next ); 213 | 214 | last = next.A.Equals( last.B ) ? next : next.Reverse; 215 | sortedEdges.Add( last ); 216 | 217 | var c = Array.IndexOf( _vertices, last.B ); 218 | 219 | triangles.Add( new Triangle( a, b, c ) ); 220 | 221 | b = c; 222 | } 223 | } 224 | 225 | _edges = sortedEdges.ToArray(); 226 | _triangles = triangles.ToArray(); 227 | } 228 | 229 | private static bool ShouldFlip( Edge edge ) 230 | { 231 | var aa = _sVectorLookup[edge.A.A]; 232 | var ab = _sVectorLookup[edge.A.B]; 233 | var ba = _sVectorLookup[edge.B.A]; 234 | var bb = _sVectorLookup[edge.B.B]; 235 | 236 | var a = (aa + ab) * 0.5f; 237 | var b = (ba + bb) * 0.5f; 238 | 239 | var solidMidPoint = (aa + ba) * 0.5f; 240 | var cross = Vector3.Cross( a - solidMidPoint, b - a ); 241 | 242 | return Vector3.Dot( cross, (a + b) * 0.5f - new Vector3( 0.5f, 0.5f, 0.5f ) ) >= 0f; 243 | } 244 | 245 | [ThreadStatic] private static int[] _sVertexIndices; 246 | 247 | private static int[] GetVertexIndexBuffer() 248 | { 249 | return _sVertexIndices ?? (_sVertexIndices = new int[16]); 250 | } 251 | 252 | private Vector3 FindVertex( float[] values, float threshold, Vertex vertex ) 253 | { 254 | var a = values[vertex.A]; 255 | var b = values[vertex.B]; 256 | var t = (threshold - a) / (b - a); 257 | 258 | var src = _sVectorLookup[vertex.A]; 259 | var dst = _sVectorLookup[vertex.B]; 260 | 261 | switch ( vertex.A ^ vertex.B ) 262 | { 263 | case 0x1: 264 | src.x += (dst.x - src.x) * t; 265 | break; 266 | case 0x2: 267 | src.y += (dst.y - src.y) * t; 268 | break; 269 | case 0x4: 270 | src.z += (dst.z - src.z) * t; 271 | break; 272 | } 273 | 274 | return src; 275 | } 276 | 277 | public void Write( MarchingCubes cubes, float[] values, float threshold ) 278 | { 279 | var vertIndices = GetVertexIndexBuffer(); 280 | for ( var i = 0; i < _vertices.Length; ++i ) 281 | { 282 | vertIndices[i] = cubes.WriteVertex( FindVertex( values, threshold, _vertices[i] ) ); 283 | } 284 | 285 | for ( var i = 0; i < _triangles.Length; ++i ) 286 | { 287 | var face = _triangles[i]; 288 | cubes.WriteFace( vertIndices[face.A], vertIndices[face.B], vertIndices[face.C] ); 289 | } 290 | } 291 | 292 | public void DrawGizmos( float[] values, float threshold ) 293 | { 294 | for ( var i = 0; i < _edges.Length; ++i ) 295 | { 296 | var edge = _edges[i]; 297 | var a = FindVertex( values, threshold, edge.A ); 298 | var b = FindVertex( values, threshold, edge.B ); 299 | 300 | Gizmos.DrawLine( a, b ); 301 | } 302 | } 303 | } 304 | 305 | private readonly MarchingCubesCase[] _lookupTable = new MarchingCubesCase[256]; 306 | 307 | public Vector3 CubeSize { get; set; } 308 | public Vector3 CubePos { get; set; } 309 | public float Threshold { get; set; } 310 | 311 | private readonly Dictionary _indexMap = new Dictionary(); 312 | private readonly List _indices = new List(); 313 | private readonly List _vertices = new List(); 314 | 315 | public MarchingCubes() 316 | { 317 | PopulateLookupTable(); 318 | 319 | CubeSize = Vector3.one; 320 | Threshold = 0.5f; 321 | } 322 | 323 | private void PopulateLookupTable() 324 | { 325 | for ( var i = 0; i < 256; ++i ) 326 | { 327 | _lookupTable[i] = new MarchingCubesCase( new[] 328 | { 329 | (i & 0x01) != 0, 330 | (i & 0x02) != 0, 331 | (i & 0x04) != 0, 332 | (i & 0x08) != 0, 333 | (i & 0x10) != 0, 334 | (i & 0x20) != 0, 335 | (i & 0x40) != 0, 336 | (i & 0x80) != 0 337 | } ); 338 | } 339 | } 340 | 341 | public void Clear() 342 | { 343 | _indexMap.Clear(); 344 | _indices.Clear(); 345 | _vertices.Clear(); 346 | } 347 | 348 | public void MoveToCube( int x, int y, int z ) 349 | { 350 | CubePos = new Vector3( CubeSize.x * x, CubeSize.y * y, CubeSize.z * z ); 351 | } 352 | 353 | private MarchingCubesCase LookupCase( float[] values ) 354 | { 355 | if ( values.Length != 8 ) throw new Exception( "Expected 8 values." ); 356 | 357 | var thresh = Threshold; 358 | var lookup = 0; 359 | 360 | for ( var i = 0; i < 8; ++i ) 361 | { 362 | lookup |= values[i] >= thresh ? 1 << i : 0; 363 | } 364 | 365 | return _lookupTable[lookup]; 366 | } 367 | 368 | public void Write( float[] values ) 369 | { 370 | LookupCase( values ).Write( this, values, Threshold ); 371 | } 372 | 373 | private void WriteFace( int a, int b, int c ) 374 | { 375 | _indices.Add( a ); 376 | _indices.Add( b ); 377 | _indices.Add( c ); 378 | } 379 | 380 | private int WriteVertex( Vector3 vertex ) 381 | { 382 | const int res = 4; 383 | const float invRes = 1f / res; 384 | 385 | vertex.x = (int) (vertex.x * res) * invRes; 386 | vertex.y = (int) (vertex.y * res) * invRes; 387 | vertex.z = (int) (vertex.z * res) * invRes; 388 | 389 | vertex = Vector3.Scale( vertex, CubeSize ) + CubePos; 390 | 391 | int index; 392 | if ( _indexMap.TryGetValue( vertex, out index ) ) 393 | { 394 | return index; 395 | } 396 | 397 | index = _vertices.Count; 398 | _vertices.Add( vertex ); 399 | _indexMap.Add( vertex, index ); 400 | 401 | return index; 402 | } 403 | 404 | public void CopyToMesh( Mesh mesh ) 405 | { 406 | mesh.Clear(); 407 | mesh.SetVertices( _vertices ); 408 | mesh.SetTriangles( _indices, 0 ); 409 | mesh.RecalculateBounds(); 410 | mesh.RecalculateNormals(); 411 | mesh.UploadMeshData( false ); 412 | } 413 | 414 | public void DrawGizmos( float[] values ) 415 | { 416 | LookupCase( values ).DrawGizmos( values, Threshold ); 417 | } 418 | } 419 | -------------------------------------------------------------------------------- /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: 10 7 | productGUID: 832de65a60dceb74786441863d5129aa 8 | AndroidProfiler: 0 9 | defaultScreenOrientation: 4 10 | targetDevice: 2 11 | useOnDemandResources: 0 12 | accelerometerFrequency: 60 13 | companyName: DefaultCompany 14 | productName: PointCloudMeshing 15 | defaultCursor: {fileID: 0} 16 | cursorHotspot: {x: 0, y: 0} 17 | m_SplashScreenBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21176471, a: 1} 18 | m_ShowUnitySplashScreen: 1 19 | m_ShowUnitySplashLogo: 1 20 | m_SplashScreenOverlayOpacity: 1 21 | m_SplashScreenAnimation: 1 22 | m_SplashScreenLogoStyle: 1 23 | m_SplashScreenDrawMode: 0 24 | m_SplashScreenBackgroundAnimationZoom: 1 25 | m_SplashScreenLogoAnimationZoom: 1 26 | m_SplashScreenBackgroundLandscapeAspect: 1 27 | m_SplashScreenBackgroundPortraitAspect: 1 28 | m_SplashScreenBackgroundLandscapeUvs: 29 | serializedVersion: 2 30 | x: 0 31 | y: 0 32 | width: 1 33 | height: 1 34 | m_SplashScreenBackgroundPortraitUvs: 35 | serializedVersion: 2 36 | x: 0 37 | y: 0 38 | width: 1 39 | height: 1 40 | m_SplashScreenLogos: [] 41 | m_SplashScreenBackgroundLandscape: {fileID: 0} 42 | m_SplashScreenBackgroundPortrait: {fileID: 0} 43 | m_VirtualRealitySplashScreen: {fileID: 0} 44 | m_HolographicTrackingLossScreen: {fileID: 0} 45 | defaultScreenWidth: 1024 46 | defaultScreenHeight: 768 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_ActiveColorSpace: 0 50 | m_MTRendering: 1 51 | m_MobileMTRendering: 0 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 | disableDepthAndStencilBuffers: 0 65 | defaultIsFullScreen: 1 66 | defaultIsNativeResolution: 1 67 | runInBackground: 0 68 | captureSingleScreen: 0 69 | Override IPod Music: 0 70 | Prepare IOS For Recording: 0 71 | submitAnalytics: 1 72 | usePlayerLog: 1 73 | bakeCollisionMeshes: 0 74 | forceSingleInstance: 0 75 | resizableWindow: 0 76 | useMacAppStoreValidation: 0 77 | gpuSkinning: 0 78 | graphicsJobs: 0 79 | xboxPIXTextureCapture: 0 80 | xboxEnableAvatar: 0 81 | xboxEnableKinect: 0 82 | xboxEnableKinectAutoTracking: 0 83 | xboxEnableFitness: 0 84 | visibleInBackground: 0 85 | allowFullscreenSwitch: 1 86 | macFullscreenMode: 2 87 | d3d9FullscreenMode: 1 88 | d3d11FullscreenMode: 1 89 | xboxSpeechDB: 0 90 | xboxEnableHeadOrientation: 0 91 | xboxEnableGuest: 0 92 | xboxEnablePIXSampling: 0 93 | n3dsDisableStereoscopicView: 0 94 | n3dsEnableSharedListOpt: 1 95 | n3dsEnableVSync: 0 96 | uiUse16BitDepthBuffer: 0 97 | ignoreAlphaClear: 0 98 | xboxOneResolution: 0 99 | xboxOneMonoLoggingLevel: 0 100 | xboxOneLoggingLevel: 1 101 | videoMemoryForVertexBuffers: 0 102 | psp2PowerMode: 0 103 | psp2AcquireBGM: 1 104 | wiiUTVResolution: 0 105 | wiiUGamePadMSAA: 1 106 | wiiUSupportsNunchuk: 0 107 | wiiUSupportsClassicController: 0 108 | wiiUSupportsBalanceBoard: 0 109 | wiiUSupportsMotionPlus: 0 110 | wiiUSupportsProController: 0 111 | wiiUAllowScreenCapture: 1 112 | wiiUControllerCount: 0 113 | m_SupportedAspectRatios: 114 | 4:3: 1 115 | 5:4: 1 116 | 16:10: 1 117 | 16:9: 1 118 | Others: 1 119 | bundleIdentifier: com.Company.ProductName 120 | bundleVersion: 1.0 121 | preloadedAssets: [] 122 | metroInputSource: 0 123 | m_HolographicPauseOnTrackingLoss: 1 124 | xboxOneDisableKinectGpuReservation: 0 125 | singlePassStereoRendering: 0 126 | protectGraphicsMemory: 0 127 | AndroidBundleVersionCode: 1 128 | AndroidMinSdkVersion: 9 129 | AndroidPreferredInstallLocation: 1 130 | aotOptions: 131 | apiCompatibilityLevel: 2 132 | stripEngineCode: 1 133 | iPhoneStrippingLevel: 0 134 | iPhoneScriptCallOptimization: 0 135 | iPhoneBuildNumber: 0 136 | ForceInternetPermission: 0 137 | ForceSDCardPermission: 0 138 | CreateWallpaper: 0 139 | APKExpansionFiles: 0 140 | preloadShaders: 0 141 | StripUnusedMeshComponents: 0 142 | VertexChannelCompressionMask: 143 | serializedVersion: 2 144 | m_Bits: 238 145 | iPhoneSdkVersion: 988 146 | iOSTargetOSVersionString: 147 | tvOSSdkVersion: 0 148 | tvOSRequireExtendedGameController: 0 149 | tvOSTargetOSVersionString: 150 | uIPrerenderedIcon: 0 151 | uIRequiresPersistentWiFi: 0 152 | uIRequiresFullScreen: 1 153 | uIStatusBarHidden: 1 154 | uIExitOnSuspend: 0 155 | uIStatusBarStyle: 0 156 | iPhoneSplashScreen: {fileID: 0} 157 | iPhoneHighResSplashScreen: {fileID: 0} 158 | iPhoneTallHighResSplashScreen: {fileID: 0} 159 | iPhone47inSplashScreen: {fileID: 0} 160 | iPhone55inPortraitSplashScreen: {fileID: 0} 161 | iPhone55inLandscapeSplashScreen: {fileID: 0} 162 | iPadPortraitSplashScreen: {fileID: 0} 163 | iPadHighResPortraitSplashScreen: {fileID: 0} 164 | iPadLandscapeSplashScreen: {fileID: 0} 165 | iPadHighResLandscapeSplashScreen: {fileID: 0} 166 | appleTVSplashScreen: {fileID: 0} 167 | tvOSSmallIconLayers: [] 168 | tvOSLargeIconLayers: [] 169 | tvOSTopShelfImageLayers: [] 170 | iOSLaunchScreenType: 0 171 | iOSLaunchScreenPortrait: {fileID: 0} 172 | iOSLaunchScreenLandscape: {fileID: 0} 173 | iOSLaunchScreenBackgroundColor: 174 | serializedVersion: 2 175 | rgba: 0 176 | iOSLaunchScreenFillPct: 100 177 | iOSLaunchScreenSize: 100 178 | iOSLaunchScreenCustomXibPath: 179 | iOSLaunchScreeniPadType: 0 180 | iOSLaunchScreeniPadImage: {fileID: 0} 181 | iOSLaunchScreeniPadBackgroundColor: 182 | serializedVersion: 2 183 | rgba: 0 184 | iOSLaunchScreeniPadFillPct: 100 185 | iOSLaunchScreeniPadSize: 100 186 | iOSLaunchScreeniPadCustomXibPath: 187 | iOSDeviceRequirements: [] 188 | iOSURLSchemes: [] 189 | iOSBackgroundModes: 0 190 | iOSMetalForceHardShadows: 0 191 | appleDeveloperTeamID: 192 | AndroidTargetDevice: 0 193 | AndroidSplashScreenScale: 0 194 | androidSplashScreen: {fileID: 0} 195 | AndroidKeystoreName: 196 | AndroidKeyaliasName: 197 | AndroidTVCompatibility: 1 198 | AndroidIsGame: 1 199 | androidEnableBanner: 1 200 | m_AndroidBanners: 201 | - width: 320 202 | height: 180 203 | banner: {fileID: 0} 204 | androidGamepadSupportLevel: 0 205 | resolutionDialogBanner: {fileID: 0} 206 | m_BuildTargetIcons: [] 207 | m_BuildTargetBatching: [] 208 | m_BuildTargetGraphicsAPIs: [] 209 | m_BuildTargetVRSettings: [] 210 | openGLRequireES31: 0 211 | openGLRequireES31AEP: 0 212 | webPlayerTemplate: APPLICATION:Default 213 | m_TemplateCustomTags: {} 214 | wiiUTitleID: 0005000011000000 215 | wiiUGroupID: 00010000 216 | wiiUCommonSaveSize: 4096 217 | wiiUAccountSaveSize: 2048 218 | wiiUOlvAccessKey: 0 219 | wiiUTinCode: 0 220 | wiiUJoinGameId: 0 221 | wiiUJoinGameModeMask: 0000000000000000 222 | wiiUCommonBossSize: 0 223 | wiiUAccountBossSize: 0 224 | wiiUAddOnUniqueIDs: [] 225 | wiiUMainThreadStackSize: 3072 226 | wiiULoaderThreadStackSize: 1024 227 | wiiUSystemHeapSize: 128 228 | wiiUTVStartupScreen: {fileID: 0} 229 | wiiUGamePadStartupScreen: {fileID: 0} 230 | wiiUDrcBufferDisabled: 0 231 | wiiUProfilerLibPath: 232 | actionOnDotNetUnhandledException: 1 233 | enableInternalProfiler: 0 234 | logObjCUncaughtExceptions: 1 235 | enableCrashReportAPI: 0 236 | cameraUsageDescription: 237 | locationUsageDescription: 238 | microphoneUsageDescription: 239 | XboxTitleId: 240 | XboxImageXexPath: 241 | XboxSpaPath: 242 | XboxGenerateSpa: 0 243 | XboxDeployKinectResources: 0 244 | XboxSplashScreen: {fileID: 0} 245 | xboxEnableSpeech: 0 246 | xboxAdditionalTitleMemorySize: 0 247 | xboxDeployKinectHeadOrientation: 0 248 | xboxDeployKinectHeadPosition: 0 249 | ps4NPAgeRating: 12 250 | ps4NPTitleSecret: 251 | ps4NPTrophyPackPath: 252 | ps4ParentalLevel: 1 253 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 254 | ps4Category: 0 255 | ps4MasterVersion: 01.00 256 | ps4AppVersion: 01.00 257 | ps4AppType: 0 258 | ps4ParamSfxPath: 259 | ps4VideoOutPixelFormat: 0 260 | ps4VideoOutInitialWidth: 1920 261 | ps4VideoOutReprojectionRate: 120 262 | ps4PronunciationXMLPath: 263 | ps4PronunciationSIGPath: 264 | ps4BackgroundImagePath: 265 | ps4StartupImagePath: 266 | ps4SaveDataImagePath: 267 | ps4SdkOverride: 268 | ps4BGMPath: 269 | ps4ShareFilePath: 270 | ps4ShareOverlayImagePath: 271 | ps4PrivacyGuardImagePath: 272 | ps4NPtitleDatPath: 273 | ps4RemotePlayKeyAssignment: -1 274 | ps4RemotePlayKeyMappingDir: 275 | ps4PlayTogetherPlayerCount: 0 276 | ps4EnterButtonAssignment: 1 277 | ps4ApplicationParam1: 0 278 | ps4ApplicationParam2: 0 279 | ps4ApplicationParam3: 0 280 | ps4ApplicationParam4: 0 281 | ps4DownloadDataSize: 0 282 | ps4GarlicHeapSize: 2048 283 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 284 | ps4UseDebugIl2cppLibs: 0 285 | ps4pnSessions: 1 286 | ps4pnPresence: 1 287 | ps4pnFriends: 1 288 | ps4pnGameCustomData: 1 289 | playerPrefsSupport: 0 290 | restrictedAudioUsageRights: 0 291 | ps4UseResolutionFallback: 0 292 | ps4ReprojectionSupport: 0 293 | ps4UseAudio3dBackend: 0 294 | ps4SocialScreenEnabled: 0 295 | ps4ScriptOptimizationLevel: 3 296 | ps4Audio3dVirtualSpeakerCount: 14 297 | ps4attribCpuUsage: 0 298 | ps4PatchPkgPath: 299 | ps4PatchLatestPkgPath: 300 | ps4PatchChangeinfoPath: 301 | ps4PatchDayOne: 0 302 | ps4attribUserManagement: 0 303 | ps4attribMoveSupport: 0 304 | ps4attrib3DSupport: 0 305 | ps4attribShareSupport: 0 306 | ps4attribExclusiveVR: 0 307 | ps4disableAutoHideSplash: 0 308 | ps4IncludedModules: [] 309 | monoEnv: 310 | psp2Splashimage: {fileID: 0} 311 | psp2NPTrophyPackPath: 312 | psp2NPSupportGBMorGJP: 0 313 | psp2NPAgeRating: 12 314 | psp2NPTitleDatPath: 315 | psp2NPCommsID: 316 | psp2NPCommunicationsID: 317 | psp2NPCommsPassphrase: 318 | psp2NPCommsSig: 319 | psp2ParamSfxPath: 320 | psp2ManualPath: 321 | psp2LiveAreaGatePath: 322 | psp2LiveAreaBackroundPath: 323 | psp2LiveAreaPath: 324 | psp2LiveAreaTrialPath: 325 | psp2PatchChangeInfoPath: 326 | psp2PatchOriginalPackage: 327 | psp2PackagePassword: F69AzBlax3CF3EDNhm3soLBPh71Yexui 328 | psp2KeystoneFile: 329 | psp2MemoryExpansionMode: 0 330 | psp2DRMType: 0 331 | psp2StorageType: 0 332 | psp2MediaCapacity: 0 333 | psp2DLCConfigPath: 334 | psp2ThumbnailPath: 335 | psp2BackgroundPath: 336 | psp2SoundPath: 337 | psp2TrophyCommId: 338 | psp2TrophyPackagePath: 339 | psp2PackagedResourcesPath: 340 | psp2SaveDataQuota: 10240 341 | psp2ParentalLevel: 1 342 | psp2ShortTitle: Not Set 343 | psp2ContentID: IV0000-ABCD12345_00-0123456789ABCDEF 344 | psp2Category: 0 345 | psp2MasterVersion: 01.00 346 | psp2AppVersion: 01.00 347 | psp2TVBootMode: 0 348 | psp2EnterButtonAssignment: 2 349 | psp2TVDisableEmu: 0 350 | psp2AllowTwitterDialog: 1 351 | psp2Upgradable: 0 352 | psp2HealthWarning: 0 353 | psp2UseLibLocation: 0 354 | psp2InfoBarOnStartup: 0 355 | psp2InfoBarColor: 0 356 | psp2UseDebugIl2cppLibs: 0 357 | psmSplashimage: {fileID: 0} 358 | splashScreenBackgroundSourceLandscape: {fileID: 0} 359 | splashScreenBackgroundSourcePortrait: {fileID: 0} 360 | spritePackerPolicy: 361 | webGLMemorySize: 256 362 | webGLExceptionSupport: 1 363 | webGLDataCaching: 0 364 | webGLDebugSymbols: 0 365 | webGLEmscriptenArgs: 366 | webGLModulesDirectory: 367 | webGLTemplate: APPLICATION:Default 368 | webGLAnalyzeBuildSize: 0 369 | webGLUseEmbeddedResources: 0 370 | webGLUseWasm: 0 371 | webGLCompressionFormat: 1 372 | scriptingDefineSymbols: {} 373 | platformArchitecture: {} 374 | scriptingBackend: {} 375 | incrementalIl2cppBuild: {} 376 | additionalIl2CppArgs: 377 | m_RenderingPath: 1 378 | m_MobileRenderingPath: 1 379 | metroPackageName: PointCloudMeshing 380 | metroPackageVersion: 381 | metroCertificatePath: 382 | metroCertificatePassword: 383 | metroCertificateSubject: 384 | metroCertificateIssuer: 385 | metroCertificateNotAfter: 0000000000000000 386 | metroApplicationDescription: PointCloudMeshing 387 | wsaImages: {} 388 | metroTileShortName: 389 | metroCommandLineArgsFile: 390 | metroTileShowName: 0 391 | metroMediumTileShowName: 0 392 | metroLargeTileShowName: 0 393 | metroWideTileShowName: 0 394 | metroDefaultTileSize: 1 395 | metroTileForegroundText: 2 396 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 397 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, 398 | a: 1} 399 | metroSplashScreenUseBackgroundColor: 0 400 | platformCapabilities: {} 401 | metroFTAName: 402 | metroFTAFileTypes: [] 403 | metroProtocolName: 404 | metroCompilationOverrides: 1 405 | tizenProductDescription: 406 | tizenProductURL: 407 | tizenSigningProfileName: 408 | tizenGPSPermissions: 0 409 | tizenMicrophonePermissions: 0 410 | tizenDeploymentTarget: 411 | tizenDeploymentTargetType: 0 412 | tizenMinOSVersion: 0 413 | n3dsUseExtSaveData: 0 414 | n3dsCompressStaticMem: 1 415 | n3dsExtSaveDataNumber: 0x12345 416 | n3dsStackSize: 131072 417 | n3dsTargetPlatform: 2 418 | n3dsRegion: 7 419 | n3dsMediaSize: 0 420 | n3dsLogoStyle: 3 421 | n3dsTitle: GameName 422 | n3dsProductCode: 423 | n3dsApplicationId: 0xFF3FF 424 | stvDeviceAddress: 425 | stvProductDescription: 426 | stvProductAuthor: 427 | stvProductAuthorEmail: 428 | stvProductLink: 429 | stvProductCategory: 0 430 | XboxOneProductId: 431 | XboxOneUpdateKey: 432 | XboxOneSandboxId: 433 | XboxOneContentId: 434 | XboxOneTitleId: 435 | XboxOneSCId: 436 | XboxOneGameOsOverridePath: 437 | XboxOnePackagingOverridePath: 438 | XboxOneAppManifestOverridePath: 439 | XboxOnePackageEncryption: 0 440 | XboxOnePackageUpdateGranularity: 2 441 | XboxOneDescription: 442 | XboxOneLanguage: 443 | - enus 444 | XboxOneCapability: [] 445 | XboxOneGameRating: {} 446 | XboxOneIsContentPackage: 0 447 | XboxOneEnableGPUVariability: 0 448 | XboxOneSockets: {} 449 | XboxOneSplashScreen: {fileID: 0} 450 | XboxOneAllowedProductIds: [] 451 | XboxOnePersistentLocalStorageSize: 0 452 | vrEditorSettings: {} 453 | cloudServicesEnabled: {} 454 | cloudProjectId: 455 | projectName: 456 | organizationId: 457 | cloudEnabled: 0 458 | --------------------------------------------------------------------------------