Fullscreen Map View

New MapView class which shows a fullscreen map
This commit is contained in:
Reinier Vens 2020-12-02 21:12:25 +00:00
commit 88ae36d137
14 changed files with 361 additions and 26 deletions

View file

@ -54,7 +54,6 @@
<e p="ActionGameManager.cs" t="Include" />
<e p="AetheriaInput.cs" t="Include" />
<e p="CameraPerlinOrbit.cs" t="Include" />
<e p="CopyTransform.cs" t="Include" />
<e p="CultClient.cs" t="Include" />
<e p="Editor" t="Include">
<e p="DatabaseInspector.cs" t="Include" />
@ -1248,10 +1247,12 @@
<e p="RethinkConnection.cs" t="Include" />
<e p="Sector Display" t="Include">
<e p="BlueNoiseProvider.cs" t="Include" />
<e p="CopyTransform.cs" t="Include" />
<e p="GameSettings.cs" t="Include" />
<e p="GasGiantObject.cs" t="Include" />
<e p="GradientMapper.cs" t="Include" />
<e p="GravityObject.cs" t="Include" />
<e p="MapView.cs" t="Include" />
<e p="PlanetObject.cs" t="Include" />
<e p="SectorRenderer.cs" t="Include" />
<e p="SnapToGrid.cs" t="Include" />

View file

@ -148,7 +148,7 @@
<Compile Include="Assets\Scripts\NIH\NaughtyAttributes\Scripts\Core\DrawerAttributes\MinMaxSliderAttribute.cs" />
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\DebugEllipse.cs" />
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\LgPathRouter.cs" />
<Compile Include="Assets\Scripts\CopyTransform.cs" />
<Compile Include="Assets\Scripts\Sector Display\CopyTransform.cs" />
<Compile Include="Assets\Scripts\NIH\MSAGL\Layout\LargeGraphLayout\SimpleNodeCollection.cs" />
<Compile Include="Assets\Scripts\NIH\MSAGL\DebugHelpers\CurveSerializer.cs" />
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\ConeSpanner\ConeSideComparer.cs" />
@ -674,6 +674,7 @@
<Compile Include="Assets\Scripts\NIH\MSAGL\Routing\Spline\Bundling\PointPairOrder.cs" />
<Compile Include="Assets\Scripts\AetheriaInput.cs" />
<Compile Include="Assets\Scripts\UI\MinimapCameraTrack.cs" />
<Compile Include="Assets\Scripts\Sector Display\MapView.cs" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMPro.cginc" />
<None Include="Assets\TextMesh Pro\Resources\Shaders\TMP_SDF-Mobile Overlay.shader" />
<None Include="Assets\Shaders\Clouds.shader" />

View file

@ -56,21 +56,21 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AngleFade: 20
- _AngleWidth: 0.05
- _AngleFade: 3
- _AngleWidth: 100
- _BumpScale: 1
- _ClipDistance: 1000
- _Cutoff: 0.5
- _DangerSteepness: 5
- _DepthRange: 100
- _DepthRange: 268.43512
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _HeightRange: 50
- _LineFade: 20
- _LineWidth: 0.05
- _LineFade: 3
- _LineWidth: 100
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
@ -78,12 +78,12 @@ Material:
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StartDepth: 0
- _StartDepth: 423.49216
- _StartHeight: 0
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _AngleColor: {r: 0, g: 0.058300022, b: 0.106000006, a: 1}
- _AngleColor: {r: 0.103773594, g: 0, b: 0.088093735, a: 1}
- _Color: {r: 0, g: 0.4, b: 0.6, a: 1}
- _DangerColor: {r: 2.9803922, g: 0.2509804, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View file

@ -1,5 +1,5 @@
{
"name": "Aetheria-Economy",
"name": "Aetheria",
"maps": [
{
"name": "Player",
@ -333,6 +333,14 @@
"expectedControlType": "Quaternion",
"processors": "",
"interactions": ""
},
{
"name": "Drag",
"type": "Value",
"id": "0c96ec22-9571-46c8-94bf-199e70e919ed",
"expectedControlType": "Vector2",
"processors": "",
"interactions": ""
}
],
"bindings": [
@ -753,6 +761,44 @@
"action": "TrackedDeviceOrientation",
"isComposite": false,
"isPartOfComposite": false
},
{
"name": "",
"id": "618fb60f-5dc7-47ec-8dbf-fdc3d4c515a1",
"path": "<Mouse>/delta",
"interactions": "",
"processors": "ScaleVector2(x=1.25,y=1.25)",
"groups": "",
"action": "Drag",
"isComposite": false,
"isPartOfComposite": false
}
]
},
{
"name": "Global",
"id": "2e2023b8-ce3b-4cb3-a12a-ff4ac610f11b",
"actions": [
{
"name": "Map Toggle",
"type": "Button",
"id": "e43f020b-dec0-43d2-a83b-1390d45819be",
"expectedControlType": "Button",
"processors": "",
"interactions": ""
}
],
"bindings": [
{
"name": "",
"id": "7eadec25-7b3f-4d69-92b7-c756f5f9b0dd",
"path": "<Keyboard>/m",
"interactions": "",
"processors": "",
"groups": "Keyboard&Mouse",
"action": "Map Toggle",
"isComposite": false,
"isPartOfComposite": false
}
]
}

