mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
This commit is contained in:
parent
f266cd4c34
commit
c6c8cf201e
|
|
@ -1 +1 @@
|
||||||
Subproject commit 783899787bf421b3a3cc47b030348f89246fb07a
|
Subproject commit 455b72e5e38bfe9476b5823bc642fc8ef488347f
|
||||||
|
|
@ -34,7 +34,7 @@ public class BasePlaylist : UCreator
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var playlist = _apiEndpointView.FortniteApi.GetPlaylist(playlistName.Text);
|
var playlist = _apiEndpointView.FortniteApi.GetPlaylist(playlistName.Text);
|
||||||
if (!playlist.IsSuccess || !playlist.Data.Images.HasShowcase ||
|
if (!playlist.IsSuccess || playlist.Data.Images is not { HasShowcase: true } ||
|
||||||
!_apiEndpointView.FortniteApi.TryGetBytes(playlist.Data.Images.Showcase, out var image))
|
!_apiEndpointView.FortniteApi.TryGetBytes(playlist.Data.Images.Showcase, out var image))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<ApplicationIcon>FModel.ico</ApplicationIcon>
|
<ApplicationIcon>FModel.ico</ApplicationIcon>
|
||||||
<Version>4.4.3.6</Version>
|
<Version>4.4.4.0</Version>
|
||||||
<AssemblyVersion>4.4.3.6</AssemblyVersion>
|
<AssemblyVersion>4.4.4.0</AssemblyVersion>
|
||||||
<FileVersion>4.4.3.6</FileVersion>
|
<FileVersion>4.4.4.0</FileVersion>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<IsPublishable>true</IsPublishable>
|
<IsPublishable>true</IsPublishable>
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
|
||||||
|
|
@ -851,6 +851,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||||
"JunoBuildingPropAccountItemDefinition" => true,
|
"JunoBuildingPropAccountItemDefinition" => true,
|
||||||
_ => false
|
_ => false
|
||||||
}:
|
}:
|
||||||
|
case UPaperSprite when isNone && UserSettings.Default.PreviewMaterials:
|
||||||
case UStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
case UStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||||
case USkeletalMesh when isNone && UserSettings.Default.PreviewSkeletalMeshes:
|
case USkeletalMesh when isNone && UserSettings.Default.PreviewSkeletalMeshes:
|
||||||
case USkeleton when isNone && UserSettings.Default.SaveSkeletonAsMesh:
|
case USkeleton when isNone && UserSettings.Default.SaveSkeletonAsMesh:
|
||||||
|
|
|
||||||
|
|
@ -68,9 +68,13 @@ public class TabImage : ViewModel
|
||||||
Image = null;
|
Image = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_bmp = bitmap;
|
_bmp = bitmap;
|
||||||
using var data = _bmp.Encode(NoAlpha ? ETextureFormat.Jpeg : UserSettings.Default.TextureExportFormat, 100);
|
using var data = _bmp.Encode(NoAlpha ? ETextureFormat.Jpeg : UserSettings.Default.TextureExportFormat, 100);
|
||||||
using var stream = new MemoryStream(ImageBuffer = data.ToArray(), false);
|
using var stream = new MemoryStream(ImageBuffer = data.ToArray(), false);
|
||||||
|
if (UserSettings.Default.TextureExportFormat == ETextureFormat.Tga)
|
||||||
|
return;
|
||||||
|
|
||||||
var image = new BitmapImage();
|
var image = new BitmapImage();
|
||||||
image.BeginInit();
|
image.BeginInit();
|
||||||
image.CacheOption = BitmapCacheOption.OnLoad;
|
image.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
|
|
@ -305,6 +309,7 @@ public class TabItem : ViewModel
|
||||||
var ext = UserSettings.Default.TextureExportFormat switch
|
var ext = UserSettings.Default.TextureExportFormat switch
|
||||||
{
|
{
|
||||||
ETextureFormat.Png => ".png",
|
ETextureFormat.Png => ".png",
|
||||||
|
ETextureFormat.Jpeg => ".jpg",
|
||||||
ETextureFormat.Tga => ".tga",
|
ETextureFormat.Tga => ".tga",
|
||||||
_ => ".png"
|
_ => ".png"
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
using System.Numerics;
|
using System;
|
||||||
|
using System.Numerics;
|
||||||
using CUE4Parse_Conversion.Meshes.PSK;
|
using CUE4Parse_Conversion.Meshes.PSK;
|
||||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||||
|
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||||
|
using CUE4Parse.UE4.Objects.Core.Math;
|
||||||
using CUE4Parse.UE4.Objects.PhysicsEngine;
|
using CUE4Parse.UE4.Objects.PhysicsEngine;
|
||||||
using FModel.Views.Snooper.Shading;
|
using FModel.Views.Snooper.Shading;
|
||||||
using OpenTK.Graphics.OpenGL4;
|
using OpenTK.Graphics.OpenGL4;
|
||||||
|
|
@ -52,6 +55,59 @@ public class StaticModel : UModel
|
||||||
Box = staticMesh.BoundingBox * 1.5f * Constants.SCALE_DOWN_RATIO;
|
Box = staticMesh.BoundingBox * 1.5f * Constants.SCALE_DOWN_RATIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StaticModel(UPaperSprite paperSprite, UTexture2D texture) : base(paperSprite)
|
||||||
|
{
|
||||||
|
Indices = new uint[paperSprite.BakedRenderData.Length];
|
||||||
|
for (int i = 0; i < Indices.Length; i++)
|
||||||
|
{
|
||||||
|
Indices[i] = (uint) i;
|
||||||
|
}
|
||||||
|
|
||||||
|
Vertices = new float[paperSprite.BakedRenderData.Length * VertexSize];
|
||||||
|
for (int i = 0; i < paperSprite.BakedRenderData.Length; i++)
|
||||||
|
{
|
||||||
|
var count = 0;
|
||||||
|
var baseIndex = i * VertexSize;
|
||||||
|
var vert = paperSprite.BakedRenderData[i];
|
||||||
|
var u = vert.Z;
|
||||||
|
var v = vert.W;
|
||||||
|
|
||||||
|
Vertices[baseIndex + count++] = i;
|
||||||
|
Vertices[baseIndex + count++] = vert.X * paperSprite.PixelsPerUnrealUnit * Constants.SCALE_DOWN_RATIO;
|
||||||
|
Vertices[baseIndex + count++] = vert.Y * paperSprite.PixelsPerUnrealUnit * Constants.SCALE_DOWN_RATIO;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = 0;
|
||||||
|
Vertices[baseIndex + count++] = u;
|
||||||
|
Vertices[baseIndex + count++] = v;
|
||||||
|
Vertices[baseIndex + count++] = .5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
Materials = new Material[1];
|
||||||
|
if (paperSprite.DefaultMaterial?.TryLoad(out UMaterialInstance unrealMaterial) ?? false)
|
||||||
|
{
|
||||||
|
Materials[0] = new Material(unrealMaterial);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Materials[0] = new Material();
|
||||||
|
}
|
||||||
|
Materials[0].Parameters.Textures[CMaterialParams2.FallbackDiffuse] = texture;
|
||||||
|
Materials[0].IsUsed = true;
|
||||||
|
|
||||||
|
Sections = new Section[1];
|
||||||
|
Sections[0] = new Section(0, Indices.Length, 0);
|
||||||
|
|
||||||
|
AddInstance(Transform.Identity);
|
||||||
|
|
||||||
|
var backward = new FVector(0, Math.Max(paperSprite.BakedSourceDimension.X, paperSprite.BakedSourceDimension.Y) / 2, 0);
|
||||||
|
Box = new FBox(-backward, backward) * Constants.SCALE_DOWN_RATIO;
|
||||||
|
}
|
||||||
|
|
||||||
public StaticModel(UStaticMesh export, CStaticMesh staticMesh, Transform transform = null)
|
public StaticModel(UStaticMesh export, CStaticMesh staticMesh, Transform transform = null)
|
||||||
: base(export, staticMesh.LODs[LodLevel], export.Materials, staticMesh.LODs[LodLevel].Verts, staticMesh.LODs.Count, transform)
|
: base(export, staticMesh.LODs[LodLevel], export.Materials, staticMesh.LODs[LodLevel].Verts, staticMesh.LODs.Count, transform)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -103,6 +103,9 @@ public class Renderer : IDisposable
|
||||||
LoadJunoWorld(cancellationToken, bp, Transform.Identity);
|
LoadJunoWorld(cancellationToken, bp, Transform.Identity);
|
||||||
Color = VertexColor.Colors;
|
Color = VertexColor.Colors;
|
||||||
break;
|
break;
|
||||||
|
case UPaperSprite ps:
|
||||||
|
LoadPaperSprite(ps);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
CameraOp.Mode = _saveCameraMode ? UserSettings.Default.CameraMode : Camera.WorldMode.FlyCam;
|
CameraOp.Mode = _saveCameraMode ? UserSettings.Default.CameraMode : Camera.WorldMode.FlyCam;
|
||||||
SetupCamera();
|
SetupCamera();
|
||||||
|
|
@ -397,6 +400,23 @@ public class Renderer : IDisposable
|
||||||
Options.SelectModel(guid);
|
Options.SelectModel(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LoadPaperSprite(UPaperSprite original)
|
||||||
|
{
|
||||||
|
if (!(original.BakedSourceTexture?.TryLoad(out UTexture2D texture) ?? false))
|
||||||
|
return;
|
||||||
|
|
||||||
|
var guid = texture.LightingGuid;
|
||||||
|
if (Options.TryGetModel(guid, out var model))
|
||||||
|
{
|
||||||
|
model.AddInstance(Transform.Identity);
|
||||||
|
Application.Current.Dispatcher.Invoke(() => model.SetupInstances());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Options.Models[guid] = new StaticModel(original, texture);
|
||||||
|
Options.SelectModel(guid);
|
||||||
|
}
|
||||||
|
|
||||||
private void SetupCamera()
|
private void SetupCamera()
|
||||||
{
|
{
|
||||||
if (Options.TryGetModel(out var model))
|
if (Options.TryGetModel(out var model))
|
||||||
|
|
|
||||||
|
|
@ -1014,8 +1014,8 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio
|
||||||
style.Colors[(int) ImGuiCol.Tab] = new Vector4(0.15f, 0.15f, 0.19f, 1.00f);
|
style.Colors[(int) ImGuiCol.Tab] = new Vector4(0.15f, 0.15f, 0.19f, 1.00f);
|
||||||
style.Colors[(int) ImGuiCol.TabHovered] = new Vector4(0.35f, 0.35f, 0.41f, 0.80f);
|
style.Colors[(int) ImGuiCol.TabHovered] = new Vector4(0.35f, 0.35f, 0.41f, 0.80f);
|
||||||
style.Colors[(int) ImGuiCol.TabSelected] = new Vector4(0.23f, 0.24f, 0.29f, 1.00f);
|
style.Colors[(int) ImGuiCol.TabSelected] = new Vector4(0.23f, 0.24f, 0.29f, 1.00f);
|
||||||
style.Colors[(int) ImGuiCol.TabSelectedOverline] = new Vector4(0.15f, 0.15f, 0.15f, 1.00f);
|
style.Colors[(int) ImGuiCol.TabDimmed] = new Vector4(0.15f, 0.15f, 0.15f, 1.00f);
|
||||||
style.Colors[(int) ImGuiCol.TabDimmed] = new Vector4(0.23f, 0.24f, 0.29f, 1.00f);
|
style.Colors[(int) ImGuiCol.TabDimmedSelected] = new Vector4(0.23f, 0.24f, 0.29f, 1.00f);
|
||||||
style.Colors[(int) ImGuiCol.DockingPreview] = new Vector4(0.26f, 0.59f, 0.98f, 0.70f);
|
style.Colors[(int) ImGuiCol.DockingPreview] = new Vector4(0.26f, 0.59f, 0.98f, 0.70f);
|
||||||
style.Colors[(int) ImGuiCol.DockingEmptyBg] = new Vector4(0.20f, 0.20f, 0.20f, 1.00f);
|
style.Colors[(int) ImGuiCol.DockingEmptyBg] = new Vector4(0.20f, 0.20f, 0.20f, 1.00f);
|
||||||
style.Colors[(int) ImGuiCol.PlotLines] = new Vector4(0.61f, 0.61f, 0.61f, 1.00f);
|
style.Colors[(int) ImGuiCol.PlotLines] = new Vector4(0.61f, 0.61f, 0.61f, 1.00f);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user