fixed gap between grid and skybox

This commit is contained in:
4sval
2022-10-22 00:17:56 +02:00
parent b32d77601e
commit 023b68ffae
4 changed files with 54 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ public partial class MainWindow
#if DEBUG
await _threadWorkerView.Begin(cancellationToken =>
_applicationView.CUE4Parse.Extract(cancellationToken,
"FortniteGame/Content/Environments/Apollo/Props/Log_Sign/Meshes/SM_Apollo_Log_Sign.uasset"));
"fortnitegame/Content/Accessories/FORT_Backpacks/Backpack_F_MED_FNCS_S20/Meshes/F_MED_FNCS_S20_Pack.uasset"));
#endif
}

View File

@@ -131,12 +131,19 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
if (hasFilter)
{
if (filter.Contains(entry.Vfs.Name))
{
entries.Add(entry);
_applicationView.Status.UpdateStatusLabel(entry.Vfs.Name);
}
}
else
{
entries.Add(entry);
_applicationView.Status.UpdateStatusLabel(entry.Vfs.Name);
}
}
_applicationView.Status.UpdateStatusLabel("Folders & Packages");
_applicationView.CUE4Parse.AssetsFolder.BulkPopulate(entries);
}
@@ -170,7 +177,8 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
using var archive = new FStreamArchive(fileStream.Name, memoryStream);
var entries = new List<VfsEntry>();
switch (UserSettings.Default.LoadingMode)
var mode = UserSettings.Default.LoadingMode;
switch (mode)
{
case ELoadingMode.AllButNew:
{
@@ -191,6 +199,7 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
entry.Path.EndsWith(".ubulk") || entry.Path.EndsWith(".uptnl")) continue;
entries.Add(entry);
_applicationView.Status.UpdateStatusLabel(entry.Vfs.Name);
}
break;
@@ -214,12 +223,14 @@ public class LoadCommand : ViewModelCommand<LoadingModesViewModel>
continue;
entries.Add(entry);
_applicationView.Status.UpdateStatusLabel(entry.Vfs.Name);
}
break;
}
}
_applicationView.Status.UpdateStatusLabel($"{mode.ToString()[6..]} Folders & Packages");
_applicationView.CUE4Parse.AssetsFolder.BulkPopulate(entries);
}
}

View File

@@ -61,6 +61,46 @@ public class Camera
public Matrix4 GetProjectionMatrix()
{
return Matrix4.CreatePerspectiveFieldOfView(Helper.DegreesToRadians(Zoom), AspectRatio, Near, Far);
return CreatePerspectiveFieldOfView(Helper.DegreesToRadians(Zoom), AspectRatio, Near, Far);
}
/// <summary>
/// OpenTK function causes a gap between the faded out grid & the skybox
/// so we use the System.Numerics function instead with OpenTK types
/// </summary>
private Matrix4 CreatePerspectiveFieldOfView(float fieldOfView, float aspectRatio, float nearPlaneDistance, float farPlaneDistance)
{
if (fieldOfView is <= 0.0f or >= MathF.PI)
throw new ArgumentOutOfRangeException(nameof(fieldOfView));
if (nearPlaneDistance <= 0.0f)
throw new ArgumentOutOfRangeException(nameof(nearPlaneDistance));
if (farPlaneDistance <= 0.0f)
throw new ArgumentOutOfRangeException(nameof(farPlaneDistance));
if (nearPlaneDistance >= farPlaneDistance)
throw new ArgumentOutOfRangeException(nameof(nearPlaneDistance));
float yScale = 1.0f / MathF.Tan(fieldOfView * 0.5f);
float xScale = yScale / aspectRatio;
Matrix4 result = Matrix4.Zero;
result.M11 = xScale;
result.M12 = result.M13 = result.M14 = 0.0f;
result.M22 = yScale;
result.M21 = result.M23 = result.M24 = 0.0f;
result.M31 = result.M32 = 0.0f;
float negFarRange = float.IsPositiveInfinity(farPlaneDistance) ? -1.0f : farPlaneDistance / (nearPlaneDistance - farPlaneDistance);
result.M33 = negFarRange;
result.M34 = -1.0f;
result.M41 = result.M42 = result.M44 = 0.0f;
result.M43 = nearPlaneDistance * negFarRange;
return result;
}
}

View File

@@ -7,7 +7,6 @@ using FModel.Services;
using FModel.Settings;
using OpenTK.Graphics.OpenGL4;
using OpenTK.Mathematics;
using SkiaSharp;
namespace FModel.Views.Snooper;