View file

@ -13,8 +13,8 @@ RenderTexture:
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 512
m_Height: 512
m_Width: 256
m_Height: 256
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 2

View file

@ -4679,6 +4679,42 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 828461d20e2142546814879a0a0f44b6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &346000246
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 346000247}
m_Layer: 5
m_Name: Gameplay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &346000247
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 346000246}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 488443579}
m_Father: {fileID: 761574181}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &355950000
PrefabInstance:
m_ObjectHideFlags: 0
@ -5595,7 +5631,7 @@ PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 761574181}
m_TransformParent: {fileID: 346000247}
m_Modifications:
- target: {fileID: 2352149239973948581, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
@ -5625,17 +5661,17 @@ PrefabInstance:
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
@ -5645,7 +5681,7 @@ PrefabInstance:
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
propertyPath: m_RootOrder
value: 4
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
@ -5665,12 +5701,12 @@ PrefabInstance:
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 10
value: -900
objectReference: {fileID: 0}
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 10
value: -480.1105
objectReference: {fileID: 0}
- target: {fileID: 2352149240678857104, guid: f032e3ceed591844e80327e865f2c582,
type: 3}
@ -5752,7 +5788,7 @@ GameObject:
- component: {fileID: 488792362}
- component: {fileID: 488792363}
m_Layer: 0
m_Name: GravityCamera
m_Name: Map Gravity
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@ -9637,7 +9673,7 @@ RectTransform:
- {fileID: 53415401}
- {fileID: 721750121}
- {fileID: 1723136546}
- {fileID: 488443579}
- {fileID: 346000247}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -11874,6 +11910,7 @@ GameObject:
- component: {fileID: 1009503731}
- component: {fileID: 1009503732}
- component: {fileID: 1009503733}
- component: {fileID: 1009503734}
m_Layer: 0
m_Name: GameManager
m_TagString: Untagged
@ -11912,8 +11949,10 @@ MonoBehaviour:
m_EditorClassIdentifier:
Settings: {fileID: 11400000, guid: cd2344e2001a37544aab0960c164d4ff, type: 2}
SectorRenderer: {fileID: 1009503731}
MapView: {fileID: 1009503734}
TopDownCamera: {fileID: 887677622}
FollowCamera: {fileID: 887677622}
GameplayUI: {fileID: 346000246}
--- !u!4 &1009503730
Transform:
m_ObjectHideFlags: 0
@ -12127,6 +12166,23 @@ MonoBehaviour:
m_DefaultActionMap: Player
m_SplitScreenIndex: -1
m_Camera: {fileID: 2115559089}
--- !u!114 &1009503734
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1009503727}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76d9e45f376fcfe409f3a4f26ccb4f3e, type: 3}
m_Name:
m_EditorClassIdentifier:
Main: {fileID: 2115559089}
MinimapGravity: {fileID: 488792362}
Minimap: {fileID: 970624071}
GravityRenderer: {fileID: 509767789}
ZoomSpeed: 0.001
--- !u!1 &1015214589
GameObject:
m_ObjectHideFlags: 0
@ -13723,7 +13779,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &1273980439
RectTransform:
m_ObjectHideFlags: 0

View file

