renderer-mvp/asset-pipeline #53

Merged
kayomn merged 6 commits from renderer-mvp/asset-pipeline into main 2024-06-23 04:37:40 +02:00
2 changed files with 8 additions and 4 deletions
Showing only changes of commit f0cc66edfa - Show all commits

View File

@ -24,7 +24,7 @@ pub fn main() !void {
fn load(display: coral.Write(ona.gfx.Display), actors: coral.Write(Actors), assets: coral.Write(ona.gfx.Assets)) !void {
display.res.width, display.res.height = .{1280, 720};
actors.res.body_texture = try assets.res.open_file("actor.bmp");
actors.res.body_texture = try assets.res.open_file(coral.files.bundle, "actor.bmp");
actors.res.quad_mesh_2d = try assets.res.open_quad_mesh_2d(@splat(1));
try actors.res.instances.push_grow(.{0, 0});

View File

@ -4,8 +4,12 @@ const gfx = @import("../gfx.zig");
const std = @import("std");
pub fn bmp_file_desc(arena: *std.heap.ArenaAllocator, path: []const u8) gfx.Assets.Format.Error!gfx.Desc {
const header = try coral.files.bundle.read_little(path, 0, extern struct {
pub fn bmp_file_desc(
arena: *std.heap.ArenaAllocator,
storage: coral.files.Storage,
path: []const u8,
) gfx.Assets.Format.Error!gfx.Desc {
const header = try storage.read_little(path, 0, extern struct {
type: [2]u8 align (1),
file_size: u32 align (1),
reserved: [2]u16 align (1),
@ -47,7 +51,7 @@ pub fn bmp_file_desc(arena: *std.heap.ArenaAllocator, path: []const u8) gfx.Asse
while (buffer_offset < pixels.len) {
const line = pixels[buffer_offset .. buffer_offset + byte_stride];
if (try coral.files.bundle.read_bytes(path, file_offset, line) != byte_stride) {
if (try storage.read_bytes(path, file_offset, line) != byte_stride) {
return error.FormatUnsupported;
}