Updating MorphTarget

This commit is contained in:
LongerWarrior 2024-08-30 18:48:01 +03:00
parent 3df3e802d4
commit 0ae8386316
4 changed files with 20 additions and 15 deletions

@ -1 +1 @@
Subproject commit 2249deefcbe5e5858229db2f8694623c69009036
Subproject commit 33ba4d6886212e244ec0a32bfc8183db85f2a398

View File

@ -31,6 +31,7 @@ public class BaseMaterialInstance : BaseIcon
case "TextureA":
case "TextureB":
case "OfferImage":
case "CarTexture":
Preview = Utils.GetBitmap(texture);
break;
}
@ -88,4 +89,4 @@ public class BaseMaterialInstance : BaseIcon
return new[] { ret };
}
}
}

View File

@ -1,4 +1,4 @@
using System;
using System;
using CUE4Parse.UE4.Assets.Exports.Animation;
using CUE4Parse.UE4.Objects.Core.Math;
using OpenTK.Graphics.OpenGL4;
@ -44,9 +44,9 @@ public class Morph : IDisposable
Vertices[baseIndex + count++] = vertices[i + 1] + positionDelta.X * Constants.SCALE_DOWN_RATIO;
Vertices[baseIndex + count++] = vertices[i + 2] + positionDelta.Z * Constants.SCALE_DOWN_RATIO;
Vertices[baseIndex + count++] = vertices[i + 3] + positionDelta.Y * Constants.SCALE_DOWN_RATIO;
Vertices[baseIndex + count++] = vertices[i + 7] + tangentDelta.X * Constants.SCALE_DOWN_RATIO;
Vertices[baseIndex + count++] = vertices[i + 8] + tangentDelta.Z * Constants.SCALE_DOWN_RATIO;
Vertices[baseIndex + count++] = vertices[i + 9] + tangentDelta.Y * Constants.SCALE_DOWN_RATIO;
Vertices[baseIndex + count++] = vertices[i + 7] + tangentDelta.X;
Vertices[baseIndex + count++] = vertices[i + 8] + tangentDelta.Z;
Vertices[baseIndex + count++] = vertices[i + 9] + tangentDelta.Y;
}
else
{

View File

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Numerics;
using CUE4Parse_Conversion.Meshes.PSK;
@ -74,11 +74,15 @@ public class SkeletalModel : UModel
}
}
Morphs = new List<Morph>();
for (var i = 0; i < export.MorphTargets.Length; i++)
Morphs = [];
if (export.MorphTargets.Length == 0) return;
export.PopulateMorphTargetVerticesData();
foreach (var morph in export.MorphTargets)
{
if (!export.MorphTargets[i].TryLoad(out UMorphTarget morphTarget) ||
morphTarget.MorphLODModels.Length < 1 || morphTarget.MorphLODModels[0].Vertices.Length < 1)
if (!morph.TryLoad(out UMorphTarget morphTarget) || morphTarget.MorphLODModels.Length < 1 ||
morphTarget.MorphLODModels[0].Vertices.Length < 1)
continue;
Morphs.Add(new Morph(Vertices, VertexSize, morphTarget));
@ -87,10 +91,10 @@ public class SkeletalModel : UModel
public SkeletalModel(USkeleton export, FBox box) : base(export)
{
Indices = Array.Empty<uint>();
Materials = Array.Empty<Material>();
Vertices = Array.Empty<float>();
Sections = Array.Empty<Section>();
Indices = [];
Materials = [];
Vertices = [];
Sections = [];
AddInstance(Transform.Identity);
Box = box * Constants.SCALE_DOWN_RATIO;