@ -15,8 +15,10 @@ public class ActionGameManager : MonoBehaviour
{
public GameSettings Settings;
public SectorRenderer SectorRenderer;
public MapView MapView;
public CinemachineVirtualCamera TopDownCamera;
public CinemachineVirtualCamera FollowCamera;
public GameObject GameplayUI;
//public PlayerInput Input;
private DirectoryInfo _filePath;
@ -55,6 +57,8 @@ public class ActionGameManager : MonoBehaviour
_input = new AetheriaInput();
_input.Player.Enable();
_input.Global.Enable();
_input.UI.Enable();
_zoomLevelIndex = Settings.DefaultMinimapZoom;
_input.Player.MinimapZoom.performed += context =>
@ -63,6 +67,22 @@ public class ActionGameManager : MonoBehaviour
SectorRenderer.MinimapDistance = Settings.MinimapZoomLevels[_zoomLevelIndex];
};
_input.Global.MapToggle.performed += context =>
{
MapView.enabled = !MapView.enabled;
GameplayUI.SetActive(!MapView.enabled);
if (MapView.enabled)
{
MapView.BindInput(_input.UI);
_input.Player.Disable();
}
else
{
_input.Player.Enable();
SectorRenderer.MinimapDistance = Settings.MinimapZoomLevels[_zoomLevelIndex];
}
};
ConsoleController.AddCommand("editmode", _ => ToggleEditMode());
ConsoleController.AddCommand("savezone", args =>
{

View file

@ -1,4 +1,4 @@
// GENERATED AUTOMATICALLY FROM 'Assets/Resources/Aetheria-Economy.inputactions'
// GENERATED AUTOMATICALLY FROM 'Assets/Resources/Aetheria.inputactions'
using System;
using System.Collections;
@ -12,7 +12,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
public @AetheriaInput()
{
asset = InputActionAsset.FromJson(@"{
""name"": ""Aetheria-Economy"",
""name"": ""Aetheria"",
""maps"": [
{
""name"": ""Player"",
@ -346,6 +346,14 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
""expectedControlType"": ""Quaternion"",
""processors"": """",
""interactions"": """"
},
{
""name"": ""Drag"",
""type"": ""Value"",
""id"": ""0c96ec22-9571-46c8-94bf-199e70e919ed"",
""expectedControlType"": ""Vector2"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
@ -766,6 +774,44 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
""action"": ""TrackedDeviceOrientation"",
""isComposite"": false,
""isPartOfComposite"": false
},
{
""name"": """",
""id"": ""618fb60f-5dc7-47ec-8dbf-fdc3d4c515a1"",
""path"": ""<Mouse>/delta"",
""interactions"": """",
""processors"": ""ScaleVector2(x=1.25,y=1.25)"",
""groups"": """",
""action"": ""Drag"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
},
{
""name"": ""Global"",
""id"": ""2e2023b8-ce3b-4cb3-a12a-ff4ac610f11b"",
""actions"": [
{
""name"": ""Map Toggle"",
""type"": ""Button"",
""id"": ""e43f020b-dec0-43d2-a83b-1390d45819be"",
""expectedControlType"": ""Button"",
""processors"": """",
""interactions"": """"
}
],
""bindings"": [
{
""name"": """",
""id"": ""7eadec25-7b3f-4d69-92b7-c756f5f9b0dd"",
""path"": ""<Keyboard>/m"",
""interactions"": """",
""processors"": """",
""groups"": ""Keyboard&Mouse"",
""action"": ""Map Toggle"",
""isComposite"": false,
""isPartOfComposite"": false
}
]
}
@ -851,6 +897,10 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
m_UI_RightClick = m_UI.FindAction("RightClick", throwIfNotFound: true);
m_UI_TrackedDevicePosition = m_UI.FindAction("TrackedDevicePosition", throwIfNotFound: true);
m_UI_TrackedDeviceOrientation = m_UI.FindAction("TrackedDeviceOrientation", throwIfNotFound: true);
m_UI_Drag = m_UI.FindAction("Drag", throwIfNotFound: true);
// Global
m_Global = asset.FindActionMap("Global", throwIfNotFound: true);
m_Global_MapToggle = m_Global.FindAction("Map Toggle", throwIfNotFound: true);
}
public void Dispose()
@ -967,6 +1017,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
private readonly InputAction m_UI_RightClick;
private readonly InputAction m_UI_TrackedDevicePosition;
private readonly InputAction m_UI_TrackedDeviceOrientation;
private readonly InputAction m_UI_Drag;
public struct UIActions
{
private @AetheriaInput m_Wrapper;
@ -981,6 +1032,7 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
public InputAction @RightClick => m_Wrapper.m_UI_RightClick;
public InputAction @TrackedDevicePosition => m_Wrapper.m_UI_TrackedDevicePosition;
public InputAction @TrackedDeviceOrientation => m_Wrapper.m_UI_TrackedDeviceOrientation;
public InputAction @Drag => m_Wrapper.m_UI_Drag;
public InputActionMap Get() { return m_Wrapper.m_UI; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
@ -1020,6 +1072,9 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
@TrackedDeviceOrientation.started -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDeviceOrientation;
@TrackedDeviceOrientation.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDeviceOrientation;
@TrackedDeviceOrientation.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnTrackedDeviceOrientation;
@Drag.started -= m_Wrapper.m_UIActionsCallbackInterface.OnDrag;
@Drag.performed -= m_Wrapper.m_UIActionsCallbackInterface.OnDrag;
@Drag.canceled -= m_Wrapper.m_UIActionsCallbackInterface.OnDrag;
}
m_Wrapper.m_UIActionsCallbackInterface = instance;
if (instance != null)
@ -1054,10 +1109,46 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
@TrackedDeviceOrientation.started += instance.OnTrackedDeviceOrientation;
@TrackedDeviceOrientation.performed += instance.OnTrackedDeviceOrientation;
@TrackedDeviceOrientation.canceled += instance.OnTrackedDeviceOrientation;
@Drag.started += instance.OnDrag;
@Drag.performed += instance.OnDrag;
@Drag.canceled += instance.OnDrag;
}
}
}
public UIActions @UI => new UIActions(this);
// Global
private readonly InputActionMap m_Global;
private IGlobalActions m_GlobalActionsCallbackInterface;
private readonly InputAction m_Global_MapToggle;
public struct GlobalActions
{
private @AetheriaInput m_Wrapper;
public GlobalActions(@AetheriaInput wrapper) { m_Wrapper = wrapper; }
public InputAction @MapToggle => m_Wrapper.m_Global_MapToggle;
public InputActionMap Get() { return m_Wrapper.m_Global; }
public void Enable() { Get().Enable(); }
public void Disable() { Get().Disable(); }
public bool enabled => Get().enabled;
public static implicit operator InputActionMap(GlobalActions set) { return set.Get(); }
public void SetCallbacks(IGlobalActions instance)
{
if (m_Wrapper.m_GlobalActionsCallbackInterface != null)
{
@MapToggle.started -= m_Wrapper.m_GlobalActionsCallbackInterface.OnMapToggle;
@MapToggle.performed -= m_Wrapper.m_GlobalActionsCallbackInterface.OnMapToggle;
@MapToggle.canceled -= m_Wrapper.m_GlobalActionsCallbackInterface.OnMapToggle;
}
m_Wrapper.m_GlobalActionsCallbackInterface = instance;
if (instance != null)
{
@MapToggle.started += instance.OnMapToggle;
@MapToggle.performed += instance.OnMapToggle;
@MapToggle.canceled += instance.OnMapToggle;
}
}
}
public GlobalActions @Global => new GlobalActions(this);
private int m_KeyboardMouseSchemeIndex = -1;
public InputControlScheme KeyboardMouseScheme
{
@ -1122,5 +1213,10 @@ public class @AetheriaInput : IInputActionCollection, IDisposable
void OnRightClick(InputAction.CallbackContext context);
void OnTrackedDevicePosition(InputAction.CallbackContext context);
void OnTrackedDeviceOrientation(InputAction.CallbackContext context);
void OnDrag(InputAction.CallbackContext context);
}
public interface IGlobalActions
{
void OnMapToggle(InputAction.CallbackContext context);
}
}

