├── .gitignore ├── Assets ├── LineRenderer2D.asmdef ├── LineRenderer2D.asmdef.meta ├── Runtime.meta ├── Runtime │ ├── P_SG_Line.prefab │ ├── P_SG_Line.prefab.meta │ ├── P_SG_MultiLine.prefab │ ├── P_SG_MultiLine.prefab.meta │ ├── P_S_Line.prefab │ ├── P_S_Line.prefab.meta │ ├── P_S_MultiLine.prefab │ ├── P_S_MultiLine.prefab.meta │ ├── P_S_VectorialLine.prefab │ ├── P_S_VectorialLine.prefab.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── LineRenderer2D.cs │ │ ├── LineRenderer2D.cs.meta │ │ ├── MultiLineRenderer2D.cs │ │ └── MultiLineRenderer2D.cs.meta │ ├── Shadergraph.meta │ ├── Shadergraph │ │ ├── M_SG_BresenhamLine.mat │ │ ├── M_SG_BresenhamLine.mat.meta │ │ ├── M_SG_BresenhamLineUnlit.mat │ │ ├── M_SG_BresenhamLineUnlit.mat.meta │ │ ├── M_SG_BresenhamMultiLine.mat │ │ ├── M_SG_BresenhamMultiLine.mat.meta │ │ ├── M_SG_BresenhamMultiLineUnlit.mat │ │ ├── M_SG_BresenhamMultiLineUnlit.mat.meta │ │ ├── M_SG_VectorialLine.mat │ │ ├── M_SG_VectorialLine.mat.meta │ │ ├── M_SG_VectorialLineUnlit.mat │ │ ├── M_SG_VectorialLineUnlit.mat.meta │ │ ├── SG_BresenhamLine.shadergraph │ │ ├── SG_BresenhamLine.shadergraph.meta │ │ ├── SG_BresenhamLineUnlit.shadergraph │ │ ├── SG_BresenhamLineUnlit.shadergraph.meta │ │ ├── SG_BresenhamMultiLine.shadergraph │ │ ├── SG_BresenhamMultiLine.shadergraph.meta │ │ ├── SG_BresenhamMultiLineUnlit.shadergraph │ │ ├── SG_BresenhamMultiLineUnlit.shadergraph.meta │ │ ├── SG_VectorialLine.shadergraph │ │ ├── SG_VectorialLine.shadergraph.meta │ │ ├── SG_VectorialLineUnlit.shadergraph │ │ └── SG_VectorialLineUnlit.shadergraph.meta │ ├── Shaders.meta │ ├── Shaders │ │ ├── M_BresenhamLineRenderer2D_Lit.mat │ │ ├── M_BresenhamLineRenderer2D_Lit.mat.meta │ │ ├── M_BresenhamLineRenderer2D_Unlit.mat │ │ ├── M_BresenhamLineRenderer2D_Unlit.mat.meta │ │ ├── M_BresenhamMultiLineRenderer2D_Lit.mat │ │ ├── M_BresenhamMultiLineRenderer2D_Lit.mat.meta │ │ ├── M_BresenhamMultiLineRenderer2D_Unlit.mat │ │ ├── M_BresenhamMultiLineRenderer2D_Unlit.mat.meta │ │ ├── M_VectorialLineRenderer2D.mat │ │ ├── M_VectorialLineRenderer2D.mat.meta │ │ ├── S_BresenhamLine.hlsl │ │ ├── S_BresenhamLine.hlsl.meta │ │ ├── S_BresenhamLineRenderer2D.shader │ │ ├── S_BresenhamLineRenderer2D.shader.meta │ │ ├── S_BresenhamMultiLine.hlsl │ │ ├── S_BresenhamMultiLine.hlsl.meta │ │ ├── S_BresenhamMultiLineRenderer2D.shader │ │ ├── S_BresenhamMultiLineRenderer2D.shader.meta │ │ ├── S_VectorialLineRenderer2D.shader │ │ └── S_VectorialLineRenderer2D.shader.meta │ ├── T_1x1Pixel.bmp │ └── T_1x1Pixel.bmp.meta ├── Samples.meta ├── Samples │ ├── 2D Renderer Data.asset │ ├── 2D Renderer Data.asset.meta │ ├── TestScene.unity │ ├── TestScene.unity.meta │ ├── UniversalRenderPipelineAsset.asset │ └── UniversalRenderPipelineAsset.asset.meta ├── package.json └── package.json.meta ├── LICENSE ├── Packages └── manifest.json ├── ProjectSettings ├── AudioManager.asset ├── ClusterInputManager.asset ├── DynamicsManager.asset ├── EditorBuildSettings.asset ├── EditorSettings.asset ├── GraphicsSettings.asset ├── InputManager.asset ├── NavMeshAreas.asset ├── PackageManagerSettings.asset ├── Physics2DSettings.asset ├── PresetManager.asset ├── ProjectSettings.asset ├── ProjectVersion.txt ├── QualitySettings.asset ├── TagManager.asset ├── TimeManager.asset ├── URPProjectSettings.asset ├── UnityConnectSettings.asset ├── VFXManager.asset ├── VersionControlSettings.asset └── XRSettings.asset └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # This .gitignore file should be placed at the root of your Unity project directory 2 | # 3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore 4 | # 5 | /[Ll]ibrary/ 6 | /[Tt]emp/ 7 | /[Oo]bj/ 8 | /[Bb]uild/ 9 | /[Bb]uilds/ 10 | /[Ll]ogs/ 11 | /[Mm]emoryCaptures/ 12 | 13 | # Asset meta data should only be ignored when the corresponding asset is also ignored 14 | !/[Aa]ssets/**/*.meta 15 | 16 | # Uncomment this line if you wish to ignore the asset store tools plugin 17 | # /[Aa]ssets/AssetStoreTools* 18 | 19 | # Autogenerated Jetbrains Rider plugin 20 | [Aa]ssets/Plugins/Editor/JetBrains* 21 | 22 | # Visual Studio cache directory 23 | .vs/ 24 | 25 | # Gradle cache directory 26 | .gradle/ 27 | 28 | # Autogenerated VS/MD/Consulo solution and project files 29 | ExportedObj/ 30 | .consulo/ 31 | *.csproj 32 | *.unityproj 33 | *.sln 34 | *.suo 35 | *.tmp 36 | *.user 37 | *.userprefs 38 | *.pidb 39 | *.booproj 40 | *.svd 41 | *.pdb 42 | *.mdb 43 | *.opendb 44 | *.VC.db 45 | 46 | # Unity3D generated meta files 47 | *.pidb.meta 48 | *.pdb.meta 49 | *.mdb.meta 50 | 51 | # Unity3D generated file on crash reports 52 | sysinfo.txt 53 | 54 | # Builds 55 | *.apk 56 | *.unitypackage 57 | 58 | # Crashlytics generated file 59 | crashlytics-build.properties 60 | 61 | 62 | .vsconfig 63 | 64 | UserSettings/EditorUserSettings.asset 65 | 66 | Packages/packages-lock.json 67 | -------------------------------------------------------------------------------- /Assets/LineRenderer2D.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "LineRenderer2D", 3 | "rootNamespace": "Game.Core.Rendering", 4 | "references": [], 5 | "includePlatforms": [], 6 | "excludePlatforms": [], 7 | "allowUnsafeCode": false, 8 | "overrideReferences": false, 9 | "precompiledReferences": [], 10 | "autoReferenced": true, 11 | "defineConstraints": [], 12 | "versionDefines": [], 13 | "noEngineReferences": false 14 | } -------------------------------------------------------------------------------- /Assets/LineRenderer2D.asmdef.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e045d1970ce26454ca503bd1f5d80d5c 3 | AssemblyDefinitionImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Runtime.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9894b636015062f41b29ef941b7db8d2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/P_SG_Line.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2543940257823055156 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: 7660889375252234219} 12 | - component: {fileID: 9212615753039092101} 13 | - component: {fileID: 7583879088528668018} 14 | m_Layer: 0 15 | m_Name: P_SG_Line 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &7660889375252234219 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2543940257823055156} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 0} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!114 &9212615753039092101 36 | MonoBehaviour: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 2543940257823055156} 42 | m_Enabled: 1 43 | m_EditorHideFlags: 0 44 | m_Script: {fileID: 11500000, guid: d8e1bda1c13f4cc48834ba6c84513f52, type: 3} 45 | m_Name: 46 | m_EditorClassIdentifier: 47 | PointA: {x: -4, y: 4} 48 | PointB: {x: 4, y: -4} 49 | m_AutoApplyPositionChanges: 1 50 | m_Renderer: {fileID: 7583879088528668018} 51 | m_LineColorA: {r: 1, g: 0, b: 0, a: 1} 52 | m_LineColorB: {r: 1, g: 0, b: 0, a: 1} 53 | m_LineThickness: 4 54 | m_DottedLineLength: 99999 55 | m_DottedLineOffset: 0 56 | m_PositionsAreLocalSpace: 0 57 | m_UsesVectorialLineMaterial: 0 58 | m_camera: {fileID: 0} 59 | --- !u!212 &7583879088528668018 60 | SpriteRenderer: 61 | m_ObjectHideFlags: 0 62 | m_CorrespondingSourceObject: {fileID: 0} 63 | m_PrefabInstance: {fileID: 0} 64 | m_PrefabAsset: {fileID: 0} 65 | m_GameObject: {fileID: 2543940257823055156} 66 | m_Enabled: 1 67 | m_CastShadows: 0 68 | m_ReceiveShadows: 0 69 | m_DynamicOccludee: 1 70 | m_MotionVectors: 1 71 | m_LightProbeUsage: 1 72 | m_ReflectionProbeUsage: 1 73 | m_RayTracingMode: 0 74 | m_RayTraceProcedural: 0 75 | m_RenderingLayerMask: 1 76 | m_RendererPriority: 0 77 | m_Materials: 78 | - {fileID: 2100000, guid: 968ed2d6466fdf74db1a557194497e41, type: 2} 79 | m_StaticBatchInfo: 80 | firstSubMesh: 0 81 | subMeshCount: 0 82 | m_StaticBatchRoot: {fileID: 0} 83 | m_ProbeAnchor: {fileID: 0} 84 | m_LightProbeVolumeOverride: {fileID: 0} 85 | m_ScaleInLightmap: 1 86 | m_ReceiveGI: 1 87 | m_PreserveUVs: 0 88 | m_IgnoreNormalsForChartDetection: 0 89 | m_ImportantGI: 0 90 | m_StitchLightmapSeams: 1 91 | m_SelectedEditorRenderState: 0 92 | m_MinimumChartSize: 4 93 | m_AutoUVMaxDistance: 0.5 94 | m_AutoUVMaxAngle: 89 95 | m_LightmapParameters: {fileID: 0} 96 | m_SortingLayerID: 0 97 | m_SortingLayer: 0 98 | m_SortingOrder: 0 99 | m_Sprite: {fileID: 21300000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 100 | m_Color: {r: 1, g: 1, b: 1, a: 1} 101 | m_FlipX: 0 102 | m_FlipY: 0 103 | m_DrawMode: 0 104 | m_Size: {x: 1, y: 1} 105 | m_AdaptiveModeThreshold: 0.5 106 | m_SpriteTileMode: 0 107 | m_WasSpriteAssigned: 1 108 | m_MaskInteraction: 0 109 | m_SpriteSortPoint: 0 110 | -------------------------------------------------------------------------------- /Assets/Runtime/P_SG_Line.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2bee288afa87fb64fbb34db29c07c159 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Runtime/P_SG_MultiLine.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5626669553487636269 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: 8566530671122967141} 12 | - component: {fileID: 7503196689741130756} 13 | - component: {fileID: 6781811110391421473} 14 | m_Layer: 0 15 | m_Name: P_SG_MultiLine 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &8566530671122967141 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 5626669553487636269} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 0} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!114 &7503196689741130756 36 | MonoBehaviour: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 5626669553487636269} 42 | m_Enabled: 1 43 | m_EditorHideFlags: 0 44 | m_Script: {fileID: 11500000, guid: 86bcaae1d96bce94c9eefbad2f72d234, type: 3} 45 | m_Name: 46 | m_EditorClassIdentifier: 47 | Points: 48 | - {x: 0, y: 0} 49 | - {x: 10, y: 4} 50 | - {x: 20, y: -8} 51 | m_Renderer: {fileID: 6781811110391421473} 52 | m_LineColor: {r: 1, g: 0, b: 0, a: 1} 53 | m_LineThickness: 4 54 | m_MaxPoints: 16 55 | m_AutoApplyPositionChanges: 1 56 | m_PositionsAreLocalSpace: 0 57 | m_camera: {fileID: 0} 58 | --- !u!212 &6781811110391421473 59 | SpriteRenderer: 60 | m_ObjectHideFlags: 0 61 | m_CorrespondingSourceObject: {fileID: 0} 62 | m_PrefabInstance: {fileID: 0} 63 | m_PrefabAsset: {fileID: 0} 64 | m_GameObject: {fileID: 5626669553487636269} 65 | m_Enabled: 1 66 | m_CastShadows: 0 67 | m_ReceiveShadows: 0 68 | m_DynamicOccludee: 1 69 | m_MotionVectors: 1 70 | m_LightProbeUsage: 1 71 | m_ReflectionProbeUsage: 1 72 | m_RayTracingMode: 0 73 | m_RayTraceProcedural: 0 74 | m_RenderingLayerMask: 1 75 | m_RendererPriority: 0 76 | m_Materials: 77 | - {fileID: 2100000, guid: 933967d4e6cbe3f4cb299cae46231191, type: 2} 78 | m_StaticBatchInfo: 79 | firstSubMesh: 0 80 | subMeshCount: 0 81 | m_StaticBatchRoot: {fileID: 0} 82 | m_ProbeAnchor: {fileID: 0} 83 | m_LightProbeVolumeOverride: {fileID: 0} 84 | m_ScaleInLightmap: 1 85 | m_ReceiveGI: 1 86 | m_PreserveUVs: 0 87 | m_IgnoreNormalsForChartDetection: 0 88 | m_ImportantGI: 0 89 | m_StitchLightmapSeams: 1 90 | m_SelectedEditorRenderState: 0 91 | m_MinimumChartSize: 4 92 | m_AutoUVMaxDistance: 0.5 93 | m_AutoUVMaxAngle: 89 94 | m_LightmapParameters: {fileID: 0} 95 | m_SortingLayerID: 0 96 | m_SortingLayer: 0 97 | m_SortingOrder: 0 98 | m_Sprite: {fileID: 21300000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 99 | m_Color: {r: 1, g: 1, b: 1, a: 1} 100 | m_FlipX: 0 101 | m_FlipY: 0 102 | m_DrawMode: 0 103 | m_Size: {x: 1, y: 1} 104 | m_AdaptiveModeThreshold: 0.5 105 | m_SpriteTileMode: 0 106 | m_WasSpriteAssigned: 1 107 | m_MaskInteraction: 0 108 | m_SpriteSortPoint: 0 109 | -------------------------------------------------------------------------------- /Assets/Runtime/P_SG_MultiLine.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 83bf2f7ad855bb8459435f204862f6e8 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Runtime/P_S_Line.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2543940257823055156 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: 7660889375252234219} 12 | - component: {fileID: 9212615753039092101} 13 | - component: {fileID: 7583879088528668018} 14 | m_Layer: 0 15 | m_Name: P_S_Line 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &7660889375252234219 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2543940257823055156} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 0} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!114 &9212615753039092101 36 | MonoBehaviour: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 2543940257823055156} 42 | m_Enabled: 1 43 | m_EditorHideFlags: 0 44 | m_Script: {fileID: 11500000, guid: d8e1bda1c13f4cc48834ba6c84513f52, type: 3} 45 | m_Name: 46 | m_EditorClassIdentifier: 47 | PointA: {x: -4, y: 4} 48 | PointB: {x: 4, y: -4} 49 | m_AutoApplyPositionChanges: 1 50 | m_Renderer: {fileID: 7583879088528668018} 51 | m_LineColorA: {r: 1, g: 0, b: 0, a: 1} 52 | m_LineColorB: {r: 1, g: 0, b: 0, a: 1} 53 | m_LineThickness: 4 54 | m_DottedLineLength: 99999 55 | m_DottedLineOffset: 0 56 | m_PositionsAreLocalSpace: 0 57 | m_UsesVectorialLineMaterial: 0 58 | m_camera: {fileID: 0} 59 | --- !u!212 &7583879088528668018 60 | SpriteRenderer: 61 | m_ObjectHideFlags: 0 62 | m_CorrespondingSourceObject: {fileID: 0} 63 | m_PrefabInstance: {fileID: 0} 64 | m_PrefabAsset: {fileID: 0} 65 | m_GameObject: {fileID: 2543940257823055156} 66 | m_Enabled: 1 67 | m_CastShadows: 0 68 | m_ReceiveShadows: 0 69 | m_DynamicOccludee: 1 70 | m_MotionVectors: 1 71 | m_LightProbeUsage: 1 72 | m_ReflectionProbeUsage: 1 73 | m_RayTracingMode: 0 74 | m_RayTraceProcedural: 0 75 | m_RenderingLayerMask: 1 76 | m_RendererPriority: 0 77 | m_Materials: 78 | - {fileID: 2100000, guid: 7bcdb1aa0bd14884a8fefe6dbb5d1b9a, type: 2} 79 | m_StaticBatchInfo: 80 | firstSubMesh: 0 81 | subMeshCount: 0 82 | m_StaticBatchRoot: {fileID: 0} 83 | m_ProbeAnchor: {fileID: 0} 84 | m_LightProbeVolumeOverride: {fileID: 0} 85 | m_ScaleInLightmap: 1 86 | m_ReceiveGI: 1 87 | m_PreserveUVs: 0 88 | m_IgnoreNormalsForChartDetection: 0 89 | m_ImportantGI: 0 90 | m_StitchLightmapSeams: 1 91 | m_SelectedEditorRenderState: 0 92 | m_MinimumChartSize: 4 93 | m_AutoUVMaxDistance: 0.5 94 | m_AutoUVMaxAngle: 89 95 | m_LightmapParameters: {fileID: 0} 96 | m_SortingLayerID: 0 97 | m_SortingLayer: 0 98 | m_SortingOrder: 0 99 | m_Sprite: {fileID: 21300000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 100 | m_Color: {r: 1, g: 1, b: 1, a: 1} 101 | m_FlipX: 0 102 | m_FlipY: 0 103 | m_DrawMode: 0 104 | m_Size: {x: 1, y: 1} 105 | m_AdaptiveModeThreshold: 0.5 106 | m_SpriteTileMode: 0 107 | m_WasSpriteAssigned: 1 108 | m_MaskInteraction: 0 109 | m_SpriteSortPoint: 0 110 | -------------------------------------------------------------------------------- /Assets/Runtime/P_S_Line.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1df5477d80da5844da8efe81a547a418 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Runtime/P_S_MultiLine.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &5626669553487636269 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: 8566530671122967141} 12 | - component: {fileID: 7503196689741130756} 13 | - component: {fileID: 6781811110391421473} 14 | m_Layer: 0 15 | m_Name: P_S_MultiLine 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &8566530671122967141 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 5626669553487636269} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 0} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!114 &7503196689741130756 36 | MonoBehaviour: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 5626669553487636269} 42 | m_Enabled: 1 43 | m_EditorHideFlags: 0 44 | m_Script: {fileID: 11500000, guid: 86bcaae1d96bce94c9eefbad2f72d234, type: 3} 45 | m_Name: 46 | m_EditorClassIdentifier: 47 | Points: 48 | - {x: 0, y: 0} 49 | - {x: 10, y: 4} 50 | - {x: 20, y: -8} 51 | m_Renderer: {fileID: 6781811110391421473} 52 | m_LineColor: {r: 1, g: 0, b: 0, a: 1} 53 | m_LineThickness: 4 54 | m_MaxPoints: 16 55 | m_AutoApplyPositionChanges: 1 56 | m_PositionsAreLocalSpace: 0 57 | m_camera: {fileID: 0} 58 | --- !u!212 &6781811110391421473 59 | SpriteRenderer: 60 | m_ObjectHideFlags: 0 61 | m_CorrespondingSourceObject: {fileID: 0} 62 | m_PrefabInstance: {fileID: 0} 63 | m_PrefabAsset: {fileID: 0} 64 | m_GameObject: {fileID: 5626669553487636269} 65 | m_Enabled: 1 66 | m_CastShadows: 0 67 | m_ReceiveShadows: 0 68 | m_DynamicOccludee: 1 69 | m_MotionVectors: 1 70 | m_LightProbeUsage: 1 71 | m_ReflectionProbeUsage: 1 72 | m_RayTracingMode: 0 73 | m_RayTraceProcedural: 0 74 | m_RenderingLayerMask: 1 75 | m_RendererPriority: 0 76 | m_Materials: 77 | - {fileID: 2100000, guid: 652b04d1ed15c234db19815b7611170f, type: 2} 78 | m_StaticBatchInfo: 79 | firstSubMesh: 0 80 | subMeshCount: 0 81 | m_StaticBatchRoot: {fileID: 0} 82 | m_ProbeAnchor: {fileID: 0} 83 | m_LightProbeVolumeOverride: {fileID: 0} 84 | m_ScaleInLightmap: 1 85 | m_ReceiveGI: 1 86 | m_PreserveUVs: 0 87 | m_IgnoreNormalsForChartDetection: 0 88 | m_ImportantGI: 0 89 | m_StitchLightmapSeams: 1 90 | m_SelectedEditorRenderState: 0 91 | m_MinimumChartSize: 4 92 | m_AutoUVMaxDistance: 0.5 93 | m_AutoUVMaxAngle: 89 94 | m_LightmapParameters: {fileID: 0} 95 | m_SortingLayerID: 0 96 | m_SortingLayer: 0 97 | m_SortingOrder: 0 98 | m_Sprite: {fileID: 21300000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 99 | m_Color: {r: 1, g: 1, b: 1, a: 1} 100 | m_FlipX: 0 101 | m_FlipY: 0 102 | m_DrawMode: 0 103 | m_Size: {x: 1, y: 1} 104 | m_AdaptiveModeThreshold: 0.5 105 | m_SpriteTileMode: 0 106 | m_WasSpriteAssigned: 1 107 | m_MaskInteraction: 0 108 | m_SpriteSortPoint: 0 109 | -------------------------------------------------------------------------------- /Assets/Runtime/P_S_MultiLine.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fe0c5c2471ed11749a28c083dcf1cf32 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Runtime/P_S_VectorialLine.prefab: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1 &2543940257823055156 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: 7660889375252234219} 12 | - component: {fileID: 9212615753039092101} 13 | - component: {fileID: 7583879088528668018} 14 | m_Layer: 0 15 | m_Name: P_S_VectorialLine 16 | m_TagString: Untagged 17 | m_Icon: {fileID: 0} 18 | m_NavMeshLayer: 0 19 | m_StaticEditorFlags: 0 20 | m_IsActive: 1 21 | --- !u!4 &7660889375252234219 22 | Transform: 23 | m_ObjectHideFlags: 0 24 | m_CorrespondingSourceObject: {fileID: 0} 25 | m_PrefabInstance: {fileID: 0} 26 | m_PrefabAsset: {fileID: 0} 27 | m_GameObject: {fileID: 2543940257823055156} 28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 29 | m_LocalPosition: {x: 0, y: 0, z: 0} 30 | m_LocalScale: {x: 1, y: 1, z: 1} 31 | m_Children: [] 32 | m_Father: {fileID: 0} 33 | m_RootOrder: 0 34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 35 | --- !u!114 &9212615753039092101 36 | MonoBehaviour: 37 | m_ObjectHideFlags: 0 38 | m_CorrespondingSourceObject: {fileID: 0} 39 | m_PrefabInstance: {fileID: 0} 40 | m_PrefabAsset: {fileID: 0} 41 | m_GameObject: {fileID: 2543940257823055156} 42 | m_Enabled: 1 43 | m_EditorHideFlags: 0 44 | m_Script: {fileID: 11500000, guid: d8e1bda1c13f4cc48834ba6c84513f52, type: 3} 45 | m_Name: 46 | m_EditorClassIdentifier: 47 | PointA: {x: -4, y: 4} 48 | PointB: {x: 4, y: -4} 49 | m_AutoApplyPositionChanges: 1 50 | m_Renderer: {fileID: 7583879088528668018} 51 | m_LineColorA: {r: 1, g: 0, b: 0, a: 1} 52 | m_LineColorB: {r: 1, g: 0, b: 0, a: 1} 53 | m_BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 54 | m_LineThickness: 4 55 | m_DottedLineLength: 99999 56 | m_DottedLineOffset: 0 57 | m_PositionsAreLocalSpace: 0 58 | m_UsesVectorialLineMaterial: 1 59 | m_LineTexture: {fileID: 0} 60 | m_LineTextureTiling: {x: 1, y: 1} 61 | m_LineTextureOffset: {x: 0, y: 0} 62 | m_Camera: {fileID: 0} 63 | --- !u!212 &7583879088528668018 64 | SpriteRenderer: 65 | m_ObjectHideFlags: 0 66 | m_CorrespondingSourceObject: {fileID: 0} 67 | m_PrefabInstance: {fileID: 0} 68 | m_PrefabAsset: {fileID: 0} 69 | m_GameObject: {fileID: 2543940257823055156} 70 | m_Enabled: 1 71 | m_CastShadows: 0 72 | m_ReceiveShadows: 0 73 | m_DynamicOccludee: 1 74 | m_MotionVectors: 1 75 | m_LightProbeUsage: 1 76 | m_ReflectionProbeUsage: 1 77 | m_RayTracingMode: 0 78 | m_RayTraceProcedural: 0 79 | m_RenderingLayerMask: 1 80 | m_RendererPriority: 0 81 | m_Materials: 82 | - {fileID: 2100000, guid: ebf2372f4e0ceea4584187ae48fa5123, type: 2} 83 | m_StaticBatchInfo: 84 | firstSubMesh: 0 85 | subMeshCount: 0 86 | m_StaticBatchRoot: {fileID: 0} 87 | m_ProbeAnchor: {fileID: 0} 88 | m_LightProbeVolumeOverride: {fileID: 0} 89 | m_ScaleInLightmap: 1 90 | m_ReceiveGI: 1 91 | m_PreserveUVs: 0 92 | m_IgnoreNormalsForChartDetection: 0 93 | m_ImportantGI: 0 94 | m_StitchLightmapSeams: 1 95 | m_SelectedEditorRenderState: 0 96 | m_MinimumChartSize: 4 97 | m_AutoUVMaxDistance: 0.5 98 | m_AutoUVMaxAngle: 89 99 | m_LightmapParameters: {fileID: 0} 100 | m_SortingLayerID: 0 101 | m_SortingLayer: 0 102 | m_SortingOrder: 0 103 | m_Sprite: {fileID: 21300000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 104 | m_Color: {r: 1, g: 1, b: 1, a: 1} 105 | m_FlipX: 0 106 | m_FlipY: 0 107 | m_DrawMode: 0 108 | m_Size: {x: 1, y: 1} 109 | m_AdaptiveModeThreshold: 0.5 110 | m_SpriteTileMode: 0 111 | m_WasSpriteAssigned: 1 112 | m_MaskInteraction: 0 113 | m_SpriteSortPoint: 0 114 | -------------------------------------------------------------------------------- /Assets/Runtime/P_S_VectorialLine.prefab.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: edb5d473edf3cf844bae2b9ac15053fc 3 | PrefabImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Runtime/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d6648afe080a3924cb0749c63a675b01 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Scripts/LineRenderer2D.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | using UnityEngine; 15 | 16 | #if UNITY_EDITOR 17 | using UnityEditor; 18 | #endif 19 | 20 | namespace Game.Core.Rendering 21 | { 22 | /// 23 | /// 24 | /// 25 | [ExecuteAlways] 26 | public class LineRenderer2D : MonoBehaviour 27 | { 28 | [Tooltip("The position of the endpoint A. Its world position depends on whether the Local Space options is enabled.")] 29 | public Vector2 PointA; 30 | 31 | [Tooltip("The position of the endpoint B. Its world position depends on whether the Local Space options is enabled.")] 32 | public Vector2 PointB; 33 | 34 | public Color LineColorA 35 | { 36 | get 37 | { 38 | return m_LineColorA; 39 | } 40 | } 41 | 42 | public Color LineColorB 43 | { 44 | get 45 | { 46 | return m_LineColorB; 47 | } 48 | } 49 | 50 | public Camera CurrentCamera 51 | { 52 | get 53 | { 54 | return m_Camera 55 | #if UNITY_EDITOR 56 | == null ? m_editorCamera : m_Camera 57 | #endif 58 | ; 59 | } 60 | 61 | set 62 | { 63 | m_Camera = value; 64 | int screenHeight = (int)m_Camera.orthographicSize * 2; 65 | m_pixelsPerUnit = m_Camera.pixelHeight / screenHeight; 66 | } 67 | } 68 | 69 | [Tooltip("When enabled, the position of the points is sent to the GPU once per frame without having to apply the changes.")] 70 | [SerializeField] 71 | protected bool m_AutoApplyPositionChanges; 72 | 73 | [Tooltip("The sprite renderer that defines the area of the screen where the line is to be drawn.")] 74 | [SerializeField] 75 | protected SpriteRenderer m_Renderer; 76 | 77 | [Tooltip("The color of the line at the endpoint A. If the color of the point B is different, the line will be filled with a color gradient.")] 78 | [SerializeField] 79 | protected Color m_LineColorA = Color.red; 80 | 81 | [Tooltip("The color of the line at the endpoint B. If the color of the point A is different, the line will be filled with a color gradient.")] 82 | [SerializeField] 83 | protected Color m_LineColorB = Color.red; 84 | 85 | [Tooltip("The color used in the area of the quad that is not filled with the line.")] 86 | [SerializeField] 87 | protected Color m_BackgroundColor = Color.clear; 88 | 89 | [Tooltip("The width of every point in the line, in pixels.")] 90 | [Min(0.0001f)] 91 | [SerializeField] 92 | protected float m_LineThickness = 4.0f; 93 | 94 | [Tooltip("The length of the dots of the line. Use big numbers to draw a continuous line.")] 95 | [SerializeField] 96 | protected float m_DottedLineLength = 99999.0f; 97 | 98 | [Tooltip("The offset of the dots of the line.")] 99 | [SerializeField] 100 | protected float m_DottedLineOffset = 0.0f; 101 | 102 | [Tooltip("When enabled, the world position of the parent is added to the position of the points which is assumed to be local.")] 103 | [SerializeField] 104 | protected bool m_PositionsAreLocalSpace = false; 105 | 106 | [Tooltip("Enable this when the line is drawn using the vectorial technique.")] 107 | [SerializeField] 108 | protected bool m_UsesVectorialLineMaterial; 109 | 110 | [Tooltip("A texture to draw on the line.")] 111 | [SerializeField] 112 | protected Texture2D m_LineTexture; 113 | 114 | [Tooltip("The tiling settings for the line texture.")] 115 | [SerializeField] 116 | protected Vector2 m_LineTextureTiling = Vector2.one; 117 | 118 | [Tooltip("The offset settings for the line texture.")] 119 | [SerializeField] 120 | protected Vector2 m_LineTextureOffset = Vector2.zero; 121 | 122 | [Tooltip("The camera used for calculating the actual thickness on screen.")] 123 | [SerializeField] 124 | protected Camera m_Camera; 125 | 126 | protected int PixelsPerUnit 127 | { 128 | get 129 | { 130 | #if UNITY_EDITOR 131 | 132 | if(!Application.isPlaying && m_editorCamera != null) 133 | { 134 | return Mathf.CeilToInt(m_editorCamera.pixelHeight / (m_editorCamera.orthographicSize * 2)); 135 | } 136 | 137 | #endif 138 | 139 | return m_pixelsPerUnit; 140 | } 141 | } 142 | 143 | protected int m_pixelsPerUnit; 144 | protected bool m_isPositionsDirty = false; 145 | protected MaterialPropertyBlock m_materialPropertyBlock; 146 | 147 | #if UNITY_EDITOR 148 | 149 | protected Camera m_editorCamera; 150 | 151 | #endif 152 | 153 | protected static class ShaderParams 154 | { 155 | public static int LineColorA = Shader.PropertyToID("_LineColorA"); 156 | public static int LineColorB = Shader.PropertyToID("_LineColorB"); 157 | public static int LineColor = Shader.PropertyToID("_LineColor"); 158 | public static int Thickness = Shader.PropertyToID("_Thickness"); 159 | public static int DottedLineLength = Shader.PropertyToID("_DottedLineLength"); 160 | public static int DottedLineOffset = Shader.PropertyToID("_DottedLineOffset"); 161 | public static int BackgroundColor = Shader.PropertyToID("_BackgroundColor"); 162 | public static int LineTexture = Shader.PropertyToID("_LineTexture"); 163 | public static int LineTexture_ST = Shader.PropertyToID("_LineTexture_ST"); 164 | public static int Origin = Shader.PropertyToID("_Origin"); 165 | public static int PointA = Shader.PropertyToID("_PointA"); 166 | public static int PointB = Shader.PropertyToID("_PointB"); 167 | } 168 | 169 | protected virtual void Start() 170 | { 171 | if(!Application.isPlaying) 172 | { 173 | return; 174 | } 175 | 176 | int screenHeight = (int)CurrentCamera.orthographicSize * 2; 177 | m_pixelsPerUnit = CurrentCamera.pixelHeight / screenHeight; 178 | 179 | ApplyPointPositionChanges(); 180 | 181 | if (CurrentCamera != null) 182 | { 183 | m_Renderer.GetPropertyBlock(m_materialPropertyBlock); 184 | RefreshMaterial(); 185 | } 186 | } 187 | 188 | protected virtual void OnEnable() 189 | { 190 | if(m_materialPropertyBlock == null) 191 | { 192 | m_materialPropertyBlock = new MaterialPropertyBlock(); 193 | } 194 | 195 | if(CurrentCamera != null) 196 | { 197 | m_Renderer.GetPropertyBlock(m_materialPropertyBlock); 198 | RefreshMaterial(); 199 | } 200 | } 201 | 202 | protected virtual void LateUpdate() 203 | { 204 | if(CurrentCamera != null && 205 | (m_isPositionsDirty || m_AutoApplyPositionChanges)) 206 | { 207 | m_isPositionsDirty = false; 208 | SendPointPositionsToGPU(); 209 | } 210 | } 211 | 212 | #if UNITY_EDITOR 213 | 214 | protected virtual void OnRenderObject() 215 | { 216 | if (m_editorCamera == null && !Application.isPlaying) 217 | { 218 | Camera[] sceneCameras = SceneView.GetAllSceneCameras(); 219 | 220 | if (sceneCameras.Length > 0) 221 | { 222 | m_editorCamera = sceneCameras[0]; 223 | OnEnable(); 224 | } 225 | } 226 | 227 | if(m_UsesVectorialLineMaterial && !Application.isPlaying) 228 | { 229 | SendPointPositionsToGPU(); 230 | } 231 | } 232 | 233 | #endif 234 | 235 | protected virtual void RefreshMaterial() 236 | { 237 | m_materialPropertyBlock.SetColor(ShaderParams.LineColorA, m_LineColorA); 238 | m_materialPropertyBlock.SetColor(ShaderParams.LineColorB, m_LineColorB); 239 | m_materialPropertyBlock.SetFloat(ShaderParams.Thickness, m_LineThickness); 240 | m_materialPropertyBlock.SetFloat(ShaderParams.DottedLineLength, m_DottedLineLength); 241 | m_materialPropertyBlock.SetFloat(ShaderParams.DottedLineOffset, m_DottedLineOffset); 242 | m_materialPropertyBlock.SetColor(ShaderParams.BackgroundColor, m_BackgroundColor); 243 | m_materialPropertyBlock.SetColor(ShaderParams.LineColor, m_LineColorA); 244 | 245 | if (m_LineTexture != null) 246 | { 247 | m_materialPropertyBlock.SetTexture(ShaderParams.LineTexture, m_LineTexture); 248 | } 249 | else 250 | { 251 | m_materialPropertyBlock.SetTexture(ShaderParams.LineTexture, Texture2D.whiteTexture); 252 | } 253 | 254 | m_materialPropertyBlock.SetVector(ShaderParams.LineTexture_ST, new Vector4(m_LineTextureTiling.x, m_LineTextureTiling.y, m_LineTextureOffset.x, m_LineTextureOffset.y)); 255 | 256 | if(!Application.isPlaying || m_AutoApplyPositionChanges) 257 | { 258 | SendPointPositionsToGPU(); 259 | } 260 | } 261 | 262 | /// 263 | /// 264 | /// 265 | /// 266 | public void SetColorA(Color newLineColor) 267 | { 268 | m_LineColorA = newLineColor; 269 | 270 | m_materialPropertyBlock.SetColor(ShaderParams.LineColorA, m_LineColorA); 271 | m_materialPropertyBlock.SetColor(ShaderParams.LineColor, m_LineColorA); 272 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 273 | } 274 | 275 | /// 276 | /// 277 | /// 278 | /// 279 | public void SetColorB(Color newLineColor) 280 | { 281 | m_LineColorB = newLineColor; 282 | 283 | m_materialPropertyBlock.SetColor(ShaderParams.LineColorB, m_LineColorB); 284 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 285 | } 286 | 287 | /// 288 | /// 289 | /// 290 | /// 291 | public void SetThickness(float newThickness) 292 | { 293 | m_LineThickness = newThickness; 294 | 295 | m_materialPropertyBlock.SetFloat(ShaderParams.Thickness, m_LineThickness); 296 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 297 | } 298 | 299 | /// 300 | /// 301 | /// 302 | /// 303 | public void SetDottedLineLength(float newDottedLineLength) 304 | { 305 | m_DottedLineLength = newDottedLineLength; 306 | 307 | m_materialPropertyBlock.SetFloat(ShaderParams.DottedLineLength, m_DottedLineLength); 308 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 309 | } 310 | 311 | /// 312 | /// 313 | /// 314 | /// 315 | public void SetDottedLineOffset(float newDottedLineOffset) 316 | { 317 | m_DottedLineOffset = newDottedLineOffset; 318 | 319 | m_materialPropertyBlock.SetFloat(ShaderParams.DottedLineOffset, m_DottedLineOffset); 320 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 321 | } 322 | 323 | /// 324 | /// 325 | /// 326 | /// 327 | /// 328 | public void SetTextureTilingAndOffset(Vector2 newTiling, Vector2 newOffset) 329 | { 330 | m_materialPropertyBlock.SetVector(ShaderParams.LineTexture_ST, new Vector4(newTiling.x, newTiling.y, newOffset.x, newOffset.y)); 331 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 332 | } 333 | 334 | /// 335 | /// 336 | /// 337 | /// 338 | public void SetBackgroundColor(Color newBackgroundColor) 339 | { 340 | m_BackgroundColor = newBackgroundColor; 341 | 342 | m_materialPropertyBlock.SetColor(ShaderParams.BackgroundColor, m_BackgroundColor); 343 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 344 | } 345 | 346 | /// 347 | /// 348 | /// 349 | /// 350 | public void SetLineTexture(Texture2D newTexture) 351 | { 352 | m_LineTexture = newTexture; 353 | 354 | if (m_LineTexture != null) 355 | { 356 | m_materialPropertyBlock.SetTexture(ShaderParams.LineTexture, m_LineTexture); 357 | } 358 | else 359 | { 360 | m_materialPropertyBlock.SetTexture(ShaderParams.LineTexture, Texture2D.whiteTexture); 361 | } 362 | 363 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 364 | } 365 | 366 | /// 367 | /// 368 | /// 369 | /// 370 | public void SetLineTextureTiling(Vector2 newLineTextureTiling) 371 | { 372 | m_LineTextureTiling = newLineTextureTiling; 373 | 374 | SetTextureTilingAndOffset(m_LineTextureTiling, m_LineTextureOffset); 375 | } 376 | 377 | /// 378 | /// 379 | /// 380 | /// 381 | public void SetLineTextureOffset(Vector2 newLineTextureOffset) 382 | { 383 | m_LineTextureOffset = newLineTextureOffset; 384 | 385 | SetTextureTilingAndOffset(m_LineTextureTiling, m_LineTextureOffset); 386 | } 387 | 388 | /// 389 | /// 390 | /// 391 | public void ApplyPointPositionChanges() 392 | { 393 | m_isPositionsDirty = true; 394 | } 395 | 396 | protected virtual void SendPointPositionsToGPU() 397 | { 398 | Vector2 parentPosition = Vector2.zero; 399 | 400 | if(m_PositionsAreLocalSpace && transform.parent != null) 401 | { 402 | parentPosition = transform.parent.position; 403 | } 404 | 405 | if(m_UsesVectorialLineMaterial) 406 | { 407 | m_materialPropertyBlock.SetVector(ShaderParams.PointA, (Vector2)CurrentCamera.WorldToScreenPoint(PointA + parentPosition)); 408 | m_materialPropertyBlock.SetVector(ShaderParams.PointB, (Vector2)CurrentCamera.WorldToScreenPoint(PointB + parentPosition)); 409 | 410 | Vector2 origin = CurrentCamera.WorldToScreenPoint(Vector2.zero); 411 | 412 | #if UNITY_EDITOR 413 | 414 | // This allows to draw the line on the scene view at the proper position 415 | if(!Application.isPlaying && m_editorCamera != null) 416 | { 417 | origin = m_editorCamera.WorldToScreenPoint(Vector2.zero); 418 | 419 | m_materialPropertyBlock.SetVector(ShaderParams.PointA, (Vector2)m_editorCamera.WorldToScreenPoint(PointA + parentPosition)); 420 | m_materialPropertyBlock.SetVector(ShaderParams.PointB, (Vector2)m_editorCamera.WorldToScreenPoint(PointB + parentPosition)); 421 | } 422 | 423 | #endif 424 | 425 | origin = new Vector2(Mathf.Round(origin.x), Mathf.Round(origin.y)); 426 | m_materialPropertyBlock.SetVector(ShaderParams.Origin, origin); 427 | } 428 | else 429 | { 430 | m_materialPropertyBlock.SetVector(ShaderParams.PointA, PointA + parentPosition); 431 | m_materialPropertyBlock.SetVector(ShaderParams.PointB, PointB + parentPosition); 432 | } 433 | 434 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 435 | 436 | RefreshSpriteTransform(); 437 | } 438 | 439 | protected virtual void RefreshSpriteTransform() 440 | { 441 | Vector2 parentPosition = Vector2.zero; 442 | 443 | if (m_PositionsAreLocalSpace && transform.parent != null) 444 | { 445 | parentPosition = transform.parent.position; 446 | } 447 | 448 | // This avoids the pixel blocks of the line to be cut-off 449 | float MINIMUM_THICKNESS = PixelsPerUnit == 0 ? m_LineThickness 450 | : m_LineThickness / PixelsPerUnit; 451 | MINIMUM_THICKNESS *= 1.6f; // Adjustment to make sure the width of the mesh is enough for all slopes 452 | 453 | Vector2 lineDirection = (PointB - PointA).normalized; 454 | Vector2 lineDirectionPerpendicular = Vector2.Perpendicular(lineDirection); 455 | transform.localScale = new Vector3((PointA - PointB).magnitude + MINIMUM_THICKNESS * 2.0f, MINIMUM_THICKNESS * 2.0f, 1.0f); 456 | transform.rotation = Quaternion.AngleAxis(Vector2.SignedAngle(lineDirection, Vector2.right), Vector3.back); 457 | transform.position = parentPosition + PointA - lineDirection * MINIMUM_THICKNESS + lineDirectionPerpendicular * MINIMUM_THICKNESS; 458 | 459 | if (transform.parent != null) 460 | { 461 | Vector3 parentScale = transform.parent.localScale; 462 | transform.localScale = new Vector3(transform.lossyScale.x / parentScale.x, transform.lossyScale.y / parentScale.y, 1.0f); 463 | } 464 | } 465 | 466 | private static Vector4 Calculate2DWorldBoundingBox(Vector2 pointA, Vector2 pointB) 467 | { 468 | Vector4 bounds = new Vector4(float.MaxValue, -float.MaxValue, -float.MaxValue, float.MaxValue); 469 | 470 | bounds.x = bounds.x > pointA.x ? pointA.x 471 | : bounds.x; 472 | bounds.y = bounds.y < pointA.y ? pointA.y 473 | : bounds.y; 474 | bounds.z = bounds.z < pointA.x ? pointA.x 475 | : bounds.z; 476 | bounds.w = bounds.w > pointA.y ? pointA.y 477 | : bounds.w; 478 | bounds.x = bounds.x > pointB.x ? pointB.x 479 | : bounds.x; 480 | bounds.y = bounds.y < pointB.y ? pointB.y 481 | : bounds.y; 482 | bounds.z = bounds.z < pointB.x ? pointB.x 483 | : bounds.z; 484 | bounds.w = bounds.w > pointB.y ? pointB.y 485 | : bounds.w; 486 | 487 | bounds.z -= bounds.x; 488 | bounds.w = bounds.y - bounds.w; 489 | 490 | return bounds; 491 | } 492 | 493 | #if UNITY_EDITOR 494 | 495 | private void OnDrawGizmos() 496 | { 497 | Vector2 parentPosition = Vector2.zero; 498 | 499 | if (m_PositionsAreLocalSpace && transform.parent != null) 500 | { 501 | parentPosition = transform.parent.position; 502 | } 503 | 504 | Gizmos.color = Color.cyan; 505 | Gizmos.DrawRay(PointA + parentPosition, Vector2.up); 506 | Gizmos.DrawRay(PointA + parentPosition, Vector2.right); 507 | Gizmos.DrawRay(PointB + parentPosition, Vector2.up); 508 | Gizmos.DrawRay(PointB + parentPosition, Vector2.right); 509 | 510 | Gizmos.color = Color.magenta; 511 | Gizmos.DrawLine(PointA + parentPosition, PointB + parentPosition); 512 | } 513 | 514 | [CustomEditor(typeof(LineRenderer2D))] 515 | protected class LineRenderer2DEditor : UnityEditor.Editor 516 | { 517 | private static class Texts 518 | { 519 | public static GUIContent PixelsPerUnit = new GUIContent("Pixels per unit: ", "The detected pixels per Unity spacial unit."); 520 | public static GUIContent PointA = new GUIContent("A"); 521 | public static GUIContent PointB = new GUIContent("B"); 522 | } 523 | 524 | protected SerializedProperty m_pointA; 525 | protected SerializedProperty m_pointB; 526 | protected SerializedProperty m_lineColorA; 527 | protected SerializedProperty m_lineColorB; 528 | protected SerializedProperty m_lineThickness; 529 | protected SerializedProperty m_dottedLineLength; 530 | protected SerializedProperty m_dottedLineOffset; 531 | protected SerializedProperty m_backgroundColor; 532 | protected SerializedProperty m_lineTexture; 533 | protected SerializedProperty m_lineTextureTiling; 534 | protected SerializedProperty m_lineTextureOffset; 535 | protected SerializedProperty m_positionsAreLocalSpace; 536 | protected SerializedProperty m_autoApplyPositionChanges; 537 | protected SerializedProperty m_usesVectorialLineMaterial; 538 | protected SerializedProperty m_camera; 539 | protected SerializedProperty m_renderer; 540 | 541 | protected virtual void OnEnable() 542 | { 543 | m_pointA = serializedObject.FindProperty("PointA"); 544 | m_pointB = serializedObject.FindProperty("PointB"); 545 | m_lineColorA = serializedObject.FindProperty("m_LineColorA"); 546 | m_lineColorB = serializedObject.FindProperty("m_LineColorB"); 547 | m_lineThickness = serializedObject.FindProperty("m_LineThickness"); 548 | m_dottedLineLength = serializedObject.FindProperty("m_DottedLineLength"); 549 | m_dottedLineOffset = serializedObject.FindProperty("m_DottedLineOffset"); 550 | m_backgroundColor = serializedObject.FindProperty("m_BackgroundColor"); 551 | m_lineTexture = serializedObject.FindProperty("m_LineTexture"); 552 | m_lineTextureTiling = serializedObject.FindProperty("m_LineTextureTiling"); 553 | m_lineTextureOffset = serializedObject.FindProperty("m_LineTextureOffset"); 554 | m_positionsAreLocalSpace = serializedObject.FindProperty("m_PositionsAreLocalSpace"); 555 | m_autoApplyPositionChanges = serializedObject.FindProperty("m_AutoApplyPositionChanges"); 556 | m_usesVectorialLineMaterial = serializedObject.FindProperty("m_UsesVectorialLineMaterial"); 557 | m_camera = serializedObject.FindProperty("m_Camera"); 558 | m_renderer = serializedObject.FindProperty("m_Renderer"); 559 | } 560 | 561 | public override void OnInspectorGUI() 562 | { 563 | EditorGUILayout.BeginVertical(); 564 | { 565 | EditorGUI.BeginChangeCheck(); 566 | { 567 | DrawProperties(); 568 | } 569 | if(EditorGUI.EndChangeCheck()) 570 | { 571 | serializedObject.ApplyModifiedProperties(); 572 | 573 | (target as LineRenderer2D).RefreshMaterial(); 574 | } 575 | } 576 | EditorGUILayout.EndVertical(); 577 | } 578 | 579 | protected virtual void DrawProperties() 580 | { 581 | EditorGUILayout.PropertyField(m_pointA); 582 | EditorGUILayout.PropertyField(m_pointB); 583 | EditorGUILayout.PropertyField(m_lineColorA); 584 | EditorGUILayout.PropertyField(m_lineColorB); 585 | EditorGUILayout.PropertyField(m_lineThickness); 586 | EditorGUILayout.PropertyField(m_dottedLineLength); 587 | EditorGUILayout.PropertyField(m_dottedLineOffset); 588 | EditorGUILayout.PropertyField(m_backgroundColor); 589 | EditorGUILayout.PropertyField(m_lineTexture); 590 | EditorGUILayout.PropertyField(m_lineTextureTiling); 591 | EditorGUILayout.PropertyField(m_lineTextureOffset); 592 | EditorGUILayout.PropertyField(m_positionsAreLocalSpace); 593 | EditorGUILayout.PropertyField(m_autoApplyPositionChanges); 594 | EditorGUILayout.PropertyField(m_usesVectorialLineMaterial); 595 | EditorGUILayout.PropertyField(m_camera); 596 | EditorGUILayout.PropertyField(m_renderer); 597 | EditorGUILayout.LabelField(new GUIContent(Texts.PixelsPerUnit.text + (target as LineRenderer2D).PixelsPerUnit, Texts.PixelsPerUnit.tooltip)); 598 | } 599 | 600 | protected void OnSceneGUI() 601 | { 602 | float handleSize = HandleUtility.GetHandleSize(Vector3.zero) * 0.1f; 603 | 604 | Vector2 pointA; 605 | Vector2 pointB; 606 | 607 | EditorGUI.BeginChangeCheck(); 608 | { 609 | pointA = Handles.PositionHandle(m_pointA.vector2Value, Quaternion.identity); 610 | pointB = Handles.PositionHandle(m_pointB.vector2Value, Quaternion.identity); 611 | 612 | Handles.Label(pointA + Vector2.down * handleSize, Texts.PointA); 613 | Handles.Label(pointB + Vector2.down * handleSize, Texts.PointB); 614 | } 615 | if(EditorGUI.EndChangeCheck()) 616 | { 617 | Undo.RecordObject(target, "Line point moved"); 618 | 619 | LineRenderer2D lineRenderer = target as LineRenderer2D; 620 | lineRenderer.PointA = pointA; 621 | lineRenderer.PointB = pointB; 622 | 623 | serializedObject.Update(); 624 | } 625 | } 626 | } 627 | 628 | #endif 629 | 630 | } 631 | } -------------------------------------------------------------------------------- /Assets/Runtime/Scripts/LineRenderer2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d8e1bda1c13f4cc48834ba6c84513f52 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Runtime/Scripts/MultiLineRenderer2D.cs: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | using System.Collections.Generic; 15 | using UnityEngine; 16 | 17 | #if UNITY_EDITOR 18 | using UnityEditor; 19 | #endif 20 | 21 | namespace Game.Core.Rendering 22 | { 23 | /// 24 | /// 25 | /// 26 | [ExecuteAlways] 27 | public class MultiLineRenderer2D : MonoBehaviour 28 | { 29 | [Tooltip("The position of every point in the line. Its world position depends on whether the Local Space options is enabled.")] 30 | public List Points = new List(); 31 | 32 | public Camera CurrentCamera 33 | { 34 | get 35 | { 36 | return m_Camera 37 | #if UNITY_EDITOR 38 | == null ? m_editorCamera : m_Camera 39 | #endif 40 | ; 41 | } 42 | 43 | set 44 | { 45 | m_Camera = value; 46 | int screenHeight = (int)m_Camera.orthographicSize * 2; 47 | m_pixelsPerUnit = m_Camera.pixelHeight / screenHeight; 48 | } 49 | } 50 | 51 | [Tooltip("The sprite renderer that defines the area of the screen where the line is to be drawn.")] 52 | [SerializeField] 53 | protected SpriteRenderer m_Renderer; 54 | 55 | [Tooltip("The color of the line.")] 56 | [SerializeField] 57 | protected Color m_LineColor = Color.red; 58 | 59 | [Tooltip("The color used in the area of the quad that is not filled with the line.")] 60 | [SerializeField] 61 | protected Color m_BackgroundColor = Color.clear; 62 | 63 | [Tooltip("The width of every point in the line, in pixels.")] 64 | [SerializeField] 65 | protected float m_LineThickness = 4.0f; 66 | 67 | [Tooltip("The maximum points the line can contain.")] 68 | [SerializeField] 69 | protected int m_MaxPoints = 80; 70 | 71 | [Tooltip("When enabled, the position of the points is sent to the GPU once per frame without having to apply the changes.")] 72 | [SerializeField] 73 | protected bool m_AutoApplyPositionChanges; 74 | 75 | [Tooltip("When enabled, the world position of the parent is added to the position of the points which is assumed to be local.")] 76 | [SerializeField] 77 | protected bool m_PositionsAreLocalSpace = false; 78 | 79 | [Tooltip("The camera used for calculating the actual thickness on screen.")] 80 | [SerializeField] 81 | protected Camera m_Camera; 82 | 83 | protected int PixelsPerUnit 84 | { 85 | get 86 | { 87 | #if UNITY_EDITOR 88 | 89 | if (!Application.isPlaying && m_editorCamera != null) 90 | { 91 | return Mathf.CeilToInt(m_editorCamera.pixelHeight / (m_editorCamera.orthographicSize * 2)); 92 | } 93 | 94 | #endif 95 | 96 | return m_pixelsPerUnit; 97 | } 98 | } 99 | 100 | protected int m_pointsCount; 101 | protected int m_packedPointsCount; 102 | protected int m_pixelsPerUnit; 103 | 104 | protected Texture2D m_packedPointsTexture; 105 | protected Color[] m_packedPoints; 106 | protected bool m_isPositionsDirty = false; 107 | protected bool m_isLayoutDirty = false; 108 | protected MaterialPropertyBlock m_materialPropertyBlock; 109 | 110 | #if UNITY_EDITOR 111 | 112 | protected Camera m_editorCamera; 113 | 114 | #endif 115 | 116 | protected static class ShaderParams 117 | { 118 | public static int LineColor = Shader.PropertyToID("_LineColor"); 119 | public static int Thickness = Shader.PropertyToID("_Thickness"); 120 | public static int BackgroundColor = Shader.PropertyToID("_BackgroundColor"); 121 | public static int Origin = Shader.PropertyToID("_Origin"); 122 | public static int PointsCount = Shader.PropertyToID("_PointsCount"); 123 | public static int PackedPointsCount = Shader.PropertyToID("_PackedPointsCount"); 124 | public static int PackedPoints = Shader.PropertyToID("_PackedPoints"); 125 | } 126 | 127 | /// 128 | /// Establishes the maximum amount of points the line can render. 129 | /// 130 | /// The maximum amount of points that can be rendered by this line. 131 | public void SetMaxPoints(int maximum) 132 | { 133 | m_MaxPoints = maximum; 134 | ApplyLayoutChanges(); 135 | } 136 | 137 | protected virtual void Start() 138 | { 139 | if(!Application.isPlaying) 140 | { 141 | return; 142 | } 143 | 144 | int screenHeight = (int)CurrentCamera.orthographicSize * 2; 145 | m_pixelsPerUnit = CurrentCamera.pixelHeight / screenHeight; 146 | 147 | ApplyLayoutChanges(); 148 | ApplyPointPositionChanges(); 149 | 150 | if (CurrentCamera != null) 151 | { 152 | m_Renderer.GetPropertyBlock(m_materialPropertyBlock); 153 | RefreshMaterial(); 154 | } 155 | } 156 | 157 | protected virtual void OnEnable() 158 | { 159 | if (m_materialPropertyBlock == null) 160 | { 161 | m_materialPropertyBlock = new MaterialPropertyBlock(); 162 | } 163 | 164 | ApplyLayoutChanges(); 165 | ApplyPointPositionChanges(); 166 | 167 | if(CurrentCamera != null) 168 | { 169 | m_Renderer.GetPropertyBlock(m_materialPropertyBlock); 170 | RefreshMaterial(); 171 | } 172 | } 173 | 174 | protected virtual void LateUpdate() 175 | { 176 | if(CurrentCamera == null) 177 | { 178 | return; 179 | } 180 | 181 | if (m_isLayoutDirty) 182 | { 183 | m_isLayoutDirty = false; 184 | SendLayoutToGPU(); 185 | } 186 | 187 | if(m_isPositionsDirty || m_AutoApplyPositionChanges) 188 | { 189 | m_isPositionsDirty = false; 190 | SendPointPositionsToGPU(); 191 | } 192 | } 193 | 194 | #if UNITY_EDITOR 195 | 196 | protected virtual void OnRenderObject() 197 | { 198 | if (m_editorCamera == null && !Application.isPlaying) 199 | { 200 | Camera[] sceneCameras = SceneView.GetAllSceneCameras(); 201 | 202 | if (sceneCameras.Length > 0) 203 | { 204 | m_editorCamera = sceneCameras[0]; 205 | OnEnable(); 206 | } 207 | } 208 | } 209 | 210 | #endif 211 | 212 | /// 213 | /// 214 | /// 215 | /// 216 | public void SetColor(Color newLineColor) 217 | { 218 | m_LineColor = newLineColor; 219 | 220 | m_materialPropertyBlock.SetColor(ShaderParams.LineColor, m_LineColor); 221 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 222 | } 223 | 224 | /// 225 | /// 226 | /// 227 | /// 228 | public void SetThickness(float newThickness) 229 | { 230 | m_LineThickness = newThickness; 231 | 232 | m_materialPropertyBlock.SetFloat(ShaderParams.Thickness, m_LineThickness); 233 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 234 | } 235 | 236 | /// 237 | /// Marks the layout of the line (the number of points) as dirty, so the new values will be sent to the GPU right before the line is rendered again. 238 | /// 239 | public void ApplyLayoutChanges() 240 | { 241 | m_isLayoutDirty = true; 242 | } 243 | 244 | /// 245 | /// Marks the positions of the points as dirty, so the new values will be sent to the GPU right before the line is rendered again. 246 | /// 247 | public void ApplyPointPositionChanges() 248 | { 249 | m_isPositionsDirty = true; 250 | } 251 | 252 | protected void SendLayoutToGPU() 253 | { 254 | m_pointsCount = Mathf.Min(Points.Count, m_MaxPoints); 255 | m_packedPointsCount = Mathf.CeilToInt(m_pointsCount * 0.5f); 256 | 257 | if (m_packedPoints == null || m_packedPoints.Length < m_packedPointsCount) 258 | { 259 | m_packedPoints = new Color[m_packedPointsCount]; 260 | } 261 | 262 | if(m_packedPointsTexture == null || m_packedPointsTexture.width < m_packedPointsCount) 263 | { 264 | m_packedPointsTexture = new Texture2D(m_packedPointsCount, 1, TextureFormat.RGBAFloat, false, true); 265 | } 266 | 267 | m_materialPropertyBlock.SetTexture(ShaderParams.PackedPoints, m_packedPointsTexture); 268 | m_materialPropertyBlock.SetFloat(ShaderParams.PointsCount, m_pointsCount); 269 | m_materialPropertyBlock.SetFloat(ShaderParams.PackedPointsCount, m_packedPointsCount); 270 | } 271 | 272 | protected virtual void SendPointPositionsToGPU() 273 | { 274 | if (Points.Count == 0) 275 | { 276 | return; 277 | } 278 | 279 | RefreshSpriteTransform(); 280 | 281 | Vector2 parentPosition = Vector2.zero; 282 | 283 | if (m_PositionsAreLocalSpace && transform.parent != null) 284 | { 285 | parentPosition = transform.parent.position; 286 | } 287 | 288 | // Packs the points in colors that contain 2 points each 289 | for (int j = 0; j < m_packedPointsCount; ++j) 290 | { 291 | m_packedPoints[j].r = Points[j * 2].x + parentPosition.x; 292 | m_packedPoints[j].g = Points[j * 2].y + parentPosition.y; 293 | 294 | if (j * 2 + 1 >= m_pointsCount) 295 | { 296 | break; 297 | } 298 | 299 | m_packedPoints[j].b = Points[j * 2 + 1].x + parentPosition.x; 300 | m_packedPoints[j].a = Points[j * 2 + 1].y + parentPosition.y; 301 | } 302 | 303 | m_packedPointsTexture.SetPixels(0, 0, m_packedPointsCount, 1, m_packedPoints); 304 | m_packedPointsTexture.Apply(); 305 | } 306 | 307 | protected virtual void RefreshSpriteTransform() 308 | { 309 | Vector2 parentPosition = Vector2.zero; 310 | 311 | if (m_PositionsAreLocalSpace && transform.parent != null) 312 | { 313 | parentPosition = transform.parent.position; 314 | } 315 | 316 | // This avoids the pixel blocks of the line to be cut-off 317 | float MINIMUM_THICKNESS = m_pixelsPerUnit == 0 ? m_LineThickness 318 | : m_LineThickness / m_pixelsPerUnit; 319 | 320 | Vector4 worldBounds = Calculate2DWorldBoundingBox(Points); 321 | worldBounds.x -= MINIMUM_THICKNESS; 322 | worldBounds.y += MINIMUM_THICKNESS; 323 | worldBounds.z += 2 * MINIMUM_THICKNESS; 324 | worldBounds.w += 2 * MINIMUM_THICKNESS; 325 | transform.localScale = new Vector3(worldBounds.z, worldBounds.w, 1.0f); 326 | transform.position = new Vector2(worldBounds.x + parentPosition.x, worldBounds.y + parentPosition.y); 327 | transform.rotation = Quaternion.identity; 328 | 329 | if (transform.parent != null) 330 | { 331 | Vector3 parentScale = transform.parent.localScale; 332 | transform.localScale = new Vector3(transform.localScale.x / parentScale.x, transform.localScale.y / parentScale.y, 1.0f); 333 | } 334 | } 335 | 336 | private static Vector4 Calculate2DWorldBoundingBox(List points) 337 | { 338 | Vector4 bounds = new Vector4(float.MaxValue, -float.MaxValue, -float.MaxValue, float.MaxValue); 339 | 340 | for (int i = 0; i < points.Count; ++i) 341 | { 342 | bounds.x = bounds.x > points[i].x ? points[i].x 343 | : bounds.x; 344 | bounds.y = bounds.y < points[i].y ? points[i].y 345 | : bounds.y; 346 | bounds.z = bounds.z < points[i].x ? points[i].x 347 | : bounds.z; 348 | bounds.w = bounds.w > points[i].y ? points[i].y 349 | : bounds.w; 350 | } 351 | 352 | bounds.z -= bounds.x; 353 | bounds.w = bounds.y - bounds.w; 354 | 355 | return bounds; 356 | } 357 | 358 | protected virtual void RefreshMaterial() 359 | { 360 | m_materialPropertyBlock.SetColor(ShaderParams.LineColor, m_LineColor); 361 | m_materialPropertyBlock.SetFloat(ShaderParams.Thickness, m_LineThickness); 362 | m_materialPropertyBlock.SetColor(ShaderParams.BackgroundColor, m_BackgroundColor); 363 | 364 | #if UNITY_EDITOR 365 | 366 | if(m_isLayoutDirty) 367 | { 368 | m_isLayoutDirty = false; 369 | SendLayoutToGPU(); 370 | } 371 | 372 | if (m_isPositionsDirty && (!Application.isPlaying || m_AutoApplyPositionChanges)) 373 | { 374 | m_isPositionsDirty = false; 375 | SendPointPositionsToGPU(); 376 | } 377 | 378 | #endif 379 | m_Renderer.SetPropertyBlock(m_materialPropertyBlock); 380 | 381 | #if UNITY_EDITOR 382 | 383 | SceneView.RepaintAll(); 384 | 385 | #endif 386 | 387 | } 388 | 389 | #if UNITY_EDITOR 390 | 391 | protected virtual void OnDrawGizmos() 392 | { 393 | Vector2 parentPosition = Vector2.zero; 394 | 395 | if (m_PositionsAreLocalSpace && transform.parent != null) 396 | { 397 | parentPosition = transform.parent.position; 398 | } 399 | 400 | for (int i = 0; i < Points.Count; ++i) 401 | { 402 | Gizmos.color = Color.cyan; 403 | Gizmos.DrawRay(Points[i] + parentPosition, Vector2.up); 404 | Gizmos.DrawRay(Points[i] + parentPosition, Vector2.right); 405 | 406 | if (i < Points.Count - 1) 407 | { 408 | Gizmos.color = Color.magenta; 409 | Gizmos.DrawLine(Points[i] + parentPosition, Points[i + 1] + parentPosition); 410 | } 411 | } 412 | } 413 | 414 | [CustomEditor(typeof(MultiLineRenderer2D))] 415 | protected class MultiLineRenderer2DEditor : UnityEditor.Editor 416 | { 417 | private static class Texts 418 | { 419 | public static GUIContent PixelsPerUnit = new GUIContent("Pixels per unit: ", "The detected pixels per Unity spacial unit."); 420 | public static GUIContent PointsCount = new GUIContent("Points count: ", "The actual amount of points in the line."); 421 | public static GUIContent PackedPointsCount = new GUIContent("Packed points count: ", "The amount of packages that contain 2 points each."); 422 | } 423 | 424 | protected SerializedProperty m_points; 425 | protected SerializedProperty m_maxPoints; 426 | protected SerializedProperty m_lineThickness; 427 | protected SerializedProperty m_lineColor; 428 | protected SerializedProperty m_backgroundColor; 429 | protected SerializedProperty m_positionsAreLocalSpace; 430 | protected SerializedProperty m_autoApplyPositionChanges; 431 | protected SerializedProperty m_camera; 432 | protected SerializedProperty m_renderer; 433 | 434 | protected virtual void OnEnable() 435 | { 436 | m_points = serializedObject.FindProperty("Points"); 437 | m_maxPoints = serializedObject.FindProperty("m_MaxPoints"); 438 | m_lineThickness = serializedObject.FindProperty("m_LineThickness"); 439 | m_lineColor = serializedObject.FindProperty("m_LineColor"); 440 | m_backgroundColor = serializedObject.FindProperty("m_BackgroundColor"); 441 | m_positionsAreLocalSpace = serializedObject.FindProperty("m_PositionsAreLocalSpace"); 442 | m_autoApplyPositionChanges = serializedObject.FindProperty("m_AutoApplyPositionChanges"); 443 | m_camera = serializedObject.FindProperty("m_Camera"); 444 | m_renderer = serializedObject.FindProperty("m_Renderer"); 445 | } 446 | 447 | public override void OnInspectorGUI() 448 | { 449 | EditorGUILayout.BeginVertical(); 450 | { 451 | bool hasChanges = false; 452 | 453 | EditorGUI.BeginChangeCheck(); 454 | { 455 | // Points 456 | EditorGUILayout.PropertyField(m_points); 457 | } 458 | if (EditorGUI.EndChangeCheck()) 459 | { 460 | (target as MultiLineRenderer2D).ApplyLayoutChanges(); 461 | (target as MultiLineRenderer2D).ApplyPointPositionChanges(); 462 | hasChanges = true; 463 | } 464 | 465 | EditorGUI.BeginChangeCheck(); 466 | { 467 | // Max points 468 | EditorGUILayout.PropertyField(m_maxPoints); 469 | } 470 | if (EditorGUI.EndChangeCheck()) 471 | { 472 | (target as MultiLineRenderer2D).ApplyLayoutChanges(); 473 | hasChanges = true; 474 | } 475 | 476 | EditorGUI.BeginChangeCheck(); 477 | { 478 | // Line thickness 479 | EditorGUILayout.PropertyField(m_lineThickness); 480 | } 481 | if (EditorGUI.EndChangeCheck()) 482 | { 483 | (target as MultiLineRenderer2D).ApplyPointPositionChanges(); 484 | hasChanges = true; 485 | } 486 | 487 | EditorGUI.BeginChangeCheck(); 488 | { 489 | // Line color 490 | EditorGUILayout.PropertyField(m_lineColor); 491 | // Background color 492 | EditorGUILayout.PropertyField(m_backgroundColor); 493 | } 494 | if (EditorGUI.EndChangeCheck()) 495 | { 496 | hasChanges = true; 497 | } 498 | 499 | EditorGUI.BeginChangeCheck(); 500 | { 501 | // Positions are local space 502 | EditorGUILayout.PropertyField(m_positionsAreLocalSpace); 503 | } 504 | if (EditorGUI.EndChangeCheck()) 505 | { 506 | (target as MultiLineRenderer2D).ApplyPointPositionChanges(); 507 | hasChanges = true; 508 | } 509 | 510 | EditorGUI.BeginChangeCheck(); 511 | { 512 | DrawProperties(); 513 | } 514 | if (EditorGUI.EndChangeCheck()) 515 | { 516 | hasChanges = true; 517 | } 518 | 519 | if (hasChanges) 520 | { 521 | serializedObject.ApplyModifiedProperties(); 522 | 523 | (target as MultiLineRenderer2D).RefreshMaterial(); 524 | } 525 | } 526 | EditorGUILayout.EndVertical(); 527 | } 528 | 529 | protected virtual void DrawProperties() 530 | { 531 | // Auto apply position changes 532 | EditorGUILayout.PropertyField(m_autoApplyPositionChanges); 533 | // Camera 534 | EditorGUILayout.PropertyField(m_camera); 535 | // Renderer 536 | EditorGUILayout.PropertyField(m_renderer); 537 | // Pixels per unit 538 | EditorGUILayout.LabelField(new GUIContent(Texts.PixelsPerUnit.text + (target as MultiLineRenderer2D).m_pixelsPerUnit, Texts.PixelsPerUnit.tooltip)); 539 | // Points count 540 | EditorGUILayout.LabelField(new GUIContent(Texts.PointsCount.text + (target as MultiLineRenderer2D).m_pointsCount, Texts.PointsCount.tooltip)); 541 | // Packed points count 542 | EditorGUILayout.LabelField(new GUIContent(Texts.PackedPointsCount.text + (target as MultiLineRenderer2D).m_packedPointsCount, Texts.PackedPointsCount.tooltip)); 543 | } 544 | 545 | protected void OnSceneGUI() 546 | { 547 | float handleSize = HandleUtility.GetHandleSize(Vector3.zero) * 0.1f; 548 | Vector2 point; 549 | 550 | for (int i = 0; i < m_points.arraySize; ++i) 551 | { 552 | EditorGUI.BeginChangeCheck(); 553 | { 554 | point = Handles.PositionHandle(m_points.GetArrayElementAtIndex(i).vector2Value, Quaternion.identity); 555 | Handles.Label(point + Vector2.down * handleSize, i.ToString()); 556 | } 557 | if (EditorGUI.EndChangeCheck()) 558 | { 559 | Undo.RecordObject(target, "Line point moved"); 560 | 561 | MultiLineRenderer2D lineRenderer = target as MultiLineRenderer2D; 562 | lineRenderer.Points[i] = point; 563 | 564 | serializedObject.Update(); 565 | } 566 | } 567 | } 568 | } 569 | 570 | #endif 571 | 572 | } 573 | } -------------------------------------------------------------------------------- /Assets/Runtime/Scripts/MultiLineRenderer2D.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 86bcaae1d96bce94c9eefbad2f72d234 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c191452d82bf3f74eb3b93e15699efa0 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamLine.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: M_SG_BresenhamLine 11 | m_Shader: {fileID: -6465566751694194690, guid: 967d524ec3bc60640bca69b40bbbd282, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - Texture2D_9d4cd127c2f14c49aed016079534db03: 23 | m_Texture: {fileID: 2800000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _AlphaTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MainTex: 31 | m_Texture: {fileID: 2800000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _MaskTex: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _NormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_Lightmaps: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_LightmapsInd: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - unity_ShadowMasks: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | m_Floats: 55 | - Vector1_1F7886E8: 0.19 56 | - Vector1_BE85A36A: 0.3528 57 | - _DottedLineLength: 99999 58 | - _DottedLineOffset: 0 59 | - _EnableExternalAlpha: 0 60 | - _Thickness: 4 61 | m_Colors: 62 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 63 | - _Color: {r: 1, g: 1, b: 1, a: 1} 64 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 65 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 66 | - _LineColorA: {r: 1, g: 0, b: 0, a: 1} 67 | - _LineColorB: {r: 1, g: 0, b: 0, a: 1} 68 | - _Origin: {r: 1206, g: 815, b: 0, a: 0} 69 | - _PointA: {r: 902, g: 559, b: 0, a: 0} 70 | - _PointB: {r: 950, g: 463, b: 0, a: 0} 71 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 72 | - _TextureOffset: {r: 0, g: 0, b: 0, a: 0} 73 | - _TextureTiling: {r: 0, g: 0, b: 0, a: 0} 74 | m_BuildTextureStacks: [] 75 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamLine.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 968ed2d6466fdf74db1a557194497e41 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamLineUnlit.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: M_SG_BresenhamLineUnlit 11 | m_Shader: {fileID: -6465566751694194690, guid: 6f04203744c9bfb4eb74a04c822e7b68, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - Texture2D_9d4cd127c2f14c49aed016079534db03: 23 | m_Texture: {fileID: 2800000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _AlphaTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MainTex: 31 | m_Texture: {fileID: 2800000, guid: 0fcb97507efc33343adbc2783bc41de1, type: 3} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _MaskTex: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _NormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_Lightmaps: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_LightmapsInd: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - unity_ShadowMasks: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | m_Floats: 55 | - Vector1_1F7886E8: 0.19 56 | - Vector1_BE85A36A: 0.3528 57 | - _DottedLineLength: 99999 58 | - _DottedLineOffset: 0 59 | - _EnableExternalAlpha: 0 60 | - _Thickness: 4 61 | m_Colors: 62 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 63 | - _Color: {r: 1, g: 1, b: 1, a: 1} 64 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 65 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 66 | - _LineColorA: {r: 1, g: 0, b: 0, a: 1} 67 | - _LineColorB: {r: 1, g: 0, b: 0, a: 1} 68 | - _Origin: {r: 1206, g: 815, b: 0, a: 0} 69 | - _PointA: {r: 902, g: 559, b: 0, a: 0} 70 | - _PointB: {r: 950, g: 463, b: 0, a: 0} 71 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 72 | - _TextureOffset: {r: 0, g: 0, b: 0, a: 0} 73 | - _TextureTiling: {r: 0, g: 0, b: 0, a: 0} 74 | m_BuildTextureStacks: [] 75 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamLineUnlit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c1450844d7400124aa55d3eb8b20c04e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamMultiLine.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: M_SG_BresenhamMultiLine 11 | m_Shader: {fileID: -6465566751694194690, guid: 4121c2d4768cc744b9dd23483998cdbc, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 2800000, guid: 348168ed22b4e7d419fa866021648184, type: 3} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _PackedPoints: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_Lightmaps: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_LightmapsInd: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - unity_ShadowMasks: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | m_Floats: 55 | - Vector1_1F7886E8: 0.19 56 | - Vector1_BE85A36A: 0.3528 57 | - _EnableExternalAlpha: 0 58 | - _PackedPointsCount: 0 59 | - _PointsCount: 0 60 | - _Thickness: 4 61 | m_Colors: 62 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 63 | - _Color: {r: 1, g: 1, b: 1, a: 1} 64 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 65 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 66 | - _Origin: {r: 1206, g: 815, b: 0, a: 0} 67 | - _PointA: {r: 902, g: 559, b: 0, a: 0} 68 | - _PointB: {r: 950, g: 463, b: 0, a: 0} 69 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 70 | m_BuildTextureStacks: [] 71 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamMultiLine.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 933967d4e6cbe3f4cb299cae46231191 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamMultiLineUnlit.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: M_SG_BresenhamMultiLineUnlit 11 | m_Shader: {fileID: -6465566751694194690, guid: aa58069941eaf6847aadbc4afa2f775a, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _PackedPoints: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_Lightmaps: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_LightmapsInd: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | - unity_ShadowMasks: 51 | m_Texture: {fileID: 0} 52 | m_Scale: {x: 1, y: 1} 53 | m_Offset: {x: 0, y: 0} 54 | m_Floats: 55 | - Vector1_1F7886E8: 0.19 56 | - Vector1_BE85A36A: 0.3528 57 | - _EnableExternalAlpha: 0 58 | - _PackedPointsCount: 0 59 | - _PointsCount: 0 60 | - _Thickness: 4 61 | m_Colors: 62 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 63 | - _Color: {r: 1, g: 1, b: 1, a: 1} 64 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 65 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 66 | - _Origin: {r: 1206, g: 815, b: 0, a: 0} 67 | - _PointA: {r: 902, g: 559, b: 0, a: 0} 68 | - _PointB: {r: 950, g: 463, b: 0, a: 0} 69 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 70 | m_BuildTextureStacks: [] 71 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_BresenhamMultiLineUnlit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1d6f28cae4aa9944990b96346f019b42 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_VectorialLine.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: M_SG_VectorialLine 11 | m_Shader: {fileID: -6465566751694194690, guid: d1d963190acdd054db492da395dc2325, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - unity_Lightmaps: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_LightmapsInd: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_ShadowMasks: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | m_Floats: 51 | - Vector1_1F7886E8: 0.34935 52 | - Vector1_BE85A36A: 0.3686 53 | - _EnableExternalAlpha: 0 54 | - _Thickness: 4 55 | m_Colors: 56 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 57 | - _Color: {r: 1, g: 1, b: 1, a: 1} 58 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 59 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 60 | - _Origin: {r: 1206, g: 815, b: 0, a: 0} 61 | - _PointA: {r: 902, g: 559, b: 0, a: 0} 62 | - _PointB: {r: 950, g: 463, b: 0, a: 0} 63 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 64 | m_BuildTextureStacks: [] 65 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_VectorialLine.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 2d97c3f22cf480d44bde1dc19ac2c929 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_VectorialLineUnlit.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: M_SG_VectorialLineUnlit 11 | m_Shader: {fileID: -6465566751694194690, guid: bb7efcb24c6226e428bc46166ac9f285, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - unity_Lightmaps: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_LightmapsInd: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_ShadowMasks: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | m_Floats: 51 | - Vector1_1F7886E8: 0.34935 52 | - Vector1_BE85A36A: 0.3686 53 | - _EnableExternalAlpha: 0 54 | - _Thickness: 4 55 | m_Colors: 56 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 57 | - _Color: {r: 1, g: 1, b: 1, a: 1} 58 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 59 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 60 | - _Origin: {r: 1206, g: 815, b: 0, a: 0} 61 | - _PointA: {r: 902, g: 559, b: 0, a: 0} 62 | - _PointB: {r: 950, g: 463, b: 0, a: 0} 63 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 64 | m_BuildTextureStacks: [] 65 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/M_SG_VectorialLineUnlit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 1f6a33aba417f7549bf0b466cd71dc31 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/SG_BresenhamLine.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 967d524ec3bc60640bca69b40bbbd282 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/SG_BresenhamLineUnlit.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 6f04203744c9bfb4eb74a04c822e7b68 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/SG_BresenhamMultiLine.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4121c2d4768cc744b9dd23483998cdbc 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/SG_BresenhamMultiLineUnlit.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: aa58069941eaf6847aadbc4afa2f775a 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/SG_VectorialLine.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1d963190acdd054db492da395dc2325 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shadergraph/SG_VectorialLineUnlit.shadergraph.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bb7efcb24c6226e428bc46166ac9f285 3 | ScriptedImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 2 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3} 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 60df6050b5903f8419dd00bd357cc97e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamLineRenderer2D_Lit.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: M_BresenhamLineRenderer2D_Lit 11 | m_Shader: {fileID: 4800000, guid: e2331b4dc3df5a04ca025d06288aca0b, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _LineTexture: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MainTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _MaskTex: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _NormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | m_Floats: 43 | - _AlphaBlendDst: 10 44 | - _AlphaBlendSrc: 1 45 | - _BlendOp: 0 46 | - _ColorBlendDst: 10 47 | - _ColorBlendSrc: 5 48 | - _DottedLineLength: 99999 49 | - _DottedLineOffset: 0 50 | - _EnableExternalAlpha: 0 51 | - _IsUnlit: 0 52 | - _Thickness: 4 53 | m_Colors: 54 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 55 | - _Color: {r: 1, g: 1, b: 1, a: 1} 56 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 57 | - _LineColorA: {r: 1, g: 0, b: 0, a: 1} 58 | - _LineColorB: {r: 1, g: 0, b: 0, a: 1} 59 | - _OverlayColor: {r: 0, g: 0, b: 0, a: 0} 60 | - _PointA: {r: 0, g: 0, b: 0, a: 1} 61 | - _PointB: {r: 0, g: 0, b: 0, a: 1} 62 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 63 | m_BuildTextureStacks: [] 64 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamLineRenderer2D_Lit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 7bcdb1aa0bd14884a8fefe6dbb5d1b9a 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamLineRenderer2D_Unlit.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: M_BresenhamLineRenderer2D_Unlit 11 | m_Shader: {fileID: 4800000, guid: e2331b4dc3df5a04ca025d06288aca0b, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ISUNLIT_ON 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _LineTexture: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MainTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _MaskTex: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _NormalMap: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | m_Floats: 43 | - _AlphaBlendDst: 10 44 | - _AlphaBlendSrc: 1 45 | - _BlendOp: 0 46 | - _ColorBlendDst: 10 47 | - _ColorBlendSrc: 5 48 | - _DottedLineLength: 99999 49 | - _DottedLineOffset: 0 50 | - _EnableExternalAlpha: 0 51 | - _IsUnlit: 1 52 | - _Thickness: 4 53 | m_Colors: 54 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 55 | - _Color: {r: 1, g: 1, b: 1, a: 1} 56 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 57 | - _LineColorA: {r: 1, g: 0, b: 0, a: 1} 58 | - _LineColorB: {r: 1, g: 0, b: 0, a: 1} 59 | - _OverlayColor: {r: 0, g: 0, b: 0, a: 0} 60 | - _PointA: {r: 0, g: 0, b: 0, a: 1} 61 | - _PointB: {r: 0, g: 0, b: 0, a: 1} 62 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 63 | m_BuildTextureStacks: [] 64 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamLineRenderer2D_Unlit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4dcfd3137d1b15746a5280d14cf313f1 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamMultiLineRenderer2D_Lit.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: M_BresenhamMultiLineRenderer2D_Lit 11 | m_Shader: {fileID: 4800000, guid: 3b128b3e9dc06314a907f55247273eb6, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _PackedPoints: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | m_Floats: 43 | - _EnableExternalAlpha: 0 44 | - _IsUnlit: 0 45 | - _PackedPointsCount: 0 46 | - _PointsCount: 0 47 | - _Thickness: 4 48 | m_Colors: 49 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 50 | - _Color: {r: 1, g: 1, b: 1, a: 1} 51 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 52 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 53 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 54 | m_BuildTextureStacks: [] 55 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamMultiLineRenderer2D_Lit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 652b04d1ed15c234db19815b7611170f 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamMultiLineRenderer2D_Unlit.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: M_BresenhamMultiLineRenderer2D_Unlit 11 | m_Shader: {fileID: 4800000, guid: 3b128b3e9dc06314a907f55247273eb6, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ISUNLIT_ON 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - _PackedPoints: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | m_Floats: 43 | - _EnableExternalAlpha: 0 44 | - _IsUnlit: 1 45 | - _PackedPointsCount: 0 46 | - _PointsCount: 0 47 | - _Thickness: 4 48 | m_Colors: 49 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 50 | - _Color: {r: 1, g: 1, b: 1, a: 1} 51 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 52 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 53 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 54 | m_BuildTextureStacks: [] 55 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_BresenhamMultiLineRenderer2D_Unlit.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0846980f48175a14d9caa2443c7f584d 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_VectorialLineRenderer2D.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: M_VectorialLineRenderer2D 11 | m_Shader: {fileID: 4800000, guid: 5253fdd1e8388c4469a054041a5f137d, type: 3} 12 | m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ISUNLIT_ON 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 | - _AlphaTex: 23 | m_Texture: {fileID: 0} 24 | m_Scale: {x: 1, y: 1} 25 | m_Offset: {x: 0, y: 0} 26 | - _MainTex: 27 | m_Texture: {fileID: 0} 28 | m_Scale: {x: 1, y: 1} 29 | m_Offset: {x: 0, y: 0} 30 | - _MaskTex: 31 | m_Texture: {fileID: 0} 32 | m_Scale: {x: 1, y: 1} 33 | m_Offset: {x: 0, y: 0} 34 | - _NormalMap: 35 | m_Texture: {fileID: 0} 36 | m_Scale: {x: 1, y: 1} 37 | m_Offset: {x: 0, y: 0} 38 | - unity_Lightmaps: 39 | m_Texture: {fileID: 0} 40 | m_Scale: {x: 1, y: 1} 41 | m_Offset: {x: 0, y: 0} 42 | - unity_LightmapsInd: 43 | m_Texture: {fileID: 0} 44 | m_Scale: {x: 1, y: 1} 45 | m_Offset: {x: 0, y: 0} 46 | - unity_ShadowMasks: 47 | m_Texture: {fileID: 0} 48 | m_Scale: {x: 1, y: 1} 49 | m_Offset: {x: 0, y: 0} 50 | m_Floats: 51 | - Vector1_1F7886E8: 0.34935 52 | - Vector1_BE85A36A: 0.3686 53 | - _BaseTolerance: 0.3686 54 | - _EnableExternalAlpha: 0 55 | - _IsUnlit: 1 56 | - _Thickness: 4 57 | - _ToleranceMultiplier: 0.34935 58 | m_Colors: 59 | - _BackgroundColor: {r: 0, g: 0, b: 0, a: 0} 60 | - _Color: {r: 1, g: 1, b: 1, a: 1} 61 | - _Flip: {r: 1, g: 1, b: 1, a: 1} 62 | - _LineColor: {r: 1, g: 0, b: 0, a: 1} 63 | - _Origin: {r: 138.8, g: 96, b: 0, a: 0} 64 | - _PointA: {r: 338.41, g: 267.11594, b: 0, a: 0} 65 | - _PointB: {r: 0, g: 0, b: 0, a: 1} 66 | - _RendererColor: {r: 1, g: 1, b: 1, a: 1} 67 | m_BuildTextureStacks: [] 68 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/M_VectorialLineRenderer2D.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ebf2372f4e0ceea4584187ae48fa5123 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 2100000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamLine.hlsl: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | /// 15 | /// vEndpointA: One of the endpoints of the line, in world space. 16 | /// vEndpointB: One of the endpoints of the line, in world space. 17 | /// fThickness: How many pixels wide is every block (point) of the line. 18 | /// vPointP: Current point (screen space) to be evaluated. 19 | /// fDottedLineLength: The length, in blocks, of each dot of the dotted line. To disable dots just use a huge value. 20 | /// fDottedLineOffset: The offset, in blocks, of the dots of the dotted line. 21 | /// outIsPixelInLine: Whether the pixel should be filled or not. 22 | /// 23 | void IsPixelInLine_float(float2 vEndpointA, float2 vEndpointB, float fThickness, float2 vPointP, float fDottedLineLength, float fDottedLineOffset, out bool outIsPixelInLine) 24 | { 25 | // Origin in screen space 26 | float4 projectionSpaceOrigin = mul(UNITY_MATRIX_VP, float4(0.0f, 0.0f, 0.0f, 1.0f)); 27 | float2 vOrigin = ComputeScreenPos(projectionSpaceOrigin).xy * _ScreenParams.xy; 28 | 29 | // The amount of pixels the camera has moved regarding a thickness-wide block of pixels 30 | vOrigin = fmod(vOrigin, float2(fThickness, fThickness)); 31 | vOrigin = round(vOrigin); 32 | 33 | // This moves the line N pixels, this is necessary due to the camera moves 1 pixel each time and the line may be wider than 1 pixel 34 | // so this avoids the line jumping from one block (thickness-wide) to the next, and instead its movement is smoother by moving pixel by pixel 35 | vPointP += float2(fThickness, fThickness) - vOrigin; 36 | 37 | float4 projectionSpaceEndpointA = mul(UNITY_MATRIX_VP, float4(vEndpointA.x, vEndpointA.y, 0.0f, 1.0f)); 38 | float4 projectionSpaceEndpointB = mul(UNITY_MATRIX_VP, float4(vEndpointB.x, vEndpointB.y, 0.0f, 1.0f)); 39 | 40 | // Endpoints in screen space 41 | vEndpointA = ComputeScreenPos(projectionSpaceEndpointA).xy * _ScreenParams.xy; 42 | vEndpointB = ComputeScreenPos(projectionSpaceEndpointB).xy * _ScreenParams.xy; 43 | 44 | vEndpointA = round(vEndpointA); 45 | vEndpointB = round(vEndpointB); 46 | 47 | vEndpointA += float2(fThickness, fThickness) - vOrigin; 48 | vEndpointB += float2(fThickness, fThickness) - vOrigin; 49 | 50 | vEndpointA = vEndpointA - fmod(vEndpointA, float2(fThickness, fThickness)); 51 | vEndpointB = vEndpointB - fmod(vEndpointB, float2(fThickness, fThickness)); 52 | vEndpointA = round(vEndpointA); 53 | vEndpointB = round(vEndpointB); 54 | 55 | vPointP = vPointP - fmod(vPointP, float2(fThickness, fThickness)); 56 | vPointP = round(vPointP); 57 | 58 | int x = vEndpointA.x; 59 | int y = vEndpointA.y; 60 | int x2 = vEndpointB.x; 61 | int y2 = vEndpointB.y; 62 | int pX = vPointP.x; 63 | int pY = vPointP.y; 64 | int w = x2 - x; 65 | int h = y2 - y; 66 | int dx1 = 0, dy1 = 0, dx2 = 0, dy2 = 0; 67 | 68 | if (w<0) dx1 = -fThickness ; else if (w>0) dx1 = fThickness; 69 | if (h<0) dy1 = -fThickness ; else if (h>0) dy1 = fThickness; 70 | if (w<0) dx2 = -fThickness ; else if (w>0) dx2 = fThickness; 71 | 72 | int longest = abs(w); 73 | int shortest = abs(h); 74 | 75 | if (longest <= shortest) 76 | { 77 | longest = abs(h); 78 | shortest = abs(w); 79 | 80 | if (h < 0) 81 | dy2 = -fThickness; 82 | else if (h > 0) 83 | dy2 = fThickness; 84 | 85 | dx2 = 0; 86 | } 87 | 88 | int numerator = longest >> 1; 89 | 90 | outIsPixelInLine = false; 91 | 92 | for (int i=0; i <= longest; i+=fThickness) 93 | { 94 | if(x == pX && y == pY) 95 | { 96 | outIsPixelInLine = fmod(floor((i + fDottedLineOffset * fThickness) / fDottedLineLength / fThickness), 2.0f) == 0; 97 | break; 98 | } 99 | 100 | numerator += shortest; 101 | 102 | if (numerator >= longest) 103 | { 104 | numerator -= longest; 105 | x += dx1; 106 | y += dy1; 107 | } 108 | else 109 | { 110 | x += dx2; 111 | y += dy2; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamLine.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 338b06b48ed632447a595d89908cd4ca 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamLineRenderer2D.shader: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | Shader "Game/S_BresenhamLineRenderer2D" 15 | { 16 | Properties 17 | { 18 | _MainTex("Diffuse", 2D) = "white" {} 19 | _MaskTex("Mask", 2D) = "white" {} 20 | [MaterialToggle] _IsUnlit("Unlit", Float) = 0 21 | _PointA("Point A", Vector) = (0, 0, 0, 1) 22 | _PointB("Point B", Vector) = (0, 0, 0, 1) 23 | _LineColorA("Line Color A", Color) = (1, 0, 0, 1) 24 | _LineColorB("Line Color B", Color) = (1, 0, 0, 1) 25 | _BackgroundColor("Background Color", Color) = (0, 0, 0, 0) 26 | _Thickness("Thickness", Float) = 4.0 27 | _DottedLineLength("Dotted Line Length", Float) = 99999.0 28 | _DottedLineOffset("Dotted Line Offset", Float) = 0 29 | _LineTexture("Line Texture", 2D) = "white" {} 30 | // Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader. 31 | //[HideInInspector] _Color("Tint", Color) = (1,1,1,1) 32 | //[HideInInspector] _RendererColor("RendererColor", Color) = (1,1,1,1) 33 | //[HideInInspector] _Flip("Flip", Vector) = (1,1,1,1) 34 | //[HideInInspector] _AlphaTex("External Alpha", 2D) = "white" {} 35 | //[HideInInspector] _EnableExternalAlpha("Enable External Alpha", Float) = 0 36 | } 37 | 38 | HLSLINCLUDE 39 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 40 | ENDHLSL 41 | 42 | SubShader 43 | { 44 | Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" } 45 | 46 | BlendOp Add 47 | Blend 0 SrcAlpha OneMinusSrcAlpha 48 | Cull Off 49 | ZTest LEqual 50 | ZWrite Off 51 | 52 | Pass 53 | { 54 | Tags { "LightMode" = "Universal2D" } 55 | HLSLPROGRAM 56 | #pragma vertex MainVertexShader 57 | #pragma fragment MainFragmentShader 58 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ 59 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ 60 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ 61 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ 62 | 63 | struct Attributes 64 | { 65 | float3 positionOS : POSITION; 66 | float4 color : COLOR; 67 | float2 uv : TEXCOORD0; 68 | UNITY_VERTEX_INPUT_INSTANCE_ID 69 | }; 70 | 71 | struct Varyings 72 | { 73 | float4 positionCS : SV_POSITION; 74 | float4 color : COLOR; 75 | float2 uv : TEXCOORD0; 76 | float2 screenPos : TEXCOORD1; 77 | UNITY_VERTEX_OUTPUT_STEREO 78 | }; 79 | 80 | #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" 81 | 82 | TEXTURE2D(_MainTex); 83 | SAMPLER(sampler_MainTex); 84 | TEXTURE2D(_MaskTex); 85 | SAMPLER(sampler_MaskTex); 86 | TEXTURE2D(_LineTexture); 87 | SAMPLER(sampler_LineTexture); 88 | 89 | #if USE_SHAPE_LIGHT_TYPE_0 90 | SHAPE_LIGHT(0) 91 | #endif 92 | 93 | #if USE_SHAPE_LIGHT_TYPE_1 94 | SHAPE_LIGHT(1) 95 | #endif 96 | 97 | #if USE_SHAPE_LIGHT_TYPE_2 98 | SHAPE_LIGHT(2) 99 | #endif 100 | 101 | #if USE_SHAPE_LIGHT_TYPE_3 102 | SHAPE_LIGHT(3) 103 | #endif 104 | 105 | CBUFFER_START(UnityPerMaterial) 106 | float4 _MainTex_ST; 107 | float4 _LineTexture_ST; 108 | float _IsUnlit; 109 | float4 _PointA; 110 | float4 _PointB; 111 | float4 _LineColorA; 112 | float4 _LineColorB; 113 | float4 _BackgroundColor; 114 | float _Thickness; 115 | float _DottedLineLength; 116 | float _DottedLineOffset; 117 | CBUFFER_END 118 | 119 | Varyings MainVertexShader(Attributes v) 120 | { 121 | Varyings o = (Varyings)0; 122 | UNITY_SETUP_INSTANCE_ID(v); 123 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 124 | 125 | o.positionCS = TransformObjectToHClip(v.positionOS); 126 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 127 | float4 clipVertex = o.positionCS / o.positionCS.w; 128 | o.screenPos = ComputeScreenPos(clipVertex).xy; 129 | o.color = v.color; 130 | return o; 131 | } 132 | 133 | #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" 134 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl" 135 | #include "S_BresenhamLine.hlsl" 136 | 137 | float2 TransformToScreenSpace(float4 vInputPoint) 138 | { 139 | return ComputeScreenPos(mul(UNITY_MATRIX_VP, float4(vInputPoint.x, vInputPoint.y, 0.0f, 1.0f))).xy * _ScreenParams.xy; 140 | } 141 | 142 | float4 MainFragmentShader(Varyings i) : SV_TARGET 143 | { 144 | float4 mainColor = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); 145 | float4 maskColor = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); 146 | 147 | clip(mainColor.a == 0.0f ? -1.0f : 1.0f); 148 | 149 | float2 pointA = TransformToScreenSpace(_PointA); 150 | float2 pointB = TransformToScreenSpace(_PointB); 151 | float2 pointP = i.screenPos.xy * _ScreenParams.xy; 152 | float distanceAB = length(pointA - pointB); 153 | float distanceAP = length(pointA - pointP); 154 | float lineProgress = distanceAP / distanceAB; 155 | float4 pointColor = lerp(_LineColorA, _LineColorB, lineProgress); 156 | 157 | bool isPixelInLine = false; 158 | IsPixelInLine_float(_PointA.xy, _PointB.xy, _Thickness, pointP, _DottedLineLength, _DottedLineOffset, isPixelInLine); 159 | 160 | float4 finalColor = isPixelInLine ? pointColor : _BackgroundColor; 161 | 162 | clip(finalColor.a == 0.0f ? -1.0f : 1.0f); 163 | 164 | finalColor *= SAMPLE_TEXTURE2D(_LineTexture, sampler_LineTexture, i.uv * _LineTexture_ST.xy + _LineTexture_ST.zw); 165 | 166 | if (_IsUnlit == 0.0f) 167 | { 168 | // Lighting 169 | finalColor = CombinedShapeLightShared(finalColor, maskColor, i.screenPos); 170 | } 171 | 172 | return finalColor; 173 | } 174 | ENDHLSL 175 | } 176 | } 177 | 178 | Fallback "Sprites/Default" 179 | 180 | } 181 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamLineRenderer2D.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e2331b4dc3df5a04ca025d06288aca0b 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | preprocessorOverride: 0 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamMultiLine.hlsl: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | void IsPixelInLine_float(float fThickness, float2 vPointP, Texture2D tPackedPoints, float fPackedPointsCount, float fPointsCount, out bool outIsPixelInLine) 15 | { 16 | // Origin in screen space 17 | float4 projectionSpaceOrigin = mul(UNITY_MATRIX_VP, float4(0.0f, 0.0f, 0.0f, 1.0f)); 18 | float2 vOrigin = ComputeScreenPos(projectionSpaceOrigin).xy * _ScreenParams.xy; 19 | 20 | // The amount of pixels the camera has moved regarding a thickness-wide block of pixels 21 | vOrigin = fmod(vOrigin, float2(fThickness, fThickness)); 22 | vOrigin = round(vOrigin); 23 | 24 | // This moves the line N pixels, this is necessary due to the camera moves 1 pixel each time and the line may be wider than 1 pixel 25 | // so this avoids the line jumping from one block (thickness-wide) to the next, and instead its movement is smoother by moving pixel by pixel 26 | vPointP += float2(fThickness, fThickness) - vOrigin; 27 | 28 | vPointP = vPointP - fmod(vPointP, float2(fThickness, fThickness)); 29 | vPointP = round(vPointP); 30 | 31 | int pointsCount = round(fPointsCount); 32 | 33 | outIsPixelInLine = false; 34 | 35 | for(int t = 0; t < pointsCount - 1; ++t) 36 | { 37 | int xCoord = floor(t / 2.0f); 38 | float4 packedPoints = tPackedPoints.Load(int3(xCoord, 0, 0)); 39 | float4 packedPoints2 = tPackedPoints.Load(int3(xCoord + 1, 0, 0)); 40 | 41 | float2 worldSpaceEndpointA = fmod(t, 2) == 0 ? packedPoints.rg : packedPoints.ba; 42 | float2 worldSpaceEndpointB = fmod(t, 2) == 0 ? packedPoints.ba : packedPoints2.rg; 43 | float4 projectionSpaceEndpointA = mul(UNITY_MATRIX_VP, float4(worldSpaceEndpointA.x, worldSpaceEndpointA.y, 0.0f, 1.0f)); 44 | float4 projectionSpaceEndpointB = mul(UNITY_MATRIX_VP, float4(worldSpaceEndpointB.x, worldSpaceEndpointB.y, 0.0f, 1.0f)); 45 | 46 | // Endpoints in screen space 47 | float2 vEndpointA = ComputeScreenPos(projectionSpaceEndpointA).xy * _ScreenParams.xy; 48 | float2 vEndpointB = ComputeScreenPos(projectionSpaceEndpointB).xy * _ScreenParams.xy; 49 | 50 | vEndpointA = round(vEndpointA); 51 | vEndpointB = round(vEndpointB); 52 | 53 | vEndpointA += float2(fThickness, fThickness) - vOrigin; 54 | vEndpointB += float2(fThickness, fThickness) - vOrigin; 55 | 56 | vEndpointA = vEndpointA - fmod(vEndpointA, float2(fThickness, fThickness)); 57 | vEndpointB = vEndpointB - fmod(vEndpointB, float2(fThickness, fThickness)); 58 | vEndpointA = round(vEndpointA); 59 | vEndpointB = round(vEndpointB); 60 | 61 | int x = vEndpointA.x; 62 | int y = vEndpointA.y; 63 | int x2 = vEndpointB.x; 64 | int y2 = vEndpointB.y; 65 | int pX = vPointP.x; 66 | int pY = vPointP.y; 67 | int w = x2 - x; 68 | int h = y2 - y; 69 | int dx1 = 0, dy1 = 0, dx2 = 0, dy2 = 0; 70 | 71 | if (w<0) dx1 = -fThickness ; else if (w>0) dx1 = fThickness; 72 | if (h<0) dy1 = -fThickness ; else if (h>0) dy1 = fThickness; 73 | if (w<0) dx2 = -fThickness ; else if (w>0) dx2 = fThickness; 74 | 75 | int longest = abs(w); 76 | int shortest = abs(h); 77 | 78 | if (longest <= shortest) 79 | { 80 | longest = abs(h); 81 | shortest = abs(w); 82 | 83 | if (h < 0) 84 | dy2 = -fThickness; 85 | else if (h > 0) 86 | dy2 = fThickness; 87 | 88 | dx2 = 0; 89 | } 90 | 91 | int numerator = longest >> 1; 92 | 93 | for (int i=0; i <= longest; i+=fThickness) 94 | { 95 | if(x == pX && y == pY) 96 | { 97 | outIsPixelInLine = true; 98 | break; 99 | } 100 | 101 | numerator += shortest; 102 | 103 | if (numerator >= longest) 104 | { 105 | numerator -= longest; 106 | x += dx1; 107 | y += dy1; 108 | } 109 | else 110 | { 111 | x += dx2; 112 | y += dy2; 113 | } 114 | } 115 | } 116 | } 117 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamMultiLine.hlsl.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c30e52e366906904e81bd7541e6c0e8a 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | userData: 8 | assetBundleName: 9 | assetBundleVariant: 10 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamMultiLineRenderer2D.shader: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | Shader "Game/S_BresenhamMultiLineRenderer2D" 15 | { 16 | Properties 17 | { 18 | _MainTex("Diffuse", 2D) = "white" {} 19 | _MaskTex("Mask", 2D) = "white" {} 20 | [MaterialToggle] _IsUnlit("Unlit", Float) = 0 21 | _LineColor("Line Color", Color) = (1, 0, 0, 1) 22 | _PackedPoints("PackedPoints", 2D) = "clear" {} 23 | _BackgroundColor("Background Color", Color) = (0, 0, 0, 0) 24 | _Thickness("Thickness", Float) = 4.0 25 | _PackedPointsCount("Packed Points Count", Float) = 0.0 26 | _PointsCount("Points Count", Float) = 0.0 27 | // Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader. 28 | //[HideInInspector] _Color("Tint", Color) = (1,1,1,1) 29 | //[HideInInspector] _RendererColor("RendererColor", Color) = (1,1,1,1) 30 | //[HideInInspector] _Flip("Flip", Vector) = (1,1,1,1) 31 | //[HideInInspector] _AlphaTex("External Alpha", 2D) = "white" {} 32 | //[HideInInspector] _EnableExternalAlpha("Enable External Alpha", Float) = 0 33 | } 34 | 35 | HLSLINCLUDE 36 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 37 | ENDHLSL 38 | 39 | SubShader 40 | { 41 | Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" } 42 | 43 | BlendOp Add 44 | Blend 0 SrcAlpha OneMinusSrcAlpha 45 | Cull Off 46 | //ZTest LEqual 47 | ZWrite Off 48 | 49 | Pass 50 | { 51 | Tags { "LightMode" = "Universal2D" } 52 | HLSLPROGRAM 53 | #pragma vertex MainVertexShader 54 | #pragma fragment MainFragmentShader 55 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ 56 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ 57 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ 58 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ 59 | 60 | struct Attributes 61 | { 62 | float3 positionOS : POSITION; 63 | float4 color : COLOR; 64 | float2 uv : TEXCOORD0; 65 | UNITY_VERTEX_INPUT_INSTANCE_ID 66 | }; 67 | 68 | struct Varyings 69 | { 70 | float4 positionCS : SV_POSITION; 71 | float4 color : COLOR; 72 | float2 uv : TEXCOORD0; 73 | float2 screenPos : TEXCOORD1; 74 | UNITY_VERTEX_OUTPUT_STEREO 75 | }; 76 | 77 | #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" 78 | 79 | TEXTURE2D(_MainTex); 80 | SAMPLER(sampler_MainTex); 81 | TEXTURE2D(_MaskTex); 82 | SAMPLER(sampler_MaskTex); 83 | TEXTURE2D(_PackedPoints); 84 | 85 | #if USE_SHAPE_LIGHT_TYPE_0 86 | SHAPE_LIGHT(0) 87 | #endif 88 | 89 | #if USE_SHAPE_LIGHT_TYPE_1 90 | SHAPE_LIGHT(1) 91 | #endif 92 | 93 | #if USE_SHAPE_LIGHT_TYPE_2 94 | SHAPE_LIGHT(2) 95 | #endif 96 | 97 | #if USE_SHAPE_LIGHT_TYPE_3 98 | SHAPE_LIGHT(3) 99 | #endif 100 | 101 | CBUFFER_START(UnityPerMaterial) 102 | float4 _MainTex_ST; 103 | float _IsUnlit; 104 | float4 _LineColor; 105 | float4 _BackgroundColor; 106 | float _Thickness; 107 | float _PackedPointsCount; 108 | float _PointsCount; 109 | CBUFFER_END 110 | 111 | Varyings MainVertexShader(Attributes v) 112 | { 113 | Varyings o = (Varyings)0; 114 | UNITY_SETUP_INSTANCE_ID(v); 115 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 116 | 117 | o.positionCS = TransformObjectToHClip(v.positionOS); 118 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 119 | float4 clipVertex = o.positionCS / o.positionCS.w; 120 | o.screenPos = ComputeScreenPos(clipVertex).xy; 121 | o.color = v.color; 122 | return o; 123 | } 124 | 125 | #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" 126 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl" 127 | #include "S_BresenhamMultiLine.hlsl" 128 | 129 | float4 MainFragmentShader(Varyings i) : SV_TARGET 130 | { 131 | float4 mainColor = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); 132 | float4 maskColor = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); 133 | 134 | clip(mainColor.a == 0.0f ? -1.0f : 1.0f); 135 | 136 | float2 pointP = i.screenPos.xy * _ScreenParams.xy; 137 | 138 | bool isPixelInLine = false; 139 | IsPixelInLine_float(_Thickness, pointP, _PackedPoints, _PackedPointsCount, _PointsCount, isPixelInLine); 140 | 141 | float4 finalColor = isPixelInLine ? _LineColor : _BackgroundColor; 142 | 143 | clip(finalColor.a == 0.0f ? -1.0f : 1.0f); 144 | 145 | if (_IsUnlit == 0.0f) 146 | { 147 | // Lighting 148 | finalColor = CombinedShapeLightShared(finalColor, maskColor, i.screenPos); 149 | } 150 | 151 | return finalColor; 152 | } 153 | ENDHLSL 154 | } 155 | } 156 | 157 | Fallback "Sprites/Default" 158 | 159 | } 160 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_BresenhamMultiLineRenderer2D.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3b128b3e9dc06314a907f55247273eb6 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | preprocessorOverride: 0 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_VectorialLineRenderer2D.shader: -------------------------------------------------------------------------------- 1 | // Copyright 2020 Alejandro Villalba Avila 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), 4 | // to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, 5 | // and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | // 7 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | // 9 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 12 | // IN THE SOFTWARE. 13 | 14 | Shader "Game/S_VectorialLineRenderer2D" 15 | { 16 | Properties 17 | { 18 | _MainTex("Diffuse", 2D) = "white" {} 19 | _MaskTex("Mask", 2D) = "white" {} 20 | [MaterialToggle] _IsUnlit("Unlit", Float) = 0 21 | _PointA("Point A", Vector) = (0, 0, 0, 1) 22 | _PointB("Point B", Vector) = (0, 0, 0, 1) 23 | _LineColor("Line Color", Color) = (1, 0, 0, 1) 24 | _BackgroundColor("Background Color", Color) = (0, 0, 0, 0) 25 | _Thickness("Thickness", Float) = 4.0 26 | _Origin("Origin", Vector) = (0, 0, 0, 0) 27 | _ToleranceMultiplier("Tolerance Multiplier", Float) = 0 28 | _BaseTolerance("Base Tolerance", Float) = 0 29 | // Legacy properties. They're here so that materials using this shader can gracefully fallback to the legacy sprite shader. 30 | //[HideInInspector] _Color("Tint", Color) = (1,1,1,1) 31 | //[HideInInspector] _RendererColor("RendererColor", Color) = (1,1,1,1) 32 | //[HideInInspector] _Flip("Flip", Vector) = (1,1,1,1) 33 | //[HideInInspector] _AlphaTex("External Alpha", 2D) = "white" {} 34 | //[HideInInspector] _EnableExternalAlpha("Enable External Alpha", Float) = 0 35 | } 36 | 37 | HLSLINCLUDE 38 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl" 39 | ENDHLSL 40 | 41 | SubShader 42 | { 43 | Tags {"Queue" = "Transparent" "RenderType" = "Transparent" "RenderPipeline" = "UniversalPipeline" } 44 | 45 | BlendOp Add 46 | Blend 0 SrcAlpha OneMinusSrcAlpha 47 | Cull Off 48 | ZTest LEqual 49 | ZWrite Off 50 | 51 | Pass 52 | { 53 | Tags { "LightMode" = "Universal2D" } 54 | HLSLPROGRAM 55 | #pragma vertex MainVertexShader 56 | #pragma fragment MainFragmentShader 57 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_0 __ 58 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_1 __ 59 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_2 __ 60 | #pragma multi_compile USE_SHAPE_LIGHT_TYPE_3 __ 61 | 62 | struct Attributes 63 | { 64 | float3 positionOS : POSITION; 65 | float4 color : COLOR; 66 | float2 uv : TEXCOORD0; 67 | UNITY_VERTEX_INPUT_INSTANCE_ID 68 | }; 69 | 70 | struct Varyings 71 | { 72 | float4 positionCS : SV_POSITION; 73 | float4 color : COLOR; 74 | float2 uv : TEXCOORD0; 75 | float2 screenPos : TEXCOORD1; 76 | UNITY_VERTEX_OUTPUT_STEREO 77 | }; 78 | 79 | #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/LightingUtility.hlsl" 80 | 81 | TEXTURE2D(_MainTex); 82 | SAMPLER(sampler_MainTex); 83 | TEXTURE2D(_MaskTex); 84 | SAMPLER(sampler_MaskTex); 85 | 86 | #if USE_SHAPE_LIGHT_TYPE_0 87 | SHAPE_LIGHT(0) 88 | #endif 89 | 90 | #if USE_SHAPE_LIGHT_TYPE_1 91 | SHAPE_LIGHT(1) 92 | #endif 93 | 94 | #if USE_SHAPE_LIGHT_TYPE_2 95 | SHAPE_LIGHT(2) 96 | #endif 97 | 98 | #if USE_SHAPE_LIGHT_TYPE_3 99 | SHAPE_LIGHT(3) 100 | #endif 101 | 102 | CBUFFER_START(UnityPerMaterial) 103 | float4 _MainTex_ST; 104 | float _IsUnlit; 105 | float4 _PointA; 106 | float4 _PointB; 107 | float4 _LineColor; 108 | float4 _BackgroundColor; 109 | float4 _Origin; 110 | float _Thickness; 111 | float _ToleranceMultiplier; 112 | float _BaseTolerance; 113 | CBUFFER_END 114 | 115 | Varyings MainVertexShader(Attributes v) 116 | { 117 | Varyings o = (Varyings)0; 118 | UNITY_SETUP_INSTANCE_ID(v); 119 | UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); 120 | 121 | o.positionCS = TransformObjectToHClip(v.positionOS); 122 | o.uv = TRANSFORM_TEX(v.uv, _MainTex); 123 | float4 clipVertex = o.positionCS / o.positionCS.w; 124 | o.screenPos = ComputeScreenPos(clipVertex).xy; 125 | o.color = v.color; 126 | return o; 127 | } 128 | 129 | #include "Packages/com.unity.render-pipelines.universal/Shaders/2D/Include/CombinedShapeLightShared.hlsl" 130 | #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ShaderVariablesFunctions.hlsl" 131 | 132 | float2 TransformToScreenSpace(float4 vInputPoint) 133 | { 134 | return ComputeScreenPos(mul(UNITY_MATRIX_VP, float4(vInputPoint.x, vInputPoint.y, 0.0f, 1.0f))).xy * _ScreenParams.xy; 135 | } 136 | 137 | void CalculateDistanceCorrection(float2 vEndpointA, float2 vEndpointB, float fToleranceMultiplier, float fBaseTolerance, float fThickness, out float outDistanceCorrection) 138 | { 139 | #define M_PI 3.1415926535897932384626433832795 140 | 141 | vEndpointA = vEndpointA - fmod(vEndpointA, float2(fThickness, fThickness)); 142 | vEndpointB = vEndpointB - fmod(vEndpointB, float2(fThickness, fThickness)); 143 | vEndpointA = round(vEndpointA); 144 | vEndpointB = round(vEndpointB); 145 | 146 | // The tolerance is bigger as the slope of the line is closer to any of the 2 axis 147 | float2 normalizedAbsNextToPrevious = normalize(abs(vEndpointA - vEndpointB)); 148 | float maxValue = max(normalizedAbsNextToPrevious.x, normalizedAbsNextToPrevious.y); 149 | float minValue = min(normalizedAbsNextToPrevious.x, normalizedAbsNextToPrevious.y); 150 | float inverseLerp = 1.0f - minValue / maxValue; 151 | 152 | outDistanceCorrection = fBaseTolerance + fToleranceMultiplier * abs(inverseLerp); 153 | } 154 | 155 | void IsPixelInLine(float2 vEndpointA, float2 vEndpointB, float fThickness, float2 vPointP, float fDistanceCorrection, float2 vOrigin, out bool outIsPixelInLine) 156 | { 157 | // The amount of pixels the camera has moved regarding a thickness-wide block of pixels 158 | vOrigin = fmod(vOrigin, float2(fThickness, fThickness)); 159 | vOrigin = round(vOrigin); 160 | 161 | // This moves the line N pixels, this is necessary due to the camera moves 1 pixel each time and the line may be wider than 1 pixel 162 | // so this avoids the line jumping from one block (thickness-wide) to the next, and instead its movement is smoother by moving pixel by pixel 163 | vPointP += float2(fThickness, fThickness) - vOrigin; 164 | vEndpointA += float2(fThickness, fThickness) - vOrigin; 165 | vEndpointB += float2(fThickness, fThickness) - vOrigin; 166 | 167 | vEndpointA = vEndpointA - fmod(vEndpointA, float2(fThickness, fThickness)); 168 | vEndpointB = vEndpointB - fmod(vEndpointB, float2(fThickness, fThickness)); 169 | vEndpointA = round(vEndpointA); 170 | vEndpointB = round(vEndpointB); 171 | vPointP = vPointP - fmod(vPointP, float2(fThickness, fThickness)); 172 | vPointP = round(vPointP); 173 | 174 | const float OFFSET = 0.055f; 175 | 176 | // There are 2 corner cases: when the line is perfectly horizontal and when it is perfectly vertical 177 | // It causes a glitch that makes the line fatter 178 | if (vEndpointA.x == vEndpointB.x) 179 | { 180 | vEndpointA.x -= OFFSET; 181 | } 182 | 183 | if (vEndpointA.y == vEndpointB.y) 184 | { 185 | vEndpointA.y -= OFFSET; 186 | } 187 | 188 | float2 ab = vEndpointB - vEndpointA; 189 | float dotSqrAB = dot(ab, ab); 190 | 191 | float2 ap = vPointP - vEndpointA; 192 | float dotAP_AB = dot(ap, ab); 193 | float normProjectionLength = dotAP_AB / dotSqrAB; 194 | 195 | float projectionLength = dotAP_AB / length(ab); 196 | float2 projectedP = normalize(ab) * projectionLength; 197 | 198 | bool isBetweenAandB = (normProjectionLength >= 0.0f && normProjectionLength <= 1.0f); 199 | float distanceFromPToTheLine = length(ap - projectedP); 200 | 201 | outIsPixelInLine = isBetweenAandB && distanceFromPToTheLine < fThickness* fDistanceCorrection; 202 | } 203 | 204 | float4 MainFragmentShader(Varyings i) : SV_TARGET 205 | { 206 | float4 mainColor = i.color * SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.uv); 207 | float4 maskColor = SAMPLE_TEXTURE2D(_MaskTex, sampler_MaskTex, i.uv); 208 | 209 | clip(mainColor.a == 0.0f ? -1.0f : 1.0f); 210 | 211 | float2 pointA = TransformToScreenSpace(_PointA); 212 | float2 pointB = TransformToScreenSpace(_PointB); 213 | float2 pointP = i.screenPos.xy * _ScreenParams.xy; 214 | 215 | float distanceCorrection = 0.0f; 216 | CalculateDistanceCorrection(_PointA.xy, _PointB.xy, _ToleranceMultiplier, _BaseTolerance, _Thickness, distanceCorrection); 217 | 218 | bool isPixelInLine = false; 219 | IsPixelInLine(_PointA.xy, _PointB.xy, _Thickness, pointP, distanceCorrection, _Origin.xy, isPixelInLine); 220 | 221 | float4 finalColor = isPixelInLine ? _LineColor : _BackgroundColor; 222 | 223 | clip(finalColor.a == 0.0f ? -1.0f : 1.0f); 224 | 225 | bool isEmissive = _IsUnlit; 226 | 227 | if (_IsUnlit == 0.0f) 228 | { 229 | // Lighting 230 | finalColor = CombinedShapeLightShared(finalColor, maskColor, i.screenPos); 231 | } 232 | 233 | return finalColor; 234 | } 235 | ENDHLSL 236 | } 237 | } 238 | 239 | Fallback "Sprites/Default" 240 | 241 | } 242 | -------------------------------------------------------------------------------- /Assets/Runtime/Shaders/S_VectorialLineRenderer2D.shader.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5253fdd1e8388c4469a054041a5f137d 3 | ShaderImporter: 4 | externalObjects: {} 5 | defaultTextures: [] 6 | nonModifiableTextures: [] 7 | preprocessorOverride: 0 8 | userData: 9 | assetBundleName: 10 | assetBundleVariant: 11 | -------------------------------------------------------------------------------- /Assets/Runtime/T_1x1Pixel.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QThund/LineRenderer2D/4b13a889fb01c9eaf6f22c636da476a06590d0b8/Assets/Runtime/T_1x1Pixel.bmp -------------------------------------------------------------------------------- /Assets/Runtime/T_1x1Pixel.bmp.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0fcb97507efc33343adbc2783bc41de1 3 | TextureImporter: 4 | internalIDToNameTable: [] 5 | externalObjects: {} 6 | serializedVersion: 11 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 | vTOnly: 0 27 | grayScaleToAlpha: 0 28 | generateCubemap: 6 29 | cubemapConvolution: 0 30 | seamlessCubemap: 0 31 | textureFormat: 1 32 | maxTextureSize: 2048 33 | textureSettings: 34 | serializedVersion: 2 35 | filterMode: 0 36 | aniso: -1 37 | mipBias: -100 38 | wrapU: 0 39 | wrapV: 0 40 | wrapW: 0 41 | nPOTScale: 0 42 | lightmap: 0 43 | compressionQuality: 50 44 | spriteMode: 1 45 | spriteExtrude: 1 46 | spriteMeshType: 1 47 | alignment: 1 48 | spritePivot: {x: 0.5, y: 0.5} 49 | spritePixelsToUnits: 1 50 | spriteBorder: {x: 0, y: 0, z: 0, w: 0} 51 | spriteGenerateFallbackPhysicsShape: 0 52 | alphaUsage: 0 53 | alphaIsTransparency: 1 54 | spriteTessellationDetail: -1 55 | textureType: 8 56 | textureShape: 1 57 | singleChannelComponent: 0 58 | maxTextureSizeSet: 0 59 | compressionQualitySet: 0 60 | textureFormatSet: 0 61 | ignorePngGamma: 0 62 | applyGammaDecoding: 0 63 | platformSettings: 64 | - serializedVersion: 3 65 | buildTarget: DefaultTexturePlatform 66 | maxTextureSize: 2048 67 | resizeAlgorithm: 0 68 | textureFormat: -1 69 | textureCompression: 0 70 | compressionQuality: 50 71 | crunchedCompression: 0 72 | allowsAlphaSplitting: 0 73 | overridden: 0 74 | androidETC2FallbackOverride: 0 75 | forceMaximumCompressionQuality_BC6H_BC7: 0 76 | - serializedVersion: 3 77 | buildTarget: Standalone 78 | maxTextureSize: 2048 79 | resizeAlgorithm: 0 80 | textureFormat: -1 81 | textureCompression: 0 82 | compressionQuality: 50 83 | crunchedCompression: 0 84 | allowsAlphaSplitting: 0 85 | overridden: 0 86 | androidETC2FallbackOverride: 0 87 | forceMaximumCompressionQuality_BC6H_BC7: 0 88 | spriteSheet: 89 | serializedVersion: 2 90 | sprites: [] 91 | outline: [] 92 | physicsShape: [] 93 | bones: [] 94 | spriteID: 5e97eb03825dee720800000000000000 95 | internalID: 0 96 | vertices: [] 97 | indices: 98 | edges: [] 99 | weights: [] 100 | secondaryTextures: [] 101 | spritePackingTag: 102 | pSDRemoveMatte: 0 103 | pSDShowRemoveMatteOption: 0 104 | userData: 105 | assetBundleName: 106 | assetBundleVariant: 107 | -------------------------------------------------------------------------------- /Assets/Samples.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d43bb7af2133b5947ac06e12ea543c80 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Samples/2D Renderer Data.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: 11145981673336645838492a2d98e247, type: 3} 13 | m_Name: 2D Renderer Data 14 | m_EditorClassIdentifier: 15 | m_RendererFeatures: [] 16 | m_RendererFeatureMap: 17 | m_TransparencySortMode: 0 18 | m_TransparencySortAxis: {x: 0, y: 1, z: 0} 19 | m_HDREmulationScale: 1 20 | m_LightBlendStyles: 21 | - name: Blend Style 0 22 | maskTextureChannel: 0 23 | renderTextureScale: 0.5 24 | blendMode: 1 25 | customBlendFactors: 26 | multiplicative: 0 27 | additive: 0 28 | - name: Blend Style 1 29 | maskTextureChannel: 0 30 | renderTextureScale: 0.5 31 | blendMode: 1 32 | customBlendFactors: 33 | multiplicative: 0 34 | additive: 0 35 | - name: Blend Style 2 36 | maskTextureChannel: 0 37 | renderTextureScale: 0.5 38 | blendMode: 1 39 | customBlendFactors: 40 | multiplicative: 0 41 | additive: 0 42 | - name: Blend Style 3 43 | maskTextureChannel: 0 44 | renderTextureScale: 0.5 45 | blendMode: 1 46 | customBlendFactors: 47 | multiplicative: 0 48 | additive: 0 49 | m_UseDepthStencilBuffer: 1 50 | m_ShapeLightShader: {fileID: 4800000, guid: d79e1c784eaf80c4585c0be7391f757a, type: 3} 51 | m_ShapeLightVolumeShader: {fileID: 4800000, guid: 7e60080c8cd24a2468cb08b4bfee5606, 52 | type: 3} 53 | m_PointLightShader: {fileID: 4800000, guid: e35a31e1679aeff489e202f5cc4853d5, type: 3} 54 | m_PointLightVolumeShader: {fileID: 4800000, guid: c7d04ca57e5449d49ad9cee1c604bc26, 55 | type: 3} 56 | m_BlitShader: {fileID: 4800000, guid: c17132b1f77d20942aa75f8429c0f8bc, type: 3} 57 | m_ShadowGroupShader: {fileID: 4800000, guid: d33b6d70b14697547ad0dc2d4debb009, type: 3} 58 | m_RemoveSelfShadowShader: {fileID: 4800000, guid: 02e071f10b6a15d4d87dac88ce529302, 59 | type: 3} 60 | m_PostProcessData: {fileID: 11400000, guid: 41439944d30ece34e96484bdb6645b55, type: 2} 61 | m_renderTargets: [] 62 | m_Enable2DShadows: 1 63 | m_Enable2DShadowBlurring: 1 64 | m_shadowBlurBlitMaterial: {fileID: 0} 65 | m_EnableLightTextureCaching: 1 66 | m_EnableDebugModeForLightTextureCaching: 0 67 | m_EnableLightTextureCapturing: 1 68 | m_LightTextureBlendStyleToCapture: 0 69 | m_LightTextureSortingLayerToCapture: 0 70 | m_MaximumLightAccumulationPerColorChannel: 3 71 | m_CachedLightsRenderTexture: {fileID: 0} 72 | m_DefaultMaterialType: 0 73 | m_DefaultCustomMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 74 | type: 2} 75 | m_DefaultLitMaterial: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, 76 | type: 2} 77 | m_DefaultUnlitMaterial: {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, 78 | type: 2} 79 | -------------------------------------------------------------------------------- /Assets/Samples/2D Renderer Data.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 8562d1eb740f5ea4fb4b559ce56e825e 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/Samples/TestScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5cec99922ed9b3d488a435b8977aa13f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/Samples/UniversalRenderPipelineAsset.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: bf2edee5c58d82540a51f03df9d42094, type: 3} 13 | m_Name: UniversalRenderPipelineAsset 14 | m_EditorClassIdentifier: 15 | k_AssetVersion: 6 16 | k_AssetPreviousVersion: 5 17 | m_RendererType: 1 18 | m_RendererData: {fileID: 0} 19 | m_RendererDataList: 20 | - {fileID: 11400000, guid: 8562d1eb740f5ea4fb4b559ce56e825e, type: 2} 21 | m_DefaultRendererIndex: 0 22 | m_RequireDepthTexture: 0 23 | m_RequireOpaqueTexture: 0 24 | m_OpaqueDownsampling: 1 25 | m_SupportsTerrainHoles: 1 26 | m_SupportsHDR: 1 27 | m_MSAA: 1 28 | m_RenderScale: 1 29 | m_MainLightRenderingMode: 1 30 | m_MainLightShadowsSupported: 1 31 | m_MainLightShadowmapResolution: 2048 32 | m_AdditionalLightsRenderingMode: 1 33 | m_AdditionalLightsPerObjectLimit: 4 34 | m_AdditionalLightShadowsSupported: 0 35 | m_AdditionalLightsShadowmapResolution: 512 36 | m_ShadowDistance: 50 37 | m_ShadowCascadeCount: 1 38 | m_Cascade2Split: 0.25 39 | m_Cascade3Split: {x: 0.1, y: 0.3} 40 | m_Cascade4Split: {x: 0.067, y: 0.2, z: 0.467} 41 | m_ShadowDepthBias: 1 42 | m_ShadowNormalBias: 1 43 | m_SoftShadowsSupported: 0 44 | m_UseSRPBatcher: 1 45 | m_SupportsDynamicBatching: 0 46 | m_MixedLightingSupported: 1 47 | m_DebugLevel: 0 48 | m_UseAdaptivePerformance: 1 49 | m_ColorGradingMode: 0 50 | m_ColorGradingLutSize: 32 51 | m_ShadowType: 1 52 | m_LocalShadowsSupported: 0 53 | m_LocalShadowsAtlasResolution: 256 54 | m_MaxPixelLights: 0 55 | m_ShadowAtlasResolution: 256 56 | m_ShaderVariantLogLevel: 0 57 | m_ShadowCascades: 0 58 | -------------------------------------------------------------------------------- /Assets/Samples/UniversalRenderPipelineAsset.asset.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4bf28a652bdd07d4f8e08f1fed77aea8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 11400000 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.silicon-heart.line-renderer-2d", 3 | "version": "1.0.6", 4 | "displayName": "Line Renderer 2D", 5 | "description": "Draws pixel-perfect lines calculated in the GPU on a SpriteRenderer.", 6 | "unity": "2020.3", 7 | "documentationUrl": "https://www.jailbrokengame.com/2023/02/10/line-renderer-2d/", 8 | "changelogUrl": "https://discussions.unity.com/t/linerenderer2d-gpu-pixel-perfect-2d-line-renderer-for-unity-urp-2d-renderer/820473", 9 | "licensesUrl": "https://github.com/QThund/LineRenderer2D?tab=MIT-1-ov-file#readme", 10 | "dependencies": { 11 | "com.unity.2d.sprite": "1.0.0", 12 | "com.unity.render-pipelines.universal": "10.4.0" 13 | }, 14 | "keywords": [ 15 | "LineRenderer", 16 | "2D", 17 | "Rendering", 18 | "Pixel" 19 | ], 20 | "author": { 21 | "name": "Silicon Heart Studio", 22 | "email": "SiliconHeartStudio@gmail.com", 23 | "url": "https://www.jailbrokengame.com" 24 | } 25 | } -------------------------------------------------------------------------------- /Assets/package.json.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 872814e640f53474b978051a485b28c2 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Alejandro Villalba Avila 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "com.unity.collab-proxy": "1.3.9", 4 | "com.unity.ide.rider": "2.0.7", 5 | "com.unity.ide.visualstudio": "2.0.7", 6 | "com.unity.ide.vscode": "1.2.3", 7 | "com.unity.render-pipelines.universal": "10.3.2", 8 | "com.unity.test-framework": "1.1.22", 9 | "com.unity.textmeshpro": "3.0.1", 10 | "com.unity.timeline": "1.4.6", 11 | "com.unity.ugui": "1.0.0", 12 | "com.unity.modules.ai": "1.0.0", 13 | "com.unity.modules.androidjni": "1.0.0", 14 | "com.unity.modules.animation": "1.0.0", 15 | "com.unity.modules.assetbundle": "1.0.0", 16 | "com.unity.modules.audio": "1.0.0", 17 | "com.unity.modules.cloth": "1.0.0", 18 | "com.unity.modules.director": "1.0.0", 19 | "com.unity.modules.imageconversion": "1.0.0", 20 | "com.unity.modules.imgui": "1.0.0", 21 | "com.unity.modules.jsonserialize": "1.0.0", 22 | "com.unity.modules.particlesystem": "1.0.0", 23 | "com.unity.modules.physics": "1.0.0", 24 | "com.unity.modules.physics2d": "1.0.0", 25 | "com.unity.modules.screencapture": "1.0.0", 26 | "com.unity.modules.terrain": "1.0.0", 27 | "com.unity.modules.terrainphysics": "1.0.0", 28 | "com.unity.modules.tilemap": "1.0.0", 29 | "com.unity.modules.ui": "1.0.0", 30 | "com.unity.modules.uielements": "1.0.0", 31 | "com.unity.modules.umbra": "1.0.0", 32 | "com.unity.modules.unityanalytics": "1.0.0", 33 | "com.unity.modules.unitywebrequest": "1.0.0", 34 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 35 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 36 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 37 | "com.unity.modules.unitywebrequestwww": "1.0.0", 38 | "com.unity.modules.vehicles": "1.0.0", 39 | "com.unity.modules.video": "1.0.0", 40 | "com.unity.modules.vr": "1.0.0", 41 | "com.unity.modules.wind": "1.0.0", 42 | "com.unity.modules.xr": "1.0.0" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /ProjectSettings/AudioManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!11 &1 4 | AudioManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Volume: 1 8 | Rolloff Scale: 1 9 | Doppler Factor: 1 10 | Default Speaker Mode: 2 11 | m_SampleRate: 0 12 | m_DSPBufferSize: 1024 13 | m_VirtualVoiceCount: 512 14 | m_RealVoiceCount: 32 15 | m_SpatializerPlugin: 16 | m_AmbisonicDecoderPlugin: 17 | m_DisableAudio: 0 18 | m_VirtualizeEffects: 1 19 | m_RequestedDSPBufferSize: 0 20 | -------------------------------------------------------------------------------- /ProjectSettings/ClusterInputManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!236 &1 4 | ClusterInputManager: 5 | m_ObjectHideFlags: 0 6 | m_Inputs: [] 7 | -------------------------------------------------------------------------------- /ProjectSettings/DynamicsManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!55 &1 4 | PhysicsManager: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 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.1 18 | m_ClothInterCollisionStiffness: 0.2 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_ClothGravity: {x: 0, y: -9.81, z: 0} 26 | m_ContactPairsMode: 0 27 | m_BroadphaseType: 0 28 | m_WorldBounds: 29 | m_Center: {x: 0, y: 0, z: 0} 30 | m_Extent: {x: 250, y: 250, z: 250} 31 | m_WorldSubdivisions: 8 32 | m_FrictionType: 0 33 | m_EnableEnhancedDeterminism: 0 34 | m_EnableUnifiedHeightmaps: 1 35 | m_SolverType: 0 36 | m_DefaultMaxAngularSpeed: 7 37 | -------------------------------------------------------------------------------- /ProjectSettings/EditorBuildSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1045 &1 4 | EditorBuildSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_Scenes: 8 | - enabled: 1 9 | path: Assets/Scenes/SampleScene.unity 10 | guid: d1c3109bdb54ad54c8a2b2838528e640 11 | m_configObjects: {} 12 | -------------------------------------------------------------------------------- /ProjectSettings/EditorSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!159 &1 4 | EditorSettings: 5 | m_AssetPipelineMode: 1 6 | m_ObjectHideFlags: 0 7 | serializedVersion: 10 8 | m_ExternalVersionControlSupport: Visible Meta Files 9 | m_SerializationMode: 2 10 | m_LineEndingsForNewScripts: 0 11 | m_DefaultBehaviorMode: 0 12 | m_PrefabRegularEnvironment: {fileID: 0} 13 | m_PrefabUIEnvironment: {fileID: 0} 14 | m_SpritePackerMode: 0 15 | m_SpritePackerPaddingPower: 1 16 | m_EtcTextureCompressorBehavior: 1 17 | m_EtcTextureFastCompressor: 1 18 | m_EtcTextureNormalCompressor: 2 19 | m_EtcTextureBestCompressor: 4 20 | m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;asmref;rsp 21 | m_ProjectGenerationRootNamespace: 22 | m_CollabEditorSettings: 23 | inProgressEnabled: 1 24 | m_EnableTextureStreamingInEditMode: 1 25 | m_EnableTextureStreamingInPlayMode: 1 26 | m_AsyncShaderCompilation: 1 27 | m_EnterPlayModeOptionsEnabled: 0 28 | m_EnterPlayModeOptions: 3 29 | m_ShowLightmapResolutionOverlay: 1 30 | m_UseLegacyProbeSampleCount: 0 31 | m_SerializeInlineMappingsOnOneLine: 1 32 | -------------------------------------------------------------------------------- /ProjectSettings/GraphicsSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!30 &1 4 | GraphicsSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 13 7 | m_Deferred: 8 | m_Mode: 1 9 | m_Shader: {fileID: 69, guid: 0000000000000000f000000000000000, type: 0} 10 | m_DeferredReflections: 11 | m_Mode: 1 12 | m_Shader: {fileID: 74, guid: 0000000000000000f000000000000000, type: 0} 13 | m_ScreenSpaceShadows: 14 | m_Mode: 1 15 | m_Shader: {fileID: 64, guid: 0000000000000000f000000000000000, type: 0} 16 | m_LegacyDeferred: 17 | m_Mode: 1 18 | m_Shader: {fileID: 63, guid: 0000000000000000f000000000000000, type: 0} 19 | m_DepthNormals: 20 | m_Mode: 1 21 | m_Shader: {fileID: 62, guid: 0000000000000000f000000000000000, type: 0} 22 | m_MotionVectors: 23 | m_Mode: 1 24 | m_Shader: {fileID: 75, guid: 0000000000000000f000000000000000, type: 0} 25 | m_LightHalo: 26 | m_Mode: 1 27 | m_Shader: {fileID: 105, guid: 0000000000000000f000000000000000, type: 0} 28 | m_LensFlare: 29 | m_Mode: 1 30 | m_Shader: {fileID: 102, guid: 0000000000000000f000000000000000, type: 0} 31 | m_VideoShadersIncludeMode: 2 32 | m_AlwaysIncludedShaders: 33 | - {fileID: 7, guid: 0000000000000000f000000000000000, type: 0} 34 | - {fileID: 15104, guid: 0000000000000000f000000000000000, type: 0} 35 | - {fileID: 15105, guid: 0000000000000000f000000000000000, type: 0} 36 | - {fileID: 15106, guid: 0000000000000000f000000000000000, type: 0} 37 | - {fileID: 10753, guid: 0000000000000000f000000000000000, type: 0} 38 | - {fileID: 10770, guid: 0000000000000000f000000000000000, type: 0} 39 | - {fileID: 10783, guid: 0000000000000000f000000000000000, type: 0} 40 | - {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0} 41 | - {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0} 42 | - {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0} 43 | m_PreloadedShaders: [] 44 | m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0} 45 | m_CustomRenderPipeline: {fileID: 11400000, guid: 4bf28a652bdd07d4f8e08f1fed77aea8, type: 2} 46 | m_TransparencySortMode: 0 47 | m_TransparencySortAxis: {x: 0, y: 0, z: 1} 48 | m_DefaultRenderingPath: 1 49 | m_DefaultMobileRenderingPath: 1 50 | m_TierSettings: [] 51 | m_LightmapStripping: 0 52 | m_FogStripping: 0 53 | m_InstancingStripping: 0 54 | m_LightmapKeepPlain: 1 55 | m_LightmapKeepDirCombined: 1 56 | m_LightmapKeepDynamicPlain: 1 57 | m_LightmapKeepDynamicDirCombined: 1 58 | m_LightmapKeepShadowMask: 1 59 | m_LightmapKeepSubtractive: 1 60 | m_FogKeepLinear: 1 61 | m_FogKeepExp: 1 62 | m_FogKeepExp2: 1 63 | m_AlbedoSwatchInfos: [] 64 | m_LightsUseLinearIntensity: 1 65 | m_LightsUseColorTemperature: 0 66 | m_DefaultRenderingLayerMask: 1 67 | m_LogWhenShaderIsCompiled: 0 68 | -------------------------------------------------------------------------------- /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 | - serializedVersion: 3 297 | m_Name: Enable Debug Button 1 298 | descriptiveName: 299 | descriptiveNegativeName: 300 | negativeButton: 301 | positiveButton: left ctrl 302 | altNegativeButton: 303 | altPositiveButton: joystick button 8 304 | gravity: 0 305 | dead: 0 306 | sensitivity: 0 307 | snap: 0 308 | invert: 0 309 | type: 0 310 | axis: 0 311 | joyNum: 0 312 | - serializedVersion: 3 313 | m_Name: Enable Debug Button 2 314 | descriptiveName: 315 | descriptiveNegativeName: 316 | negativeButton: 317 | positiveButton: backspace 318 | altNegativeButton: 319 | altPositiveButton: joystick button 9 320 | gravity: 0 321 | dead: 0 322 | sensitivity: 0 323 | snap: 0 324 | invert: 0 325 | type: 0 326 | axis: 0 327 | joyNum: 0 328 | - serializedVersion: 3 329 | m_Name: Debug Reset 330 | descriptiveName: 331 | descriptiveNegativeName: 332 | negativeButton: 333 | positiveButton: left alt 334 | altNegativeButton: 335 | altPositiveButton: joystick button 1 336 | gravity: 0 337 | dead: 0 338 | sensitivity: 0 339 | snap: 0 340 | invert: 0 341 | type: 0 342 | axis: 0 343 | joyNum: 0 344 | - serializedVersion: 3 345 | m_Name: Debug Next 346 | descriptiveName: 347 | descriptiveNegativeName: 348 | negativeButton: 349 | positiveButton: page down 350 | altNegativeButton: 351 | altPositiveButton: joystick button 5 352 | gravity: 0 353 | dead: 0 354 | sensitivity: 0 355 | snap: 0 356 | invert: 0 357 | type: 0 358 | axis: 0 359 | joyNum: 0 360 | - serializedVersion: 3 361 | m_Name: Debug Previous 362 | descriptiveName: 363 | descriptiveNegativeName: 364 | negativeButton: 365 | positiveButton: page up 366 | altNegativeButton: 367 | altPositiveButton: joystick button 4 368 | gravity: 0 369 | dead: 0 370 | sensitivity: 0 371 | snap: 0 372 | invert: 0 373 | type: 0 374 | axis: 0 375 | joyNum: 0 376 | - serializedVersion: 3 377 | m_Name: Debug Validate 378 | descriptiveName: 379 | descriptiveNegativeName: 380 | negativeButton: 381 | positiveButton: return 382 | altNegativeButton: 383 | altPositiveButton: joystick button 0 384 | gravity: 0 385 | dead: 0 386 | sensitivity: 0 387 | snap: 0 388 | invert: 0 389 | type: 0 390 | axis: 0 391 | joyNum: 0 392 | - serializedVersion: 3 393 | m_Name: Debug Persistent 394 | descriptiveName: 395 | descriptiveNegativeName: 396 | negativeButton: 397 | positiveButton: right shift 398 | altNegativeButton: 399 | altPositiveButton: joystick button 2 400 | gravity: 0 401 | dead: 0 402 | sensitivity: 0 403 | snap: 0 404 | invert: 0 405 | type: 0 406 | axis: 0 407 | joyNum: 0 408 | - serializedVersion: 3 409 | m_Name: Debug Multiplier 410 | descriptiveName: 411 | descriptiveNegativeName: 412 | negativeButton: 413 | positiveButton: left shift 414 | altNegativeButton: 415 | altPositiveButton: joystick button 3 416 | gravity: 0 417 | dead: 0 418 | sensitivity: 0 419 | snap: 0 420 | invert: 0 421 | type: 0 422 | axis: 0 423 | joyNum: 0 424 | - serializedVersion: 3 425 | m_Name: Debug Horizontal 426 | descriptiveName: 427 | descriptiveNegativeName: 428 | negativeButton: left 429 | positiveButton: right 430 | altNegativeButton: 431 | altPositiveButton: 432 | gravity: 1000 433 | dead: 0.001 434 | sensitivity: 1000 435 | snap: 0 436 | invert: 0 437 | type: 0 438 | axis: 0 439 | joyNum: 0 440 | - serializedVersion: 3 441 | m_Name: Debug Vertical 442 | descriptiveName: 443 | descriptiveNegativeName: 444 | negativeButton: down 445 | positiveButton: up 446 | altNegativeButton: 447 | altPositiveButton: 448 | gravity: 1000 449 | dead: 0.001 450 | sensitivity: 1000 451 | snap: 0 452 | invert: 0 453 | type: 0 454 | axis: 0 455 | joyNum: 0 456 | - serializedVersion: 3 457 | m_Name: Debug Vertical 458 | descriptiveName: 459 | descriptiveNegativeName: 460 | negativeButton: down 461 | positiveButton: up 462 | altNegativeButton: 463 | altPositiveButton: 464 | gravity: 1000 465 | dead: 0.001 466 | sensitivity: 1000 467 | snap: 0 468 | invert: 0 469 | type: 2 470 | axis: 6 471 | joyNum: 0 472 | - serializedVersion: 3 473 | m_Name: Debug Horizontal 474 | descriptiveName: 475 | descriptiveNegativeName: 476 | negativeButton: left 477 | positiveButton: right 478 | altNegativeButton: 479 | altPositiveButton: 480 | gravity: 1000 481 | dead: 0.001 482 | sensitivity: 1000 483 | snap: 0 484 | invert: 0 485 | type: 2 486 | axis: 5 487 | joyNum: 0 488 | -------------------------------------------------------------------------------- /ProjectSettings/NavMeshAreas.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!126 &1 4 | NavMeshProjectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | areas: 8 | - name: Walkable 9 | cost: 1 10 | - name: Not Walkable 11 | cost: 1 12 | - name: Jump 13 | cost: 2 14 | - name: 15 | cost: 1 16 | - name: 17 | cost: 1 18 | - name: 19 | cost: 1 20 | - name: 21 | cost: 1 22 | - name: 23 | cost: 1 24 | - name: 25 | cost: 1 26 | - name: 27 | cost: 1 28 | - name: 29 | cost: 1 30 | - name: 31 | cost: 1 32 | - name: 33 | cost: 1 34 | - name: 35 | cost: 1 36 | - name: 37 | cost: 1 38 | - name: 39 | cost: 1 40 | - name: 41 | cost: 1 42 | - name: 43 | cost: 1 44 | - name: 45 | cost: 1 46 | - name: 47 | cost: 1 48 | - name: 49 | cost: 1 50 | - name: 51 | cost: 1 52 | - name: 53 | cost: 1 54 | - name: 55 | cost: 1 56 | - name: 57 | cost: 1 58 | - name: 59 | cost: 1 60 | - name: 61 | cost: 1 62 | - name: 63 | cost: 1 64 | - name: 65 | cost: 1 66 | - name: 67 | cost: 1 68 | - name: 69 | cost: 1 70 | - name: 71 | cost: 1 72 | m_LastAgentTypeID: -887442657 73 | m_Settings: 74 | - serializedVersion: 2 75 | agentTypeID: 0 76 | agentRadius: 0.5 77 | agentHeight: 2 78 | agentSlope: 45 79 | agentClimb: 0.75 80 | ledgeDropHeight: 0 81 | maxJumpAcrossDistance: 0 82 | minRegionArea: 2 83 | manualCellSize: 0 84 | cellSize: 0.16666667 85 | manualTileSize: 0 86 | tileSize: 256 87 | accuratePlacement: 0 88 | debug: 89 | m_Flags: 0 90 | m_SettingNames: 91 | - Humanoid 92 | -------------------------------------------------------------------------------- /ProjectSettings/PackageManagerSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_EnablePreviewPackages: 0 16 | m_EnablePackageDependencies: 0 17 | m_AdvancedSettingsExpanded: 1 18 | m_ScopedRegistriesSettingsExpanded: 1 19 | oneTimeWarningShown: 0 20 | m_Registries: 21 | - m_Id: main 22 | m_Name: 23 | m_Url: https://packages.unity.com 24 | m_Scopes: [] 25 | m_IsDefault: 1 26 | m_Capabilities: 7 27 | m_UserSelectedRegistryName: 28 | m_UserAddingNewScopedRegistry: 0 29 | m_RegistryInfoDraft: 30 | m_ErrorMessage: 31 | m_Original: 32 | m_Id: 33 | m_Name: 34 | m_Url: 35 | m_Scopes: [] 36 | m_IsDefault: 0 37 | m_Capabilities: 0 38 | m_Modified: 0 39 | m_Name: 40 | m_Url: 41 | m_Scopes: 42 | - 43 | m_SelectedScopeIndex: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/Physics2DSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!19 &1 4 | Physics2DSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 4 7 | m_Gravity: {x: 0, y: -9.81} 8 | m_DefaultMaterial: {fileID: 0} 9 | m_VelocityIterations: 8 10 | m_PositionIterations: 3 11 | m_VelocityThreshold: 1 12 | m_MaxLinearCorrection: 0.2 13 | m_MaxAngularCorrection: 8 14 | m_MaxTranslationSpeed: 100 15 | m_MaxRotationSpeed: 360 16 | m_BaumgarteScale: 0.2 17 | m_BaumgarteTimeOfImpactScale: 0.75 18 | m_TimeToSleep: 0.5 19 | m_LinearSleepTolerance: 0.01 20 | m_AngularSleepTolerance: 2 21 | m_DefaultContactOffset: 0.01 22 | m_JobOptions: 23 | serializedVersion: 2 24 | useMultithreading: 0 25 | useConsistencySorting: 0 26 | m_InterpolationPosesPerJob: 100 27 | m_NewContactsPerJob: 30 28 | m_CollideContactsPerJob: 100 29 | m_ClearFlagsPerJob: 200 30 | m_ClearBodyForcesPerJob: 200 31 | m_SyncDiscreteFixturesPerJob: 50 32 | m_SyncContinuousFixturesPerJob: 50 33 | m_FindNearestContactsPerJob: 100 34 | m_UpdateTriggerContactsPerJob: 100 35 | m_IslandSolverCostThreshold: 100 36 | m_IslandSolverBodyCostScale: 1 37 | m_IslandSolverContactCostScale: 10 38 | m_IslandSolverJointCostScale: 10 39 | m_IslandSolverBodiesPerJob: 50 40 | m_IslandSolverContactsPerJob: 50 41 | m_AutoSimulation: 1 42 | m_QueriesHitTriggers: 1 43 | m_QueriesStartInColliders: 1 44 | m_CallbacksOnDisable: 1 45 | m_ReuseCollisionCallbacks: 1 46 | m_AutoSyncTransforms: 0 47 | m_AlwaysShowColliders: 0 48 | m_ShowColliderSleep: 1 49 | m_ShowColliderContacts: 0 50 | m_ShowColliderAABB: 0 51 | m_ContactArrowScale: 0.2 52 | m_ColliderAwakeColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.7529412} 53 | m_ColliderAsleepColor: {r: 0.5686275, g: 0.95686275, b: 0.54509807, a: 0.36078432} 54 | m_ColliderContactColor: {r: 1, g: 0, b: 1, a: 0.6862745} 55 | m_ColliderAABBColor: {r: 1, g: 1, b: 0, a: 0.2509804} 56 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 57 | -------------------------------------------------------------------------------- /ProjectSettings/PresetManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!1386491679 &1 4 | PresetManager: 5 | m_ObjectHideFlags: 0 6 | m_DefaultList: 7 | - type: 8 | m_NativeTypeID: 108 9 | m_ManagedTypePPtr: {fileID: 0} 10 | m_ManagedTypeFallback: 11 | defaultPresets: 12 | - m_Preset: {fileID: 2655988077585873504, guid: 463065d4f17d1d94d848aa127b94dd43, 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: e7689051185d12f4298e1ebb2693a29f, 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: e8537455c6c08bd4e8bf0be3707da685, 27 | type: 2} 28 | -------------------------------------------------------------------------------- /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: 22 7 | productGUID: 45fe11fced9baee468891b5399cf3bf0 8 | AndroidProfiler: 0 9 | AndroidFilterTouchesWhenObscured: 0 10 | AndroidEnableSustainedPerformanceMode: 0 11 | defaultScreenOrientation: 4 12 | targetDevice: 2 13 | useOnDemandResources: 0 14 | accelerometerFrequency: 60 15 | companyName: SiliconHeartStudio 16 | productName: LineRenderer2D 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: 1920 46 | defaultScreenHeight: 1080 47 | defaultScreenWidthWeb: 960 48 | defaultScreenHeightWeb: 600 49 | m_StereoRenderingPath: 0 50 | m_ActiveColorSpace: 1 51 | m_MTRendering: 1 52 | mipStripping: 0 53 | numberOfMipsStripped: 0 54 | m_StackTraceTypes: 010000000100000001000000010000000100000001000000 55 | iosShowActivityIndicatorOnLoading: -1 56 | androidShowActivityIndicatorOnLoading: -1 57 | iosUseCustomAppBackgroundBehavior: 0 58 | iosAllowHTTPDownload: 1 59 | allowedAutorotateToPortrait: 1 60 | allowedAutorotateToPortraitUpsideDown: 1 61 | allowedAutorotateToLandscapeRight: 1 62 | allowedAutorotateToLandscapeLeft: 1 63 | useOSAutorotation: 1 64 | use32BitDisplayBuffer: 1 65 | preserveFramebufferAlpha: 0 66 | disableDepthAndStencilBuffers: 0 67 | androidStartInFullscreen: 1 68 | androidRenderOutsideSafeArea: 0 69 | androidUseSwappy: 1 70 | androidBlitType: 1 71 | defaultIsNativeResolution: 1 72 | macRetinaSupport: 1 73 | runInBackground: 1 74 | captureSingleScreen: 0 75 | muteOtherAudioSources: 0 76 | Prepare IOS For Recording: 0 77 | Force IOS Speakers When Recording: 0 78 | deferSystemGesturesMode: 0 79 | hideHomeButton: 0 80 | submitAnalytics: 1 81 | usePlayerLog: 1 82 | bakeCollisionMeshes: 0 83 | forceSingleInstance: 0 84 | useFlipModelSwapchain: 1 85 | resizableWindow: 0 86 | useMacAppStoreValidation: 0 87 | macAppStoreCategory: public.app-category.games 88 | gpuSkinning: 1 89 | xboxPIXTextureCapture: 0 90 | xboxEnableAvatar: 0 91 | xboxEnableKinect: 0 92 | xboxEnableKinectAutoTracking: 0 93 | xboxEnableFitness: 0 94 | visibleInBackground: 1 95 | allowFullscreenSwitch: 1 96 | fullscreenMode: 1 97 | xboxSpeechDB: 0 98 | xboxEnableHeadOrientation: 0 99 | xboxEnableGuest: 0 100 | xboxEnablePIXSampling: 0 101 | metalFramebufferOnly: 0 102 | xboxOneResolution: 0 103 | xboxOneSResolution: 0 104 | xboxOneXResolution: 3 105 | xboxOneMonoLoggingLevel: 0 106 | xboxOneLoggingLevel: 1 107 | xboxOneDisableEsram: 0 108 | xboxOneEnableTypeOptimization: 0 109 | xboxOnePresentImmediateThreshold: 0 110 | switchQueueCommandMemory: 0 111 | switchQueueControlMemory: 0 112 | switchQueueComputeMemory: 262144 113 | switchNVNShaderPoolsGranularity: 33554432 114 | switchNVNDefaultPoolsGranularity: 16777216 115 | switchNVNOtherPoolsGranularity: 16777216 116 | switchNVNMaxPublicTextureIDCount: 0 117 | switchNVNMaxPublicSamplerIDCount: 0 118 | stadiaPresentMode: 0 119 | stadiaTargetFramerate: 0 120 | vulkanNumSwapchainBuffers: 3 121 | vulkanEnableSetSRGBWrite: 0 122 | vulkanEnablePreTransform: 0 123 | vulkanEnableLateAcquireNextImage: 0 124 | m_SupportedAspectRatios: 125 | 4:3: 1 126 | 5:4: 1 127 | 16:10: 1 128 | 16:9: 1 129 | Others: 1 130 | bundleVersion: 1.0.6 131 | preloadedAssets: [] 132 | metroInputSource: 0 133 | wsaTransparentSwapchain: 0 134 | m_HolographicPauseOnTrackingLoss: 1 135 | xboxOneDisableKinectGpuReservation: 1 136 | xboxOneEnable7thCore: 1 137 | vrSettings: 138 | enable360StereoCapture: 0 139 | isWsaHolographicRemotingEnabled: 0 140 | enableFrameTimingStats: 0 141 | useHDRDisplay: 0 142 | D3DHDRBitDepth: 0 143 | m_ColorGamuts: 0000000003000000 144 | targetPixelDensity: 30 145 | resolutionScalingMode: 0 146 | androidSupportedAspectRatio: 1 147 | androidMaxAspectRatio: 2.1 148 | applicationIdentifier: 149 | Standalone: com.SiliconHeartStudio.LineRenderer2D 150 | buildNumber: 151 | Standalone: 0 152 | iPhone: 0 153 | tvOS: 0 154 | overrideDefaultApplicationIdentifier: 0 155 | AndroidBundleVersionCode: 1 156 | AndroidMinSdkVersion: 19 157 | AndroidTargetSdkVersion: 0 158 | AndroidPreferredInstallLocation: 1 159 | aotOptions: 160 | stripEngineCode: 1 161 | iPhoneStrippingLevel: 0 162 | iPhoneScriptCallOptimization: 0 163 | ForceInternetPermission: 0 164 | ForceSDCardPermission: 0 165 | CreateWallpaper: 0 166 | APKExpansionFiles: 0 167 | keepLoadedShadersAlive: 0 168 | StripUnusedMeshComponents: 0 169 | VertexChannelCompressionMask: 4054 170 | iPhoneSdkVersion: 988 171 | iOSTargetOSVersionString: 11.0 172 | tvOSSdkVersion: 0 173 | tvOSRequireExtendedGameController: 0 174 | tvOSTargetOSVersionString: 11.0 175 | uIPrerenderedIcon: 0 176 | uIRequiresPersistentWiFi: 0 177 | uIRequiresFullScreen: 1 178 | uIStatusBarHidden: 1 179 | uIExitOnSuspend: 0 180 | uIStatusBarStyle: 0 181 | appleTVSplashScreen: {fileID: 0} 182 | appleTVSplashScreen2x: {fileID: 0} 183 | tvOSSmallIconLayers: [] 184 | tvOSSmallIconLayers2x: [] 185 | tvOSLargeIconLayers: [] 186 | tvOSLargeIconLayers2x: [] 187 | tvOSTopShelfImageLayers: [] 188 | tvOSTopShelfImageLayers2x: [] 189 | tvOSTopShelfImageWideLayers: [] 190 | tvOSTopShelfImageWideLayers2x: [] 191 | iOSLaunchScreenType: 0 192 | iOSLaunchScreenPortrait: {fileID: 0} 193 | iOSLaunchScreenLandscape: {fileID: 0} 194 | iOSLaunchScreenBackgroundColor: 195 | serializedVersion: 2 196 | rgba: 0 197 | iOSLaunchScreenFillPct: 100 198 | iOSLaunchScreenSize: 100 199 | iOSLaunchScreenCustomXibPath: 200 | iOSLaunchScreeniPadType: 0 201 | iOSLaunchScreeniPadImage: {fileID: 0} 202 | iOSLaunchScreeniPadBackgroundColor: 203 | serializedVersion: 2 204 | rgba: 0 205 | iOSLaunchScreeniPadFillPct: 100 206 | iOSLaunchScreeniPadSize: 100 207 | iOSLaunchScreeniPadCustomXibPath: 208 | iOSLaunchScreenCustomStoryboardPath: 209 | iOSLaunchScreeniPadCustomStoryboardPath: 210 | iOSDeviceRequirements: [] 211 | iOSURLSchemes: [] 212 | iOSBackgroundModes: 0 213 | iOSMetalForceHardShadows: 0 214 | metalEditorSupport: 1 215 | metalAPIValidation: 1 216 | iOSRenderExtraFrameOnPause: 0 217 | iosCopyPluginsCodeInsteadOfSymlink: 0 218 | appleDeveloperTeamID: 219 | iOSManualSigningProvisioningProfileID: 220 | tvOSManualSigningProvisioningProfileID: 221 | iOSManualSigningProvisioningProfileType: 0 222 | tvOSManualSigningProvisioningProfileType: 0 223 | appleEnableAutomaticSigning: 0 224 | iOSRequireARKit: 0 225 | iOSAutomaticallyDetectAndAddCapabilities: 1 226 | appleEnableProMotion: 0 227 | shaderPrecisionModel: 0 228 | clonedFromGUID: 9870af204204ab84596f8a656f2f2ce6 229 | templatePackageId: com.unity.template.universal@10.3.2 230 | templateDefaultScene: Assets/Scenes/SampleScene.unity 231 | useCustomMainManifest: 0 232 | useCustomLauncherManifest: 0 233 | useCustomMainGradleTemplate: 0 234 | useCustomLauncherGradleManifest: 0 235 | useCustomBaseGradleTemplate: 0 236 | useCustomGradlePropertiesTemplate: 0 237 | useCustomProguardFile: 0 238 | AndroidTargetArchitectures: 1 239 | AndroidSplashScreenScale: 0 240 | androidSplashScreen: {fileID: 0} 241 | AndroidKeystoreName: 242 | AndroidKeyaliasName: 243 | AndroidBuildApkPerCpuArchitecture: 0 244 | AndroidTVCompatibility: 0 245 | AndroidIsGame: 1 246 | AndroidEnableTango: 0 247 | androidEnableBanner: 1 248 | androidUseLowAccuracyLocation: 0 249 | androidUseCustomKeystore: 0 250 | m_AndroidBanners: 251 | - width: 320 252 | height: 180 253 | banner: {fileID: 0} 254 | androidGamepadSupportLevel: 0 255 | AndroidMinifyWithR8: 0 256 | AndroidMinifyRelease: 0 257 | AndroidMinifyDebug: 0 258 | AndroidValidateAppBundleSize: 1 259 | AndroidAppBundleSizeToValidate: 100 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: iPhone 270 | m_StaticBatching: 1 271 | m_DynamicBatching: 0 272 | - m_BuildTarget: Android 273 | m_StaticBatching: 1 274 | m_DynamicBatching: 0 275 | - m_BuildTarget: WebGL 276 | m_StaticBatching: 0 277 | m_DynamicBatching: 0 278 | m_BuildTargetGraphicsJobs: 279 | - m_BuildTarget: MacStandaloneSupport 280 | m_GraphicsJobs: 0 281 | - m_BuildTarget: Switch 282 | m_GraphicsJobs: 1 283 | - m_BuildTarget: MetroSupport 284 | m_GraphicsJobs: 1 285 | - m_BuildTarget: AppleTVSupport 286 | m_GraphicsJobs: 0 287 | - m_BuildTarget: BJMSupport 288 | m_GraphicsJobs: 1 289 | - m_BuildTarget: LinuxStandaloneSupport 290 | m_GraphicsJobs: 1 291 | - m_BuildTarget: PS4Player 292 | m_GraphicsJobs: 1 293 | - m_BuildTarget: iOSSupport 294 | m_GraphicsJobs: 0 295 | - m_BuildTarget: WindowsStandaloneSupport 296 | m_GraphicsJobs: 1 297 | - m_BuildTarget: XboxOnePlayer 298 | m_GraphicsJobs: 1 299 | - m_BuildTarget: LuminSupport 300 | m_GraphicsJobs: 0 301 | - m_BuildTarget: AndroidPlayer 302 | m_GraphicsJobs: 0 303 | - m_BuildTarget: WebGLSupport 304 | m_GraphicsJobs: 0 305 | m_BuildTargetGraphicsJobMode: 306 | - m_BuildTarget: PS4Player 307 | m_GraphicsJobMode: 0 308 | - m_BuildTarget: XboxOnePlayer 309 | m_GraphicsJobMode: 0 310 | m_BuildTargetGraphicsAPIs: 311 | - m_BuildTarget: iOSSupport 312 | m_APIs: 10000000 313 | m_Automatic: 1 314 | - m_BuildTarget: AppleTVSupport 315 | m_APIs: 10000000 316 | m_Automatic: 1 317 | - m_BuildTarget: AndroidPlayer 318 | m_APIs: 150000000b000000 319 | m_Automatic: 0 320 | - m_BuildTarget: WebGLSupport 321 | m_APIs: 0b000000 322 | m_Automatic: 0 323 | - m_BuildTarget: WindowsStandaloneSupport 324 | m_APIs: 1100000002000000 325 | m_Automatic: 0 326 | m_BuildTargetVRSettings: [] 327 | openGLRequireES31: 0 328 | openGLRequireES31AEP: 0 329 | openGLRequireES32: 0 330 | m_TemplateCustomTags: {} 331 | mobileMTRendering: 332 | Android: 1 333 | iPhone: 1 334 | tvOS: 1 335 | m_BuildTargetGroupLightmapEncodingQuality: 336 | - m_BuildTarget: Standalone 337 | m_EncodingQuality: 1 338 | m_BuildTargetGroupLightmapSettings: [] 339 | m_BuildTargetNormalMapEncoding: [] 340 | playModeTestRunnerEnabled: 0 341 | runPlayModeTestAsEditModeTest: 0 342 | actionOnDotNetUnhandledException: 1 343 | enableInternalProfiler: 0 344 | logObjCUncaughtExceptions: 1 345 | enableCrashReportAPI: 0 346 | cameraUsageDescription: 347 | locationUsageDescription: 348 | microphoneUsageDescription: 349 | switchNMETAOverride: 350 | switchNetLibKey: 351 | switchSocketMemoryPoolSize: 6144 352 | switchSocketAllocatorPoolSize: 128 353 | switchSocketConcurrencyLimit: 14 354 | switchScreenResolutionBehavior: 2 355 | switchUseCPUProfiler: 0 356 | switchUseGOLDLinker: 0 357 | switchApplicationID: 0x01004b9000490000 358 | switchNSODependencies: 359 | switchTitleNames_0: 360 | switchTitleNames_1: 361 | switchTitleNames_2: 362 | switchTitleNames_3: 363 | switchTitleNames_4: 364 | switchTitleNames_5: 365 | switchTitleNames_6: 366 | switchTitleNames_7: 367 | switchTitleNames_8: 368 | switchTitleNames_9: 369 | switchTitleNames_10: 370 | switchTitleNames_11: 371 | switchTitleNames_12: 372 | switchTitleNames_13: 373 | switchTitleNames_14: 374 | switchTitleNames_15: 375 | switchPublisherNames_0: 376 | switchPublisherNames_1: 377 | switchPublisherNames_2: 378 | switchPublisherNames_3: 379 | switchPublisherNames_4: 380 | switchPublisherNames_5: 381 | switchPublisherNames_6: 382 | switchPublisherNames_7: 383 | switchPublisherNames_8: 384 | switchPublisherNames_9: 385 | switchPublisherNames_10: 386 | switchPublisherNames_11: 387 | switchPublisherNames_12: 388 | switchPublisherNames_13: 389 | switchPublisherNames_14: 390 | switchPublisherNames_15: 391 | switchIcons_0: {fileID: 0} 392 | switchIcons_1: {fileID: 0} 393 | switchIcons_2: {fileID: 0} 394 | switchIcons_3: {fileID: 0} 395 | switchIcons_4: {fileID: 0} 396 | switchIcons_5: {fileID: 0} 397 | switchIcons_6: {fileID: 0} 398 | switchIcons_7: {fileID: 0} 399 | switchIcons_8: {fileID: 0} 400 | switchIcons_9: {fileID: 0} 401 | switchIcons_10: {fileID: 0} 402 | switchIcons_11: {fileID: 0} 403 | switchIcons_12: {fileID: 0} 404 | switchIcons_13: {fileID: 0} 405 | switchIcons_14: {fileID: 0} 406 | switchIcons_15: {fileID: 0} 407 | switchSmallIcons_0: {fileID: 0} 408 | switchSmallIcons_1: {fileID: 0} 409 | switchSmallIcons_2: {fileID: 0} 410 | switchSmallIcons_3: {fileID: 0} 411 | switchSmallIcons_4: {fileID: 0} 412 | switchSmallIcons_5: {fileID: 0} 413 | switchSmallIcons_6: {fileID: 0} 414 | switchSmallIcons_7: {fileID: 0} 415 | switchSmallIcons_8: {fileID: 0} 416 | switchSmallIcons_9: {fileID: 0} 417 | switchSmallIcons_10: {fileID: 0} 418 | switchSmallIcons_11: {fileID: 0} 419 | switchSmallIcons_12: {fileID: 0} 420 | switchSmallIcons_13: {fileID: 0} 421 | switchSmallIcons_14: {fileID: 0} 422 | switchSmallIcons_15: {fileID: 0} 423 | switchManualHTML: 424 | switchAccessibleURLs: 425 | switchLegalInformation: 426 | switchMainThreadStackSize: 1048576 427 | switchPresenceGroupId: 428 | switchLogoHandling: 0 429 | switchReleaseVersion: 0 430 | switchDisplayVersion: 1.0.0 431 | switchStartupUserAccount: 0 432 | switchTouchScreenUsage: 0 433 | switchSupportedLanguagesMask: 0 434 | switchLogoType: 0 435 | switchApplicationErrorCodeCategory: 436 | switchUserAccountSaveDataSize: 0 437 | switchUserAccountSaveDataJournalSize: 0 438 | switchApplicationAttribute: 0 439 | switchCardSpecSize: -1 440 | switchCardSpecClock: -1 441 | switchRatingsMask: 0 442 | switchRatingsInt_0: 0 443 | switchRatingsInt_1: 0 444 | switchRatingsInt_2: 0 445 | switchRatingsInt_3: 0 446 | switchRatingsInt_4: 0 447 | switchRatingsInt_5: 0 448 | switchRatingsInt_6: 0 449 | switchRatingsInt_7: 0 450 | switchRatingsInt_8: 0 451 | switchRatingsInt_9: 0 452 | switchRatingsInt_10: 0 453 | switchRatingsInt_11: 0 454 | switchRatingsInt_12: 0 455 | switchLocalCommunicationIds_0: 456 | switchLocalCommunicationIds_1: 457 | switchLocalCommunicationIds_2: 458 | switchLocalCommunicationIds_3: 459 | switchLocalCommunicationIds_4: 460 | switchLocalCommunicationIds_5: 461 | switchLocalCommunicationIds_6: 462 | switchLocalCommunicationIds_7: 463 | switchParentalControl: 0 464 | switchAllowsScreenshot: 1 465 | switchAllowsVideoCapturing: 1 466 | switchAllowsRuntimeAddOnContentInstall: 0 467 | switchDataLossConfirmation: 0 468 | switchUserAccountLockEnabled: 0 469 | switchSystemResourceMemory: 16777216 470 | switchSupportedNpadStyles: 22 471 | switchNativeFsCacheSize: 32 472 | switchIsHoldTypeHorizontal: 0 473 | switchSupportedNpadCount: 8 474 | switchSocketConfigEnabled: 0 475 | switchTcpInitialSendBufferSize: 32 476 | switchTcpInitialReceiveBufferSize: 64 477 | switchTcpAutoSendBufferSizeMax: 256 478 | switchTcpAutoReceiveBufferSizeMax: 256 479 | switchUdpSendBufferSize: 9 480 | switchUdpReceiveBufferSize: 42 481 | switchSocketBufferEfficiency: 4 482 | switchSocketInitializeEnabled: 1 483 | switchNetworkInterfaceManagerInitializeEnabled: 1 484 | switchPlayerConnectionEnabled: 1 485 | switchUseNewStyleFilepaths: 0 486 | ps4NPAgeRating: 12 487 | ps4NPTitleSecret: 488 | ps4NPTrophyPackPath: 489 | ps4ParentalLevel: 11 490 | ps4ContentID: ED1633-NPXX51362_00-0000000000000000 491 | ps4Category: 0 492 | ps4MasterVersion: 01.00 493 | ps4AppVersion: 01.00 494 | ps4AppType: 0 495 | ps4ParamSfxPath: 496 | ps4VideoOutPixelFormat: 0 497 | ps4VideoOutInitialWidth: 1920 498 | ps4VideoOutBaseModeInitialWidth: 1920 499 | ps4VideoOutReprojectionRate: 60 500 | ps4PronunciationXMLPath: 501 | ps4PronunciationSIGPath: 502 | ps4BackgroundImagePath: 503 | ps4StartupImagePath: 504 | ps4StartupImagesFolder: 505 | ps4IconImagesFolder: 506 | ps4SaveDataImagePath: 507 | ps4SdkOverride: 508 | ps4BGMPath: 509 | ps4ShareFilePath: 510 | ps4ShareOverlayImagePath: 511 | ps4PrivacyGuardImagePath: 512 | ps4ExtraSceSysFile: 513 | ps4NPtitleDatPath: 514 | ps4RemotePlayKeyAssignment: -1 515 | ps4RemotePlayKeyMappingDir: 516 | ps4PlayTogetherPlayerCount: 0 517 | ps4EnterButtonAssignment: 1 518 | ps4ApplicationParam1: 0 519 | ps4ApplicationParam2: 0 520 | ps4ApplicationParam3: 0 521 | ps4ApplicationParam4: 0 522 | ps4DownloadDataSize: 0 523 | ps4GarlicHeapSize: 2048 524 | ps4ProGarlicHeapSize: 2560 525 | playerPrefsMaxSize: 32768 526 | ps4Passcode: frAQBc8Wsa1xVPfvJcrgRYwTiizs2trQ 527 | ps4pnSessions: 1 528 | ps4pnPresence: 1 529 | ps4pnFriends: 1 530 | ps4pnGameCustomData: 1 531 | playerPrefsSupport: 0 532 | enableApplicationExit: 0 533 | resetTempFolder: 1 534 | restrictedAudioUsageRights: 0 535 | ps4UseResolutionFallback: 0 536 | ps4ReprojectionSupport: 0 537 | ps4UseAudio3dBackend: 0 538 | ps4UseLowGarlicFragmentationMode: 1 539 | ps4SocialScreenEnabled: 0 540 | ps4ScriptOptimizationLevel: 0 541 | ps4Audio3dVirtualSpeakerCount: 14 542 | ps4attribCpuUsage: 0 543 | ps4PatchPkgPath: 544 | ps4PatchLatestPkgPath: 545 | ps4PatchChangeinfoPath: 546 | ps4PatchDayOne: 0 547 | ps4attribUserManagement: 0 548 | ps4attribMoveSupport: 0 549 | ps4attrib3DSupport: 0 550 | ps4attribShareSupport: 0 551 | ps4attribExclusiveVR: 0 552 | ps4disableAutoHideSplash: 0 553 | ps4videoRecordingFeaturesUsed: 0 554 | ps4contentSearchFeaturesUsed: 0 555 | ps4CompatibilityPS5: 0 556 | ps4GPU800MHz: 1 557 | ps4attribEyeToEyeDistanceSettingVR: 0 558 | ps4IncludedModules: 559 | - libc.prx 560 | - libSceAudioLatencyEstimation.prx 561 | - libSceFace.prx 562 | - libSceFaceTracker.prx 563 | - libSceFios2.prx 564 | - libSceHand.prx 565 | - libSceHandTracker.prx 566 | - libSceHeadTracker.prx 567 | - libSceJobManager.prx 568 | - libSceNpToolkit2.prx 569 | - libSceS3DConversion.prx 570 | ps4attribVROutputEnabled: 0 571 | monoEnv: 572 | splashScreenBackgroundSourceLandscape: {fileID: 0} 573 | splashScreenBackgroundSourcePortrait: {fileID: 0} 574 | blurSplashScreenBackground: 1 575 | spritePackerPolicy: 576 | webGLMemorySize: 16 577 | webGLExceptionSupport: 1 578 | webGLNameFilesAsHashes: 0 579 | webGLDataCaching: 1 580 | webGLDebugSymbols: 0 581 | webGLEmscriptenArgs: 582 | webGLModulesDirectory: 583 | webGLTemplate: APPLICATION:Default 584 | webGLAnalyzeBuildSize: 0 585 | webGLUseEmbeddedResources: 0 586 | webGLCompressionFormat: 1 587 | webGLWasmArithmeticExceptions: 0 588 | webGLLinkerTarget: 1 589 | webGLThreadsSupport: 0 590 | webGLDecompressionFallback: 0 591 | scriptingDefineSymbols: {} 592 | additionalCompilerArguments: {} 593 | platformArchitecture: {} 594 | scriptingBackend: 595 | Standalone: 0 596 | il2cppCompilerConfiguration: {} 597 | managedStrippingLevel: {} 598 | incrementalIl2cppBuild: {} 599 | suppressCommonWarnings: 1 600 | allowUnsafeCode: 0 601 | useDeterministicCompilation: 1 602 | useReferenceAssemblies: 1 603 | enableRoslynAnalyzers: 1 604 | additionalIl2CppArgs: 605 | scriptingRuntimeVersion: 1 606 | gcIncremental: 1 607 | assemblyVersionValidation: 1 608 | gcWBarrierValidation: 0 609 | apiCompatibilityLevelPerPlatform: 610 | Standalone: 3 611 | m_RenderingPath: 1 612 | m_MobileRenderingPath: 1 613 | metroPackageName: Template_Lightweight 614 | metroPackageVersion: 615 | metroCertificatePath: 616 | metroCertificatePassword: 617 | metroCertificateSubject: 618 | metroCertificateIssuer: 619 | metroCertificateNotAfter: 0000000000000000 620 | metroApplicationDescription: Template_Lightweight 621 | wsaImages: {} 622 | metroTileShortName: 623 | metroTileShowName: 0 624 | metroMediumTileShowName: 0 625 | metroLargeTileShowName: 0 626 | metroWideTileShowName: 0 627 | metroSupportStreamingInstall: 0 628 | metroLastRequiredScene: 0 629 | metroDefaultTileSize: 1 630 | metroTileForegroundText: 2 631 | metroTileBackgroundColor: {r: 0.13333334, g: 0.17254902, b: 0.21568628, a: 0} 632 | metroSplashScreenBackgroundColor: {r: 0.12941177, g: 0.17254902, b: 0.21568628, a: 1} 633 | metroSplashScreenUseBackgroundColor: 0 634 | platformCapabilities: {} 635 | metroTargetDeviceFamilies: {} 636 | metroFTAName: 637 | metroFTAFileTypes: [] 638 | metroProtocolName: 639 | XboxOneProductId: 640 | XboxOneUpdateKey: 641 | XboxOneSandboxId: 642 | XboxOneContentId: 643 | XboxOneTitleId: 644 | XboxOneSCId: 645 | XboxOneGameOsOverridePath: 646 | XboxOnePackagingOverridePath: 647 | XboxOneAppManifestOverridePath: 648 | XboxOneVersion: 1.0.0.0 649 | XboxOnePackageEncryption: 0 650 | XboxOnePackageUpdateGranularity: 2 651 | XboxOneDescription: 652 | XboxOneLanguage: 653 | - enus 654 | XboxOneCapability: [] 655 | XboxOneGameRating: {} 656 | XboxOneIsContentPackage: 0 657 | XboxOneEnhancedXboxCompatibilityMode: 0 658 | XboxOneEnableGPUVariability: 1 659 | XboxOneSockets: {} 660 | XboxOneSplashScreen: {fileID: 0} 661 | XboxOneAllowedProductIds: [] 662 | XboxOnePersistentLocalStorageSize: 0 663 | XboxOneXTitleMemory: 8 664 | XboxOneOverrideIdentityName: 665 | XboxOneOverrideIdentityPublisher: 666 | vrEditorSettings: {} 667 | cloudServicesEnabled: 668 | UNet: 1 669 | luminIcon: 670 | m_Name: 671 | m_ModelFolderPath: 672 | m_PortalFolderPath: 673 | luminCert: 674 | m_CertPath: 675 | m_SignPackage: 1 676 | luminIsChannelApp: 0 677 | luminVersion: 678 | m_VersionCode: 1 679 | m_VersionName: 680 | apiCompatibilityLevel: 6 681 | activeInputHandler: 0 682 | cloudProjectId: 683 | framebufferDepthMemorylessMode: 0 684 | qualitySettingsNames: [] 685 | projectName: 686 | organizationId: 687 | cloudEnabled: 0 688 | legacyClampBlendShapeWeights: 0 689 | virtualTexturingSupportEnabled: 0 690 | -------------------------------------------------------------------------------- /ProjectSettings/ProjectVersion.txt: -------------------------------------------------------------------------------- 1 | m_EditorVersion: 2020.3.0f1 2 | m_EditorVersionWithRevision: 2020.3.0f1 (c7b5465681fb) 3 | -------------------------------------------------------------------------------- /ProjectSettings/QualitySettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!47 &1 4 | QualitySettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 5 7 | m_CurrentQuality: 2 8 | m_QualitySettings: 9 | - serializedVersion: 2 10 | name: Low 11 | pixelLightCount: 0 12 | shadows: 0 13 | shadowResolution: 0 14 | shadowProjection: 1 15 | shadowCascades: 1 16 | shadowDistance: 20 17 | shadowNearPlaneOffset: 3 18 | shadowCascade2Split: 0.33333334 19 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 20 | shadowmaskMode: 0 21 | skinWeights: 2 22 | textureQuality: 0 23 | anisotropicTextures: 0 24 | antiAliasing: 0 25 | softParticles: 0 26 | softVegetation: 0 27 | realtimeReflectionProbes: 0 28 | billboardsFaceCameraPosition: 0 29 | vSyncCount: 0 30 | lodBias: 0.4 31 | maximumLODLevel: 0 32 | streamingMipmapsActive: 0 33 | streamingMipmapsAddAllCameras: 1 34 | streamingMipmapsMemoryBudget: 512 35 | streamingMipmapsRenderersPerFrame: 512 36 | streamingMipmapsMaxLevelReduction: 2 37 | streamingMipmapsMaxFileIORequests: 1024 38 | particleRaycastBudget: 16 39 | asyncUploadTimeSlice: 2 40 | asyncUploadBufferSize: 16 41 | asyncUploadPersistentBuffer: 1 42 | resolutionScalingFixedDPIFactor: 1 43 | customRenderPipeline: {fileID: 11400000, guid: a31e9f9f9c9d4b9429ed0d1234e22103, type: 2} 44 | excludedTargetPlatforms: [] 45 | - serializedVersion: 2 46 | name: Medium 47 | pixelLightCount: 1 48 | shadows: 1 49 | shadowResolution: 0 50 | shadowProjection: 1 51 | shadowCascades: 1 52 | shadowDistance: 20 53 | shadowNearPlaneOffset: 3 54 | shadowCascade2Split: 0.33333334 55 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 56 | shadowmaskMode: 0 57 | skinWeights: 2 58 | textureQuality: 0 59 | anisotropicTextures: 1 60 | antiAliasing: 0 61 | softParticles: 0 62 | softVegetation: 0 63 | realtimeReflectionProbes: 0 64 | billboardsFaceCameraPosition: 0 65 | vSyncCount: 1 66 | lodBias: 0.7 67 | maximumLODLevel: 0 68 | streamingMipmapsActive: 0 69 | streamingMipmapsAddAllCameras: 1 70 | streamingMipmapsMemoryBudget: 512 71 | streamingMipmapsRenderersPerFrame: 512 72 | streamingMipmapsMaxLevelReduction: 2 73 | streamingMipmapsMaxFileIORequests: 1024 74 | particleRaycastBudget: 64 75 | asyncUploadTimeSlice: 2 76 | asyncUploadBufferSize: 16 77 | asyncUploadPersistentBuffer: 1 78 | resolutionScalingFixedDPIFactor: 1 79 | customRenderPipeline: {fileID: 11400000, guid: d847b876476d3d6468f5dfcd34266f96, type: 2} 80 | excludedTargetPlatforms: [] 81 | - serializedVersion: 2 82 | name: High 83 | pixelLightCount: 2 84 | shadows: 2 85 | shadowResolution: 1 86 | shadowProjection: 1 87 | shadowCascades: 2 88 | shadowDistance: 40 89 | shadowNearPlaneOffset: 3 90 | shadowCascade2Split: 0.33333334 91 | shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} 92 | shadowmaskMode: 1 93 | skinWeights: 2 94 | textureQuality: 0 95 | anisotropicTextures: 1 96 | antiAliasing: 0 97 | softParticles: 0 98 | softVegetation: 1 99 | realtimeReflectionProbes: 1 100 | billboardsFaceCameraPosition: 1 101 | vSyncCount: 1 102 | lodBias: 1 103 | maximumLODLevel: 0 104 | streamingMipmapsActive: 0 105 | streamingMipmapsAddAllCameras: 1 106 | streamingMipmapsMemoryBudget: 512 107 | streamingMipmapsRenderersPerFrame: 512 108 | streamingMipmapsMaxLevelReduction: 2 109 | streamingMipmapsMaxFileIORequests: 1024 110 | particleRaycastBudget: 256 111 | asyncUploadTimeSlice: 2 112 | asyncUploadBufferSize: 16 113 | asyncUploadPersistentBuffer: 1 114 | resolutionScalingFixedDPIFactor: 1 115 | customRenderPipeline: {fileID: 11400000, guid: 19ba41d7c0026c3459d37c2fe90c55a0, type: 2} 116 | excludedTargetPlatforms: [] 117 | m_PerPlatformDefaultQuality: 118 | Android: 1 119 | Lumin: 2 120 | Nintendo Switch: 2 121 | PS4: 2 122 | Stadia: 2 123 | Standalone: 2 124 | WebGL: 1 125 | Windows Store Apps: 2 126 | XboxOne: 2 127 | iPhone: 1 128 | tvOS: 1 129 | -------------------------------------------------------------------------------- /ProjectSettings/TagManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!78 &1 4 | TagManager: 5 | serializedVersion: 2 6 | tags: [] 7 | layers: 8 | - Default 9 | - TransparentFX 10 | - Ignore Raycast 11 | - 12 | - Water 13 | - UI 14 | - 15 | - 16 | - 17 | - 18 | - 19 | - 20 | - 21 | - 22 | - 23 | - 24 | - 25 | - 26 | - 27 | - 28 | - 29 | - 30 | - 31 | - 32 | - 33 | - 34 | - 35 | - 36 | - 37 | - 38 | - 39 | - 40 | m_SortingLayers: 41 | - name: Default 42 | uniqueID: 0 43 | locked: 0 44 | -------------------------------------------------------------------------------- /ProjectSettings/TimeManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!5 &1 4 | TimeManager: 5 | m_ObjectHideFlags: 0 6 | Fixed Timestep: 0.02 7 | Maximum Allowed Timestep: 0.1 8 | m_TimeScale: 1 9 | Maximum Particle Timestep: 0.03 10 | -------------------------------------------------------------------------------- /ProjectSettings/URPProjectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!114 &1 4 | MonoBehaviour: 5 | m_ObjectHideFlags: 61 6 | m_CorrespondingSourceObject: {fileID: 0} 7 | m_PrefabInstance: {fileID: 0} 8 | m_PrefabAsset: {fileID: 0} 9 | m_GameObject: {fileID: 0} 10 | m_Enabled: 1 11 | m_EditorHideFlags: 0 12 | m_Script: {fileID: 11500000, guid: 247994e1f5a72c2419c26a37e9334c01, type: 3} 13 | m_Name: 14 | m_EditorClassIdentifier: 15 | m_LastMaterialVersion: 4 16 | -------------------------------------------------------------------------------- /ProjectSettings/UnityConnectSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!310 &1 4 | UnityConnectSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 1 7 | m_Enabled: 0 8 | m_TestMode: 0 9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events 10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events 11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com 12 | m_TestInitMode: 0 13 | CrashReportingSettings: 14 | m_EventUrl: https://perf-events.cloud.unity3d.com 15 | m_Enabled: 0 16 | m_LogBufferSize: 10 17 | m_CaptureEditorExceptions: 1 18 | UnityPurchasingSettings: 19 | m_Enabled: 0 20 | m_TestMode: 0 21 | UnityAnalyticsSettings: 22 | m_Enabled: 0 23 | m_TestMode: 0 24 | m_InitializeOnStartup: 1 25 | UnityAdsSettings: 26 | m_Enabled: 0 27 | m_InitializeOnStartup: 1 28 | m_TestMode: 0 29 | m_IosGameId: 30 | m_AndroidGameId: 31 | m_GameIds: {} 32 | m_GameId: 33 | PerformanceReportingSettings: 34 | m_Enabled: 0 35 | -------------------------------------------------------------------------------- /ProjectSettings/VFXManager.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!937362698 &1 4 | VFXManager: 5 | m_ObjectHideFlags: 0 6 | m_IndirectShader: {fileID: 0} 7 | m_CopyBufferShader: {fileID: 0} 8 | m_SortShader: {fileID: 0} 9 | m_RenderPipeSettingsPath: 10 | m_FixedTimeStep: 0.016666668 11 | m_MaxDeltaTime: 0.05 12 | -------------------------------------------------------------------------------- /ProjectSettings/VersionControlSettings.asset: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!890905787 &1 4 | VersionControlSettings: 5 | m_ObjectHideFlags: 0 6 | m_Mode: Visible Meta Files 7 | m_CollabEditorSettings: 8 | inProgressEnabled: 1 9 | -------------------------------------------------------------------------------- /ProjectSettings/XRSettings.asset: -------------------------------------------------------------------------------- 1 | { 2 | "m_SettingKeys": [ 3 | "VR Device Disabled", 4 | "VR Device User Alert" 5 | ], 6 | "m_SettingValues": [ 7 | "False", 8 | "False" 9 | ] 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # LineRenderer2D 2 | Scripts for rendering pixel-perfect GPU-calculated lines in 2D (Unity URP 2D Renderer). 3 | It allows: 4 | -Single line or multiline (different script). 5 | -Dotted line. 6 | -Usage of any material, lines can be affected by 2D lights. 7 | -The single line allows the usage of different colors for both endpoints. 8 | -Any thickness. 9 | -Local or world space points. 10 | -You can use either shadergraph version or standard shaders version. 11 | -Tested with DirectX and OpenGLCore. 12 | --------------------------------------------------------------------------------