SkinRenderer - Replace 'AddCustomModelPart' type checking from exception throwing to writting a trace warning message

This commit is contained in:
miku-666
2024-04-08 17:05:09 +02:00
parent dad3cdb27b
commit c426522839

View File

@@ -331,11 +331,11 @@ namespace PckStudio.Rendering
body ??= new CubeGroupMesh("Body");
body.AddCube(new(-4, 0, -2), new(8, 12, 4), new(16, 16));
body.AddCube(new(-4, 0, -2), new(8, 12, 4), new(16, 32), OverlayScale);
rightArm ??= new CubeGroupMesh("Right Arm", new Vector3(-5f, -2f, 0f), new Vector3(4f, 2f, 0f));
rightArm.AddCube(new(-3, -2, -2), new(4, 12, 4), new(40, 16));
rightArm.AddCube(new(-3, -2, -2), new(4, 12, 4), new(40, 32), OverlayScale);
leftArm ??= new CubeGroupMesh("Left Arm", new Vector3(5f, -2f, 0f), new Vector3(-4f, 2f, 0f));
leftArm.AddCube(new(-1, -2, -2), new(4, 12, 4), new(32, 48));
leftArm.AddCube(new(-1, -2, -2), new(4, 12, 4), new(48, 48), inflate: OverlayScale);
@@ -783,7 +783,10 @@ namespace PckStudio.Rendering
private void AddCustomModelPart(SkinBOX skinBox)
{
if (!meshStorage.ContainsKey(skinBox.Type))
throw new KeyNotFoundException(skinBox.Type);
{
Trace.TraceWarning("[{0}@{1}] Invalid BOX Type: '{2}'", nameof(SkinRenderer), nameof(AddCustomModelPart), skinBox.Type);
return;
}
CubeGroupMesh cubeMesh = meshStorage[skinBox.Type];
cubeMesh.AddSkinBox(skinBox, autoInflateOverlayParts && skinBox.IsOverlayPart() ? skinBox.Type == "HEADWEAR" ? OverlayScale * 2 : OverlayScale : 0f);
@@ -1126,12 +1129,12 @@ namespace PckStudio.Rendering
Vector3 translation = cubeMesh.Translation - cubeMesh.Offset;
Vector3 pivot = cubeMesh.Pivot + cubeMesh.Offset;
transform = Pivot(translation, pivot, transform);
GL.BlendFunc(BlendingFactor.DstAlpha, BlendingFactor.OneMinusSrcAlpha);
GL.BlendFunc(BlendingFactor.DstAlpha, BlendingFactor.OneMinusSrcAlpha);
DrawBoundingBox(transform, cubeBoundingBox, OutlineColor);
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha);
}
}
}
}
// Ground plane