View file

@ -0,0 +1,104 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class MapView : MonoBehaviour
{
public Camera Main;
public Camera MinimapGravity;
public Camera Minimap;
public MeshRenderer GravityRenderer;
public float ZoomSpeed;
private Transform _minimapTransform;
private CopyTransform _minimapCopyTransform;
private RenderTexture _minimapTexture;
private Transform _minimapGravityTransform;
private CopyTransform _minimapGravityCopyTransform;
private RenderTexture _minimapGravityTexture;
private Transform _gravityRendererTransform;
private CopyTransform _gravityRendererCopyTransform;
private RenderTexture _fullscreenGravityTexture;
private AetheriaInput.UIActions _input;
private float _viewDistance = 1024;
private float _aspectRatio;
private Vector3 _previousGravityRendererScale;
void OnEnable()
{
_aspectRatio = (float) Screen.width / Screen.height;
Main.gameObject.SetActive(false);
_minimapTexture = Minimap.targetTexture;
_minimapTransform = Minimap.transform;
_minimapCopyTransform = Minimap.GetComponent<CopyTransform>();
_minimapCopyTransform.enabled = false;
_minimapGravityTexture = MinimapGravity.targetTexture;
_minimapGravityTransform = MinimapGravity.transform;
_minimapGravityCopyTransform = MinimapGravity.GetComponent<CopyTransform>();
_minimapGravityCopyTransform.enabled = false;
_gravityRendererTransform = GravityRenderer.transform;
_gravityRendererCopyTransform = GravityRenderer.GetComponent<CopyTransform>();
_gravityRendererCopyTransform.enabled = false;
_previousGravityRendererScale = _gravityRendererTransform.localScale;
_fullscreenGravityTexture = new RenderTexture(Screen.width / 2, Screen.height / 2, 1, RenderTextureFormat.RFloat);
GravityRenderer.material.mainTexture = _fullscreenGravityTexture;
MinimapGravity.targetTexture = _fullscreenGravityTexture;
Minimap.targetTexture = null;
SetZoom();
}
void SetZoom()
{
Minimap.orthographicSize = MinimapGravity.orthographicSize = _viewDistance;
_gravityRendererTransform.localScale = new Vector3(_viewDistance*_aspectRatio*2, _viewDistance*2, 1);
}
public void BindInput(AetheriaInput.UIActions input)
{
_input = input;
_input.ScrollWheel.performed += OnScroll;
}
private void OnScroll(InputAction.CallbackContext context)
{
_viewDistance *= (1 - context.ReadValue<Vector2>().y * ZoomSpeed);
SetZoom();
}
void Update()
{
if (_input.Click.ReadValue<float>() > .5f)
{
var delta = _input.Drag.ReadValue<Vector2>();
var pos = _minimapTransform.position;
pos.x -= delta.x * _viewDistance / Screen.height;
pos.z -= delta.y * _viewDistance / Screen.height;
var gravPos = _gravityRendererTransform.position;
gravPos.x = pos.x;
gravPos.z = pos.z;
_gravityRendererTransform.position = gravPos;
_minimapTransform.position = _minimapGravityTransform.position = pos;
}
}
private void OnDisable()
{
_input.ScrollWheel.performed -= OnScroll;
Main.gameObject.SetActive(true);
_minimapGravityCopyTransform.enabled = true;
_minimapCopyTransform.enabled = true;
_gravityRendererCopyTransform.enabled = true;
Minimap.targetTexture = _minimapTexture;
MinimapGravity.targetTexture = _minimapGravityTexture;
GravityRenderer.material.mainTexture = _minimapGravityTexture;
_fullscreenGravityTexture.Release();
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 76d9e45f376fcfe409f3a4f26ccb4f3e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -97,7 +97,7 @@
float isoline = abs(h + _StartDepth + (ih*spacing));
//float2 isograd = float2(ddx(isoline), ddy(isoline));
//float isomag = length(isograd);
col += (1-smoothstep(_LineWidth, _LineWidth * _LineFade, isoline / planmag)) * lerp(_Color,_DangerColor,dangerblend) * blend; // Isoline
col += (1-smoothstep(_LineWidth, _LineWidth * _LineFade, isoline / planmag * _ScreenParams.y)) * lerp(_Color,_DangerColor,dangerblend) * blend; // Isoline
}
float angle = atan2(plan.y,plan.x) / 3.1415926536 + 1;
@ -115,7 +115,7 @@
float isoline = abs(angle - ia / 6.0);// ;
//float2 isograd = float2(ddx_fine(isoline), ddy_fine(isoline));
//float isomag = min(length(isograd),0.025); // isomag is huge over atan2 boundary so clamp it to avoid false positives
col += (1-smoothstep(_AngleWidth, _AngleWidth * _AngleFade, isoline / (angmag))) * lerp(_AngleColor,_DangerColor,dangerblend) * blend; // Isoline
col += (1-smoothstep(_AngleWidth, _AngleWidth * _AngleFade, isoline / angmag * _ScreenParams.y)) * lerp(_AngleColor,_DangerColor,dangerblend) * blend; // Isoline
}
//return float4(1,0,0,1);