media: fix compilation errors, HDR loading; vecmath: ColorHdr

This commit is contained in:
2026-02-06 23:26:11 +01:00
parent 2756957f9b
commit 85f4957661
5 changed files with 190 additions and 35 deletions

View File

@@ -0,0 +1,30 @@
const std = @import("std");
const vm = @import("../root.zig");
pub const ColorHdr = extern struct {
r: f16,
g: f16,
b: f16,
a: f16,
pub const Array = [4]f16;
pub const zero = init(0, 0, 0, 0);
pub const one = init(1, 1, 1, 1);
pub inline fn init(r: f16, g: f16, b: f16, a: f16) ColorHdr {
return .{ .r = r, .g = g, .b = b, .a = a };
}
pub inline fn initArray(array: Array) ColorHdr {
return @bitCast(array);
}
pub inline fn asArray(self: ColorHdr) Array {
return @bitCast(self);
}
pub fn format(self: ColorHdr, w: *std.io.Writer) !void {
try w.print("ColorHdr[{d}, {d}, {d}, {d}]", .{ self.r, self.g, self.b, self.a });
}
};

View File

@@ -3,6 +3,7 @@ const std = @import("std");
// --- COLORS ------------------------------------------------------------------
pub const Color = @import("colors/Color.zig").Color;
pub const ColorHdr = @import("colors/ColorHdr.zig").ColorHdr;
// --- MATRICES ----------------------------------------------------------------