mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/PCK-Studio.git
synced 2026-05-25 11:46:14 +00:00
SkinRenderer - Fix centering leg0/1
This commit is contained in:
@@ -13,10 +13,10 @@ namespace PckStudio.Internal
|
||||
{
|
||||
["HEAD"] = new PositioningInfo(),
|
||||
["BODY"] = new PositioningInfo(),
|
||||
["ARM0"] = new PositioningInfo(new(-5f, 2f, 0f), new( 6f, 2f, 0f)),
|
||||
["ARM1"] = new PositioningInfo(new( 5f, 2f, 0f), new(-6f, 2f, 0f)),
|
||||
["LEG0"] = new PositioningInfo(new(-2f, 12f, 0f), new( 2f, 12f, 0f)),
|
||||
["LEG1"] = new PositioningInfo(new( 2f, 12f, 0f), new(-2f, 12f, 0f)),
|
||||
["ARM0"] = new PositioningInfo(new(-5f, 2f, 0f), new(-6f, 2f, 0f)),
|
||||
["ARM1"] = new PositioningInfo(new( 5f, 2f, 0f), new( 6f, 2f, 0f)),
|
||||
["LEG0"] = new PositioningInfo(new(-2f, 12f, 0f), new(-2f, 12f, 0f)),
|
||||
["LEG1"] = new PositioningInfo(new( 2f, 12f, 0f), new( 2f, 12f, 0f)),
|
||||
};
|
||||
|
||||
internal record struct PositioningInfo(Vector3 Translation, Vector3 Pivot);
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace PckStudio.Rendering
|
||||
if (!cubes.IndexInRange(index))
|
||||
throw new IndexOutOfRangeException();
|
||||
|
||||
return Vector3.TransformPosition(cubes[index].Center + Offset, Transform);
|
||||
return (Transform * Matrix4.CreateTranslation(cubes[index].Center)).ExtractTranslation();
|
||||
}
|
||||
|
||||
internal BoundingBox GetCubeBoundingBox(int index)
|
||||
|
||||
@@ -863,7 +863,9 @@ namespace PckStudio.Rendering
|
||||
|
||||
CubeGroupMesh cubeMesh = meshStorage[skinBox.Type];
|
||||
Vector3 center = Cube.FromSkinBox(skinBox).Center;
|
||||
Camera.FocalPoint = (cubeMesh.Transform * Matrix4.CreateTranslation(center)).Inverted().ExtractTranslation();
|
||||
Matrix4 camMat = (Matrix4.CreateTranslation(cubeMesh.Translation) * Matrix4.CreateTranslation(center) * Matrix4.CreateScale(-1, 1, 1));
|
||||
Vector3 camPos = camMat.ExtractTranslation();
|
||||
Camera.FocalPoint = camPos;
|
||||
Camera.Distance = skinBox.Size.Length() * 2;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user