diff --git a/src/examples/debugdraw.zig b/src/examples/debugdraw.zig index b12d4dca..11ac4eca 100644 --- a/src/examples/debugdraw.zig +++ b/src/examples/debugdraw.zig @@ -56,7 +56,7 @@ fn on_init() !void { debug.log("Could not load test texture", .{}); return; }; - texture = graphics.Texture.init(&test_image); + texture = graphics.Texture.init(test_image); graphics.setClearColor(colors.examples_bg_dark); } diff --git a/src/examples/easing.zig b/src/examples/easing.zig index 5e835c24..d904c4a9 100644 --- a/src/examples/easing.zig +++ b/src/examples/easing.zig @@ -64,7 +64,7 @@ fn on_init() !void { debug.log("Could not load test texture", .{}); return; }; - texture = graphics.Texture.init(&test_image); + texture = graphics.Texture.init(test_image); } fn on_tick(delta: f32) void { diff --git a/src/examples/forest.zig b/src/examples/forest.zig index 444c0627..a3c94271 100644 --- a/src/examples/forest.zig +++ b/src/examples/forest.zig @@ -189,7 +189,7 @@ fn on_init() !void { return; }; - tex_treesheet = graphics.Texture.init(&treesheet_img); + tex_treesheet = graphics.Texture.init(treesheet_img); // make our default shader shader_blend = try graphics.Shader.initDefault(.{ .blend_mode = .NONE, .cull_mode = .NONE }); diff --git a/src/examples/framepacing.zig b/src/examples/framepacing.zig index 8983bc97..210a7e54 100644 --- a/src/examples/framepacing.zig +++ b/src/examples/framepacing.zig @@ -74,7 +74,7 @@ fn on_init() !void { debug.log("Could not load test texture", .{}); return; }; - texture = graphics.Texture.init(&test_image); + texture = graphics.Texture.init(test_image); } fn on_tick(delta: f32) void { diff --git a/src/examples/lighting.zig b/src/examples/lighting.zig index d12b8852..5bbb5767 100644 --- a/src/examples/lighting.zig +++ b/src/examples/lighting.zig @@ -90,7 +90,7 @@ fn on_init() !void { var base_img: images.Image = try images.loadFile(mesh_texture_file); defer base_img.deinit(); - const tex_base = graphics.Texture.init(&base_img); + const tex_base = graphics.Texture.init(base_img); // Create a material out of our shader and textures skinned_mesh_material = try delve.platform.graphics.Material.init(.{ diff --git a/src/examples/meshbuilder.zig b/src/examples/meshbuilder.zig index 3a242894..3d993ef2 100644 --- a/src/examples/meshbuilder.zig +++ b/src/examples/meshbuilder.zig @@ -49,7 +49,7 @@ pub fn on_init() !void { return; }; defer img.deinit(); - const tex = graphics.Texture.init(&img); + const tex = graphics.Texture.init(img); const shader = try graphics.Shader.initFromBuiltin(.{ .vertex_attributes = delve.graphics.mesh.getShaderAttributes() }, delve.shaders.default_mesh); diff --git a/src/examples/meshes.zig b/src/examples/meshes.zig index 53184736..a6de8ace 100644 --- a/src/examples/meshes.zig +++ b/src/examples/meshes.zig @@ -78,7 +78,7 @@ fn on_init() !void { return; }; defer base_img.deinit(); - const tex_base = graphics.Texture.init(&base_img); + const tex_base = graphics.Texture.init(base_img); // Load the emissive texture for the mesh const emissive_texture_file = "assets/meshes/SciFiHelmet_Emissive_512.png"; @@ -87,7 +87,7 @@ fn on_init() !void { return; }; defer emissive_img.deinit(); - const tex_emissive = graphics.Texture.init(&emissive_img); + const tex_emissive = graphics.Texture.init(emissive_img); // Make our emissive shader from one that is pre-compiled shader = try graphics.Shader.initFromBuiltin(.{ .vertex_attributes = mesh.getShaderAttributes() }, emissive_shader_builtin); diff --git a/src/examples/passes.zig b/src/examples/passes.zig index f096f5ff..b4319717 100644 --- a/src/examples/passes.zig +++ b/src/examples/passes.zig @@ -63,13 +63,13 @@ pub fn on_init() !void { return; }; defer img.deinit(); - const tex = graphics.Texture.init(&img); + const tex = graphics.Texture.init(img); // Create our offscreen passes offscreen_pass = graphics.RenderPass.init(.{ .width = 1024, .height = 768 }); offscreen_pass_2 = graphics.RenderPass.init(.{ .width = 640, .height = 480 }); - shader = delve.platform.graphics.Shader.initFromBuiltin(.{ .vertex_attributes = delve.graphics.mesh.getShaderAttributes() }, delve.shaders.default_mesh).?; + shader = try delve.platform.graphics.Shader.initFromBuiltin(.{ .vertex_attributes = delve.graphics.mesh.getShaderAttributes() }, delve.shaders.default_mesh); // Create a material out of the texture material1 = try graphics.Material.init(.{ diff --git a/src/examples/quakemap.zig b/src/examples/quakemap.zig index b85a2675..8b06e98e 100644 --- a/src/examples/quakemap.zig +++ b/src/examples/quakemap.zig @@ -192,7 +192,7 @@ pub fn on_init() !void { continue; }; defer tex_img.deinit(); - const tex = graphics.Texture.init(&tex_img); + const tex = graphics.Texture.init(tex_img); const mat = try graphics.Material.init(.{ .shader = shader, diff --git a/src/examples/skinned-meshes.zig b/src/examples/skinned-meshes.zig index 2a721d7c..70db488a 100644 --- a/src/examples/skinned-meshes.zig +++ b/src/examples/skinned-meshes.zig @@ -86,7 +86,7 @@ fn on_init() !void { }; defer base_img.deinit(); - const tex_base = graphics.Texture.init(&base_img); + const tex_base = graphics.Texture.init(base_img); // Create a material out of our shader and textures material = try delve.platform.graphics.Material.init(.{ diff --git a/src/examples/sprite-animation.zig b/src/examples/sprite-animation.zig index 1bc4d78d..930d7906 100644 --- a/src/examples/sprite-animation.zig +++ b/src/examples/sprite-animation.zig @@ -61,7 +61,7 @@ fn on_init() !void { defer spritesheet_image.deinit(); // make the texture to draw - sprite_texture = graphics.Texture.init(&spritesheet_image); + sprite_texture = graphics.Texture.init(spritesheet_image); // Load the default shader, but from a Yaml description file! const loaded_shader = try delve.graphics.shaders.loadFromYaml(.{}, "assets/shaders/built/default/default_reflection.yaml"); diff --git a/src/examples/sprites.zig b/src/examples/sprites.zig index 44190ab1..c0df37ea 100644 --- a/src/examples/sprites.zig +++ b/src/examples/sprites.zig @@ -87,8 +87,8 @@ fn on_init() !void { defer test_image_2.deinit(); // make some textures from our images - texture_1 = graphics.Texture.init(&test_image_1); - texture_2 = graphics.Texture.init(&test_image_2); + texture_1 = graphics.Texture.init(test_image_1); + texture_2 = graphics.Texture.init(test_image_2); // make some shaders for testing shader_opaque = try graphics.Shader.initDefault(.{}); diff --git a/src/framework/api/assets.zig b/src/framework/api/assets.zig index c743823c..69a6d82b 100644 --- a/src/framework/api/assets.zig +++ b/src/framework/api/assets.zig @@ -39,7 +39,7 @@ pub fn get_texture(filename: [*:0]const u8) i64 { const filename_len = filename_idx; debug.log("Assets: Loading Image: {s}...", .{filename}); - var new_img: images.Image = images.loadFile(filename[0..filename_len :0]) catch { + const new_img: images.Image = images.loadFile(filename[0..filename_len :0]) catch { debug.log("Assets: Error loading image asset: {s}", .{filename}); return -1; }; @@ -55,7 +55,7 @@ pub fn get_texture(filename: [*:0]const u8) i64 { return -1; }; - const texture = graphics.Texture.init(&new_img); + const texture = graphics.Texture.init(new_img); texture_handles.put(new_handle, texture) catch { debug.log("Assets: Error caching loaded texture!", .{}); return -1; diff --git a/src/framework/platform/graphics.zig b/src/framework/platform/graphics.zig index 3658809a..0fec88cb 100644 --- a/src/framework/platform/graphics.zig +++ b/src/framework/platform/graphics.zig @@ -447,7 +447,7 @@ pub const Texture = struct { sokol_image: ?sg.Image, /// Creates a new texture from an Image - pub fn init(image: *images.Image) Texture { + pub fn init(image: images.Image) Texture { defer next_texture_handle += 1; var img_desc: sg.ImageDesc = .{