Skip to content

Commit

Permalink
fixed gap between grid and skybox
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Oct 21, 2022
1 parent b32d776 commit 023b68f
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FModel/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private async void OnLoaded(object sender, RoutedEventArgs e)
#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
}

Expand Down
13 changes: 12 additions & 1 deletion FModel/ViewModels/Commands/LoadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,19 @@ private void FilterDirectoryFilesToDisplay(CancellationToken cancellationToken,
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);
}

Expand Down Expand Up @@ -170,7 +177,8 @@ private void FilterNewOrModifiedFilesToDisplay(CancellationToken cancellationTok
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:
{
Expand All @@ -191,6 +199,7 @@ private void FilterNewOrModifiedFilesToDisplay(CancellationToken cancellationTok
entry.Path.EndsWith(".ubulk") || entry.Path.EndsWith(".uptnl")) continue;

entries.Add(entry);
_applicationView.Status.UpdateStatusLabel(entry.Vfs.Name);
}

break;
Expand All @@ -214,12 +223,14 @@ private void FilterNewOrModifiedFilesToDisplay(CancellationToken cancellationTok
continue;

entries.Add(entry);
_applicationView.Status.UpdateStatusLabel(entry.Vfs.Name);
}

break;
}
}

_applicationView.Status.UpdateStatusLabel($"{mode.ToString()[6..]} Folders & Packages");
_applicationView.CUE4Parse.AssetsFolder.BulkPopulate(entries);
}
}
42 changes: 41 additions & 1 deletion FModel/Views/Snooper/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,46 @@ public Matrix4 GetViewMatrix()

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;
}
}
1 change: 0 additions & 1 deletion FModel/Views/Snooper/Section.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using FModel.Settings;
using OpenTK.Graphics.OpenGL4;
using OpenTK.Mathematics;
using SkiaSharp;

namespace FModel.Views.Snooper;

Expand Down

0 comments on commit 023b68f

Please sign in to comment.