Correct preview ground placement and expose original animation clips
This commit is contained in:
1 parent
670adb4795
commit
37fa18094f
22 files changed
+398
-33
No files matched your search
@@ -15,5 +15,7 @@
|
||||
<Compile Include="../../src/GamePort/Assets/AssetPath.cs" Link="AssetPath.cs" />
|
||||
<Compile Include="../../src/GamePort/Assets/MorphAnimation.cs" Link="MorphAnimation.cs" />
|
||||
<Compile Include="../../src/GamePort/Game/RecoveredMotion.cs" Link="RecoveredMotion.cs" />
|
||||
<Compile Include="../../src/GamePort/Application/PreviewCharacterPlacement.cs" Link="PreviewCharacterPlacement.cs" />
|
||||
<Compile Include="../../src/GamePort/Application/PreviewAnimationLibrary.cs" Link="PreviewAnimationLibrary.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,4 +1,5 @@
|
||||
using GamePort.Assets;
|
||||
using GamePort.Application;
|
||||
using GamePort.Game;
|
||||
using System.Numerics;
|
||||
|
||||
@@ -78,6 +79,40 @@ Require(combined.Indices.Length == scene.Indices.Length + 2442 && combined.Textu
|
||||
Require(combined.Indices.All(i => i < combined.Vertices.Length), "Combined scene contains invalid index");
|
||||
Console.WriteLine("PASS: null-material visibility, case-insensitive ASE, original morph interpolation/base UV, and scene/character merge.");
|
||||
|
||||
var start = initial.FindStart()!;
|
||||
var placement = PreviewCharacterPlacement.Create(scene, baseMesh, start.Position, start.Rotation.Y);
|
||||
Require(placement.FloorAtOrigin is > 0.5f and < 0.6f, "Wrong original lab floor selected (ceiling/proxy?)");
|
||||
Require(placement.VerticalCorrection is > 38 and < 40, "Original lab floor penetration was not corrected");
|
||||
Require(placement.SourcePosition == start.Position && placement.Position.X == start.Position.X
|
||||
&& placement.Position.Z == start.Position.Z, "Preview grounding changed the original GAM data or horizontal position");
|
||||
var correctedSole = baseMesh.Vertices.Min(v => Vector3.Transform(v.Position, placement.Model).Y);
|
||||
Require(correctedSole >= placement.FloorAtOrigin!.Value - 0.05f, "Standing soles still penetrate the lab floor");
|
||||
|
||||
Mesh FlatFloors(bool drawProxy)
|
||||
{
|
||||
var vertices = new List<MeshVertex>();
|
||||
foreach (var y in new[] { 10f, 25f, 500f })
|
||||
foreach (var p in new[] { new Vector3(-500,y,-500),new Vector3(500,y,-500),new Vector3(500,y,500),
|
||||
new Vector3(-500,y,-500),new Vector3(500,y,500),new Vector3(-500,y,500) })
|
||||
vertices.Add(new MeshVertex(p, Vector2.Zero, Vector3.One));
|
||||
return new Mesh(vertices.ToArray(), Enumerable.Range(0, vertices.Count).Select(i => (uint)i).ToArray())
|
||||
{ HasExplicitDraws = true, Draws = drawProxy ? [new MeshDraw(0, 18, -1)] : [new MeshDraw(0, 6, -1), new MeshDraw(12, 6, -1)] };
|
||||
}
|
||||
var flat = PreviewCharacterPlacement.Create(FlatFloors(false), baseMesh, new Vector3(0,30,0), 0);
|
||||
Require(flat.FloorAtOrigin == 10, "Invisible proxy or overhead ceiling selected as preview floor");
|
||||
Require(MathF.Abs(baseMesh.Vertices.Min(v => Vector3.Transform(v.Position, flat.Model).Y) - 10) < 0.001f,
|
||||
"Standing model does not rest on actual visible floor");
|
||||
var raised = PreviewCharacterPlacement.Create(FlatFloors(true), baseMesh, new Vector3(0,30,0), 0);
|
||||
Require(raised.FloorAtOrigin == 25, "Nearest visible floor below origin was not selected");
|
||||
var noFloor = PreviewCharacterPlacement.Create(new Mesh([], []), baseMesh, start.Position, 0);
|
||||
Require(noFloor.VerticalCorrection == 0 && noFloor.FloorAtOrigin == null, "Missing floor caused an invented world offset");
|
||||
var clips = new PreviewAnimationLibrary(Path.Combine(project, "artifacts/extracted/animations/jimstop/animation.json"));
|
||||
Require(!clips.Current.HasVertexMotion, "Supplied idle unexpectedly has vertex motion");
|
||||
foreach (var key in new[] { 31u, 32u, 33u })
|
||||
Require(clips.Select(key) && clips.Current.HasVertexMotion, "Animation preview key did not select moving original samples");
|
||||
Require(clips.Select(30) && !clips.Current.HasVertexMotion, "Idle selection did not restore original still pose");
|
||||
Console.WriteLine($"PASS: original lab grounding (+{placement.VerticalCorrection:F3} Y), ceiling/proxy rejection, and explicit idle/run/jump/scratch selection.");
|
||||
|
||||
static void Require(bool condition, string message)
|
||||
{
|
||||
if (!condition) throw new Exception(message);
|
||||
|
||||
Reference in new issue
Block a user