summaryrefslogtreecommitdiff
path: root/engine/res
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2026-06-05 21:50:56 +0200
committerHampusM <hampus@hampusmat.com>2026-06-05 21:50:56 +0200
commite5d67bf7e36671d290b19064f58bc11616c05b8b (patch)
treea529b876e4198bb470113837bfd6dca3fda3409e /engine/res
parent87015a4abcd45d6c69b289467c9e37426e1f0930 (diff)
feat(engine): add imgui ui supportHEADmaster
Diffstat (limited to 'engine/res')
-rw-r--r--engine/res/imgui_shader.slang54
1 files changed, 54 insertions, 0 deletions
diff --git a/engine/res/imgui_shader.slang b/engine/res/imgui_shader.slang
new file mode 100644
index 0000000..6ce51d6
--- /dev/null
+++ b/engine/res/imgui_shader.slang
@@ -0,0 +1,54 @@
+struct Vertex
+{
+ float3 pos;
+ float4 color;
+ float2 texture_coords;
+};
+
+struct VertexData
+{
+ float4 color;
+ float2 texture_coords;
+};
+
+struct VertexStageOutput
+{
+ VertexData vertex_data : VertexData;
+ float4 sv_position : SV_Position;
+};
+
+struct Fragment
+{
+ float4 color;
+};
+
+cbuffer Uniforms
+{
+ float4x4 projection;
+};
+
+Sampler2D main_texture;
+
+[shader("vertex")]
+VertexStageOutput vertex_main(Vertex vertex: VERTEX)
+{
+ VertexStageOutput stage_output;
+
+ stage_output.sv_position = mul(projection, float4(vertex.pos.xy, 0.f, 1.f));
+
+ stage_output.vertex_data.color = vertex.color;
+ stage_output.vertex_data.texture_coords = vertex.texture_coords;
+
+ return stage_output;
+}
+
+[shader("fragment")]
+Fragment fragment_main(VertexData vertex_data: VertexData) : SV_Target
+{
+ Fragment fragment;
+
+ fragment.color = vertex_data.color * main_texture.Sample(vertex_data.texture_coords);
+
+ return fragment;
+}
+