material.zig (778B)
1 const std = @import("std"); 2 const gpu = @import("mach_gpu"); 3 const Textures = @import("textures.zig"); 4 5 albedo: u32, 6 normal: u32, 7 roughness: u32, 8 metalness: u32, 9 10 const Self = @This(); 11 12 pub fn init( 13 textures: *Textures, 14 albedo_path: []const u8, 15 normal_path: []const u8, 16 roughness_path: []const u8, 17 metalness_path: []const u8, 18 queue: *gpu.Queue, 19 ) !Self { 20 const albedo = try textures.loadFile(albedo_path, queue); 21 const normal = try textures.loadFile(normal_path, queue); 22 const roughness = try textures.loadFile(roughness_path, queue); 23 const metalness = try textures.loadFile(metalness_path, queue); 24 return .{ 25 .albedo = albedo, 26 .normal = normal, 27 .roughness = roughness, 28 .metalness = metalness, 29 }; 30 }