2022-07-23 10:00:45 +00:00
|
|
|
const vk = @import("vulkan");
|
|
|
|
const UUID = @import("../common/uuid.zig").UUID;
|
|
|
|
|
2022-07-27 06:36:09 +00:00
|
|
|
const RefTable = @import("../containers/table.zig").RefTable;
|
2022-07-23 10:00:45 +00:00
|
|
|
const Vec2i = @import("../math/vec.zig").Vec2i;
|
|
|
|
|
2022-07-27 06:36:09 +00:00
|
|
|
const TTable = RefTable(UUID, Texture);
|
2022-07-23 10:00:45 +00:00
|
|
|
var s_table: TTable = undefined;
|
|
|
|
|
|
|
|
pub fn init() void {
|
|
|
|
s_table = TTable.init();
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn update() void {}
|
|
|
|
|
|
|
|
pub fn deinit() void {}
|
|
|
|
|
|
|
|
pub fn getTable() *const TTable {
|
|
|
|
return &s_table;
|
|
|
|
}
|
|
|
|
|
|
|
|
pub const Texture = packed struct {
|
|
|
|
const Self = @This();
|
|
|
|
|
2022-07-26 10:00:39 +00:00
|
|
|
pub const Id = TTable.Id;
|
|
|
|
|
2022-07-23 10:00:45 +00:00
|
|
|
const PalRow = enum {
|
|
|
|
white,
|
|
|
|
brown,
|
|
|
|
light_blue,
|
|
|
|
green,
|
|
|
|
red,
|
|
|
|
orange,
|
|
|
|
gold,
|
|
|
|
peach,
|
|
|
|
purple,
|
|
|
|
magenta,
|
|
|
|
tan,
|
|
|
|
light_green,
|
|
|
|
yellow,
|
|
|
|
blue,
|
|
|
|
fire,
|
|
|
|
brights,
|
|
|
|
|
|
|
|
pub const count = @enumToInt(PalRow.brights);
|
|
|
|
};
|
|
|
|
|
|
|
|
size: Vec2i,
|
|
|
|
texels: [*]u8,
|
|
|
|
format: vk.Format,
|
|
|
|
slot: Id,
|
|
|
|
|
2022-07-26 10:00:39 +00:00
|
|
|
pub fn get(id: Id) ?*const Self {
|
2022-07-27 06:36:09 +00:00
|
|
|
return s_table.getPtr(id);
|
2022-07-23 10:00:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn isCurrent(id: Id) bool {
|
|
|
|
return s_table.exists(id);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
pub const DiskTexture = packed struct {
|
|
|
|
version: i32,
|
|
|
|
format: vk.Format,
|
|
|
|
name: []u8,
|
|
|
|
size: Vec2i,
|
|
|
|
};
|