media: fix compilation errors, HDR loading; vecmath: ColorHdr
This commit is contained in:
30
packages/vecmath/src/colors/ColorHdr.zig
Normal file
30
packages/vecmath/src/colors/ColorHdr.zig
Normal 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 });
|
||||
}
|
||||
};
|
||||
@@ -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 ----------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user