- Complete rewrite of Engine.Graphics.Vulkan with pure P/Invoke (no wrapper libs) - Vulkan 1.3: dynamic rendering (vkCmdBeginRendering/vkCmdEndRendering), synchronization2 (vkQueueSubmit2, vkCmdPipelineBarrier2) - Split types into VulkanHandles.cs, VulkanEnums.cs, VulkanStructs.cs - Staging buffer → device-local vertex buffer pattern - Correct swapchain semaphore indexing (per-image, not per-frame-in-flight) - VK_EXT_debug_utils debug messenger with validation layer fallback - Dynamic viewport/scissor (no pipeline recreation on resize) - Simplified Program.cs to triangle-only rendering - Removed old Silk.NET renderer, ImGui, PBR shaders, screenshot code - Updated VULKAN_IMPLEMENTATION_PLAN.md with full architecture decisions
20 lines
448 B
C#
20 lines
448 B
C#
using System.Numerics;
|
|
|
|
namespace Engine.Graphics;
|
|
|
|
/// <summary>
|
|
/// Basic mesh math utilities.
|
|
/// </summary>
|
|
public static class MeshMath
|
|
{
|
|
public static Vector3 ComputeFaceNormal(Vector3 a, Vector3 b, Vector3 c)
|
|
{
|
|
var ab = b - a;
|
|
var ac = c - a;
|
|
var cross = Vector3.Cross(ab, ac);
|
|
if (cross.LengthSquared() < 0.0000001f)
|
|
return Vector3.UnitY;
|
|
return Vector3.Normalize(cross);
|
|
}
|
|
}
|