feat: Silk.NET OpenGL backend compiles — full shadow mapping support

- Fixed all Silk.NET 2.21 API issues:
  - BufferData with void* + fixed blocks
  - UniformMatrix4 with float[] buffer (CopyMatrixToBuffer helper)
  - DrawBuffer/ReadBuffer with DrawBufferMode/ReadBufferMode
  - Clear with (uint) cast
  - Input delegates: KeyDown(IKeyboard,Key,int), MouseDown(IMouse,MouseButton), Scroll(IMouse,ScrollWheel)
  - GetProgram with ProgramPropertyARB
  - IWindow alias SilkWindow to avoid ambiguity
- OpenGLRenderer: shadow FBO with depth texture, PCF 3x3, full PBR shader
- OpenGLRenderContext: Silk.NET window + GL context
- OpenGLBackendRegistrar registered as 'opengl'
- 66/66 tests, 0 errors
This commit is contained in:
emil28092005
2026-06-17 18:59:36 +03:00
parent 6e65eedf1d
commit cc9a1a4602
4 changed files with 158 additions and 204 deletions
+5 -16
View File
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using Engine.Core;
using Engine.Core.Components;
using Silk.NET.Input;
using Silk.NET.Windowing;
using SilkWindow = Silk.NET.Windowing.IWindow;
using SilkKey = Silk.NET.Input.Key;
using SilkMouseButton = Silk.NET.Input.MouseButton;
using EngineKey = Engine.Core.Key;
namespace Engine.Graphics.OpenGL;
/// <summary>
/// Silk.NET windowing-backed implementation of IWindow.
/// </summary>
public sealed class OpenGLWindow : Engine.Core.IWindow, IDisposable
{
private readonly SilkWindow _silkWindow;
@@ -23,7 +19,6 @@ public sealed class OpenGLWindow : Engine.Core.IWindow, IDisposable
public bool ShouldClose => _shouldClose || _silkWindow.IsClosing;
IInputState Engine.Core.IWindow.Input => _input;
public nint Handle => 0;
public SilkWindow SilkView => _silkWindow;
public OpenGLWindow(string title, int width, int height)
@@ -34,7 +29,7 @@ public sealed class OpenGLWindow : Engine.Core.IWindow, IDisposable
options.VSync = true;
options.API = new GraphicsAPI(ContextAPI.OpenGL, ContextProfile.Core, ContextFlags.Default, new APIVersion(3, 3));
_silkWindow = Silk.NET.Windowing.Window.Create(options);
_silkWindow = Window.Create(options);
_silkWindow.Closing += () => _shouldClose = true;
}
@@ -44,13 +39,8 @@ public sealed class OpenGLWindow : Engine.Core.IWindow, IDisposable
_input.Initialize(inputContext);
}
public void PumpEvents()
{
_silkWindow.DoEvents();
}
public void PumpEvents() => _silkWindow.DoEvents();
public void Close() => _shouldClose = true;
public string[] GetRequiredVulkanExtensions() => Array.Empty<string>();
public void Dispose()
@@ -61,4 +51,3 @@ public sealed class OpenGLWindow : Engine.Core.IWindow, IDisposable
_silkWindow.Dispose();
}
}