https://github.com/jenskrumsieck/licht
Experimental! Vulkan & ImGui Apps in C# using Silk.NET and ImGui.NET
https://github.com/jenskrumsieck/licht
csharp imgui rendering silk silknet vulkan
Last synced: 5 months ago
JSON representation
Experimental! Vulkan & ImGui Apps in C# using Silk.NET and ImGui.NET
- Host: GitHub
- URL: https://github.com/jenskrumsieck/licht
- Owner: JensKrumsieck
- License: mit
- Created: 2023-08-07T21:21:48.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-27T12:44:40.000Z (over 1 year ago)
- Last Synced: 2024-12-13T02:52:23.296Z (5 months ago)
- Topics: csharp, imgui, rendering, silk, silknet, vulkan
- Language: C#
- Homepage:
- Size: 3.26 MB
- Stars: 14
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Licht
[](https://www.nuget.org/packages/Licht/)
[](https://www.nuget.org/packages/Licht.Vulkan/)A thin but opinionated abstraction layer to write Vulkan Code in C# (using Silk.NET) with fewer boilerplate code.
(work in progress, see Examples folder for some examples)Get to the Triangle in less than 50 lines of code:
```csharp
using Licht.Applications;
using Licht.Core;
using Licht.Vulkan;
using Licht.Vulkan.Memory;
using Licht.Vulkan.Pipelines;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Silk.NET.Windowing;var opts = ApplicationSpecification.Default with {ApplicationName = "Triangle"};
var builder = new ApplicationBuilder(opts);builder.Services.AddSingleton();
builder.Services.AddWindow(opts);
builder.Services.AddVulkanRenderer();{
using var app = builder.Build();
app.Run();
}sealed class TriangleApplication : WindowedApplication
{
private readonly VkGraphicsDevice _device;
private readonly VkGraphicsPipeline _pipeline;
private readonly PipelineEffect _effect;
public TriangleApplication(ILogger logger, VkGraphicsDevice device, IWindow window, VkRenderer renderer) : base(logger, renderer, window)
{
_device = device;
var passDescription = GraphicsPipelineDescription.Default();
_effect = PipelineEffect.BuildEffect(_device, "./assets/shaders/triangle.vert.spv", "./assets/shaders/triangle.frag.spv", null);
_pipeline = new VkGraphicsPipeline(_device, _effect, passDescription, default, Renderer.RenderPass!.Value);
}public override void DrawFrame(CommandBuffer cmd, float deltaTime)
{
cmd.BindGraphicsPipeline(_pipeline);
cmd.Draw(3, 1, 0, 0);
}public override void Release()
{
_device.WaitIdle();
_pipeline.Dispose();
_effect.Dispose();
base.Release();
}
}
```There are currently examples for:
* Triangle Example
* ImGui Example
* Compute Shader (small raytraced sphere) Example