feat: rebuild Vulkan renderer from scratch — pure P/Invoke triangle (Vulkan 1.3)
- 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
This commit is contained in:
@@ -2,17 +2,18 @@ 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 edge1 = b - a;
|
||||
var edge2 = c - a;
|
||||
var normal = Vector3.Cross(edge2, edge1);
|
||||
|
||||
if (normal.LengthSquared() < 1e-12f)
|
||||
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(normal);
|
||||
return Vector3.Normalize(cross);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user