feat: custom gltf

This commit is contained in:
tresabhi committed 2025-02-02 13:39:37 -06:00
1 parent 22e4553720
commit 31ff50ffd8
4 files changed
+206 -29

No files matched your search

+39 -14
View File
@@ -1,9 +1,12 @@
using Blitzkit;
using BlitzKit.CLI.Models;
using BlitzKit.CLI.Utils;
using CommunityToolkit.HighPerformance;
using CommunityToolkit.HighPerformance.Helpers;
using CUE4Parse_Conversion;
using CUE4Parse_Conversion.Animations;
using CUE4Parse_Conversion.Meshes;
using CUE4Parse_Conversion.Meshes.glTF;
using CUE4Parse_Conversion.Textures;
using CUE4Parse_Conversion.UEFormat.Enums;
using CUE4Parse.UE4.Assets.Exports.Engine;
@@ -11,6 +14,8 @@ using CUE4Parse.UE4.Assets.Exports.Material;
using CUE4Parse.UE4.Assets.Exports.StaticMesh;
using CUE4Parse.UE4.Assets.Exports.Texture;
using CUE4Parse.UE4.Objects.UObject;
using CUE4Parse.UE4.Readers;
using CUE4Parse.UE4.Writers;
using CUE4Parse.Utils;
using Google.Protobuf.Collections;
using Newtonsoft.Json.Linq;
@@ -73,21 +78,41 @@ namespace BlitzKit.CLI.Functions
var hullVisual = hull.GetObject("VisualData");
var hullMeshSettings = hullVisual.GetStruct("MeshSettings");
var hullMesh = hullMeshSettings.GetSoftObject<UStaticMesh>("Mesh");
MeshExporter hullMeshExporter = new(
hullMesh,
new()
{
MeshFormat = EMeshFormat.Gltf2,
ExportMaterials = true,
ExportMorphTargets = false,
LodFormat = ELodFormat.FirstLod,
TextureFormat = ETextureFormat.Jpeg,
SocketFormat = ESocketFormat.None,
Platform = ETexturePlatform.DesktopMobile,
}
);
hullMeshExporter.TryWriteToDir(new("../../temp"), out _, out _);
MonoGltf hullGltf = new(tankId, hullMesh);
// Gltf gltf = new(hullMesh.Name, hullLod0, null, new() { });
// FArchiveWriter archiveWriter = new();
// gltf.Save(EMeshFormat.Gltf2, archiveWriter);
// MeshExporter hullMeshExporter = new(
// hullMesh,
// new()
// {
// MeshFormat = EMeshFormat.Gltf2,
// ExportMaterials = true,
// ExportMorphTargets = false,
// LodFormat = ELodFormat.FirstLod,
// TextureFormat = ETextureFormat.Jpeg,
// SocketFormat = ESocketFormat.None,
// Platform = ETexturePlatform.DesktopMobile,
// }
// );
// var hullLod0 = hullMeshExporter.MeshLods[0];
// var hullMeshData = hullLod0.FileData;
// File.WriteAllBytes($"../../temp/{tankId}.glb", hullMeshData);
// hullMeshExporter.TryWriteToDir(new("../../temp"), out _, out _);
return new() { Id = tankId };
}