mirror of
https://github.com/4sval/FModel.git
synced 2026-09-24 01:05:51 -05:00
Nascar's custom IRMesh format support
This commit is contained in:
Submodule CUE4Parse updated: 6409f38e09...756358e40b
@@ -169,6 +169,7 @@ public enum EAssetCategory : uint
|
||||
LegoBatman = GameSpecific + 5,
|
||||
ArcSys = GameSpecific + 6,
|
||||
GothamKnights = GameSpecific + 7,
|
||||
Nascar = GameSpecific + 8,
|
||||
}
|
||||
|
||||
public enum EAssetFamily
|
||||
|
||||
@@ -30,6 +30,7 @@ using CUE4Parse.GameTypes.DFHO.Assets.Objects;
|
||||
using CUE4Parse.GameTypes.HonorOfKings.FileProvider;
|
||||
using CUE4Parse.GameTypes.KRD.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.LegoBatman.Assets;
|
||||
using CUE4Parse.GameTypes.Nascar.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.LordOfMysteries.FileProvider;
|
||||
using CUE4Parse.GameTypes.Tencent.RocoKingdomWorld.Assets.Objects;
|
||||
using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
|
||||
@@ -1594,6 +1595,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||
// }:
|
||||
case UPaperSprite when isNone && UserSettings.Default.PreviewMaterials:
|
||||
case UStaticMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case UIRMesh when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case UGeometryCollection when isNone && UserSettings.Default.PreviewStaticMeshes:
|
||||
case USkinnedAsset when isNone && UserSettings.Default.PreviewSkeletalMeshes:
|
||||
case USkeleton when isNone && UserSettings.Default.SaveSkeletonAsMesh:
|
||||
@@ -1621,6 +1623,7 @@ public class CUE4ParseViewModel : ViewModel
|
||||
return true;
|
||||
}
|
||||
case UStaticMesh when HasFlag(bulk, EBulkType.Meshes):
|
||||
case UIRMesh when HasFlag(bulk, EBulkType.Meshes):
|
||||
case UGeometryCollection when HasFlag(bulk, EBulkType.Meshes):
|
||||
case USkinnedAsset when HasFlag(bulk, EBulkType.Meshes):
|
||||
case USkeleton when UserSettings.Default.SaveSkeletonAsMesh && HasFlag(bulk, EBulkType.Meshes):
|
||||
|
||||
@@ -11,6 +11,7 @@ using CUE4Parse.GameTypes.Borderlands3.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.Borderlands4.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.FN.Assets.Exports.DataAssets;
|
||||
using CUE4Parse.GameTypes.LegoBatman.Assets;
|
||||
using CUE4Parse.GameTypes.Nascar.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.RED.Assets.Exports;
|
||||
using CUE4Parse.GameTypes.SMG.UE4.Assets.Exports.Wwise;
|
||||
using CUE4Parse.GameTypes.SMG.UE4.Assets.Objects;
|
||||
@@ -294,6 +295,7 @@ public class GameFileViewModel(GameFile asset) : ViewModel
|
||||
UWubAudioEvent or UWubDialogueEvent when GameVersion is EGame.GAME_LEGOBatmanLegacyoftheDarkKnight => (EAssetCategory.LegoBatman, EBulkType.Audio), // Lego Batman: Legacy of the Dark Knight;
|
||||
UREDBinaryObject => (EAssetCategory.ArcSys, EBulkType.None), // Arc System Works games;
|
||||
UOrpheusBank or UOrpheusEvent => (EAssetCategory.GothamKnights, EBulkType.Audio), // Gotham Knights;
|
||||
UIRMesh => (EAssetCategory.Nascar, EBulkType.Meshes), // iRacing games;
|
||||
|
||||
_ => (EAssetCategory.All, EBulkType.None),
|
||||
};
|
||||
|
||||
@@ -60,10 +60,11 @@
|
||||
<SolidColorBrush x:Key="FModBrush" Color="#00758f" />
|
||||
|
||||
<!-- For specific games -->
|
||||
<SolidColorBrush x:Key="BorderlandsBrush" Color="Yellow"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="AionBrush" Color="DeepSkyBlue"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="RocoKingdomWorldBrush" Color="#fecf4d"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="DeltaForceBrush" Color="LightGreen"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="BatmanBrush" Color="Gold"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="ArcSysBrush" Color="Red"></SolidColorBrush>
|
||||
<SolidColorBrush x:Key="BorderlandsBrush" Color="Yellow" />
|
||||
<SolidColorBrush x:Key="AionBrush" Color="DeepSkyBlue" />
|
||||
<SolidColorBrush x:Key="RocoKingdomWorldBrush" Color="#fecf4d" />
|
||||
<SolidColorBrush x:Key="DeltaForceBrush" Color="LightGreen" />
|
||||
<SolidColorBrush x:Key="BatmanBrush" Color="Gold" />
|
||||
<SolidColorBrush x:Key="ArcSysBrush" Color="Red" />
|
||||
<SolidColorBrush x:Key="NascarBrush" Color="#dd002a" />
|
||||
</ResourceDictionary>
|
||||
|
||||
@@ -102,6 +102,7 @@ public class FileToGeometryConverter : IMultiValueConverter
|
||||
EAssetCategory.DeltaForce => ("DeltaForceIcon", "DeltaForceBrush"),
|
||||
EAssetCategory.LegoBatman or EAssetCategory.GothamKnights => ("BatmanIcon", "BatmanBrush"),
|
||||
EAssetCategory.ArcSys => ("ArcSysIcon", "ArcSysBrush"),
|
||||
EAssetCategory.Nascar => ("NascarIcon", "NascarBrush"),
|
||||
|
||||
_ => ("AssetIcon", "NeutralBrush")
|
||||
};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,12 +1,14 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using CUE4Parse_Conversion.Dto;
|
||||
using CUE4Parse.GameTypes.Nascar.Assets.Exports;
|
||||
using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
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.UObject;
|
||||
using CUE4Parse_Conversion.Dto;
|
||||
using FModel.Views.Snooper.Shading;
|
||||
using OpenTK.Graphics.OpenGL4;
|
||||
|
||||
@@ -150,6 +152,12 @@ public class StaticModel : UModel<MeshVertex>
|
||||
Box = staticMesh.Bounds * Constants.SCALE_DOWN_RATIO;
|
||||
}
|
||||
|
||||
public StaticModel(UIRMesh export, StaticMeshDto mesh)
|
||||
: base(export, mesh.LODs[LodLevel], new FPackageIndex[mesh.Materials.Length], mesh.LODs[LodLevel].Vertices, mesh.LODs.Count)
|
||||
{
|
||||
Box = mesh.Bounds * Constants.SCALE_DOWN_RATIO;
|
||||
}
|
||||
|
||||
public override void RenderCollision(Shader shader)
|
||||
{
|
||||
base.RenderCollision(shader);
|
||||
|
||||
@@ -13,6 +13,7 @@ using CUE4Parse.UE4.Assets.Exports.GeometryCollection;
|
||||
using CUE4Parse.UE4.Assets.Exports.Material;
|
||||
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
|
||||
using CUE4Parse.UE4.Assets.Exports.Texture;
|
||||
using CUE4Parse.GameTypes.Nascar.Assets.Exports;
|
||||
using CUE4Parse.UE4.Objects.Core.Math;
|
||||
using CUE4Parse.UE4.Objects.Core.Misc;
|
||||
using CUE4Parse.UE4.Objects.Engine;
|
||||
@@ -90,6 +91,9 @@ public class Renderer : IDisposable
|
||||
case UStaticMesh when export.Value is UStaticMesh st:
|
||||
LoadStaticMesh(st, UserSettings.Default.NaniteMeshExportFormat);
|
||||
break;
|
||||
case UIRMesh when export.Value is UIRMesh ir:
|
||||
LoadIRMesh(ir);
|
||||
break;
|
||||
case UGeometryCollection when export.Value is UGeometryCollection gc:
|
||||
LoadStaticMesh(gc, UserSettings.Default.NaniteMeshExportFormat);
|
||||
break;
|
||||
@@ -366,13 +370,39 @@ public class Renderer : IDisposable
|
||||
Options.SelectModel(guid);
|
||||
}
|
||||
|
||||
private void LoadIRMesh(UIRMesh original)
|
||||
{
|
||||
var guid = new FGuid((uint) original.GetFullName().GetHashCode());
|
||||
if (Options.TryGetModel(guid, out var model))
|
||||
{
|
||||
model.AddInstance(Transform.Identity);
|
||||
Application.Current.Dispatcher.Invoke(model.SetupInstances);
|
||||
return;
|
||||
}
|
||||
|
||||
StaticMeshDto mesh;
|
||||
try
|
||||
{
|
||||
mesh = new StaticMeshDto(original);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "Failed to convert IR mesh");
|
||||
return;
|
||||
}
|
||||
|
||||
Options.Models[guid] = new StaticModel(original, mesh);
|
||||
mesh.Dispose();
|
||||
Options.SelectModel(guid);
|
||||
}
|
||||
|
||||
private void LoadStaticMesh(UGeometryCollection original, ENaniteMeshFormat naniteFormat = ENaniteMeshFormat.NoNanite)
|
||||
{
|
||||
var guid = new FGuid((uint) original.GetFullName().GetHashCode());
|
||||
if (Options.TryGetModel(guid, out var model))
|
||||
{
|
||||
model.AddInstance(Transform.Identity);
|
||||
Application.Current.Dispatcher.Invoke(() => model.SetupInstances());
|
||||
Application.Current.Dispatcher.Invoke(model.SetupInstances);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -397,7 +427,7 @@ public class Renderer : IDisposable
|
||||
if (Options.TryGetModel(guid, out var model))
|
||||
{
|
||||
model.AddInstance(Transform.Identity);
|
||||
Application.Current.Dispatcher.Invoke(() => model.SetupInstances());
|
||||
Application.Current.Dispatcher.Invoke(model.SetupInstances);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -408,7 +438,7 @@ public class Renderer : IDisposable
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e, "Failed to convert chaos cloth asset");
|
||||
Log.Error(e, "Failed to convert skinned asset");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -456,7 +486,7 @@ public class Renderer : IDisposable
|
||||
if (Options.TryGetModel(guid, out var model))
|
||||
{
|
||||
model.AddInstance(Transform.Identity);
|
||||
Application.Current.Dispatcher.Invoke(() => model.SetupInstances());
|
||||
Application.Current.Dispatcher.Invoke(model.SetupInstances);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user