Introduce pipeline, shader sketch

This commit is contained in:
2025-02-11 21:11:25 +01:00
parent 4c381f5e77
commit 88e2e58228
9 changed files with 376 additions and 3 deletions

View File

@@ -8,6 +8,31 @@ const main = @import("main.zig");
var show_console: bool = false;
var show_demo_window: bool = false;
const Vertex = extern struct {
position: [3]f32,
tex_coord: [2]f32,
normal: [3]f32,
tangent: [4]f32,
pub fn init(x: f32, y: f32, z: f32, u: f32, v: f32, nx: f32, ny: f32, nz: f32, tx: f32, ty: f32, tz: f32, tw: f32) Vertex {
return .{
.position = .{ x, y, z },
.tex_coord = .{ u, v },
.normal = .{ nx, ny, nz },
.tangent = .{ tx, ty, tw, tz },
};
}
};
const vertex_buffer = [_]Vertex{
Vertex.init(-0.5, -0.5, 0, 0, 1, 0, 0, 1, 1, 0, 0, -1),
Vertex.init(0.5, -0.5, 0, 1, 1, 0, 0, 1, 1, 0, 0, -1),
Vertex.init(-0.5, 0.5, 0, 0, 0, 0, 0, 1, 1, 0, 0, -1),
Vertex.init(0.5, 0.5, 0, 1, 0, 0, 0, 1, 1, 0, 0, -1),
};
const index_buffer = [_]u16{ 0, 1, 2, 2, 1, 3 };
pub fn init() void {}
pub fn update(dt: f32) void {