Skip to content

Commit 543dc7b

Browse files
authored
Merge pull request #57 from Interrupt/features/images-as-values
During texture creation, images are now passed as values and not pointers
2 parents d5cd402 + 6239a79 commit 543dc7b

14 files changed

Lines changed: 18 additions & 18 deletions

src/examples/debugdraw.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ fn on_init() !void {
5656
debug.log("Could not load test texture", .{});
5757
return;
5858
};
59-
texture = graphics.Texture.init(&test_image);
59+
texture = graphics.Texture.init(test_image);
6060

6161
graphics.setClearColor(colors.examples_bg_dark);
6262
}

src/examples/easing.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn on_init() !void {
6464
debug.log("Could not load test texture", .{});
6565
return;
6666
};
67-
texture = graphics.Texture.init(&test_image);
67+
texture = graphics.Texture.init(test_image);
6868
}
6969

7070
fn on_tick(delta: f32) void {

src/examples/forest.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ fn on_init() !void {
189189
return;
190190
};
191191

192-
tex_treesheet = graphics.Texture.init(&treesheet_img);
192+
tex_treesheet = graphics.Texture.init(treesheet_img);
193193

194194
// make our default shader
195195
shader_blend = try graphics.Shader.initDefault(.{ .blend_mode = .NONE, .cull_mode = .NONE });

src/examples/framepacing.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn on_init() !void {
7474
debug.log("Could not load test texture", .{});
7575
return;
7676
};
77-
texture = graphics.Texture.init(&test_image);
77+
texture = graphics.Texture.init(test_image);
7878
}
7979

8080
fn on_tick(delta: f32) void {

src/examples/lighting.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn on_init() !void {
9090

9191
var base_img: images.Image = try images.loadFile(mesh_texture_file);
9292
defer base_img.deinit();
93-
const tex_base = graphics.Texture.init(&base_img);
93+
const tex_base = graphics.Texture.init(base_img);
9494

9595
// Create a material out of our shader and textures
9696
skinned_mesh_material = try delve.platform.graphics.Material.init(.{

src/examples/meshbuilder.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn on_init() !void {
4949
return;
5050
};
5151
defer img.deinit();
52-
const tex = graphics.Texture.init(&img);
52+
const tex = graphics.Texture.init(img);
5353

5454
const shader = try graphics.Shader.initFromBuiltin(.{ .vertex_attributes = delve.graphics.mesh.getShaderAttributes() }, delve.shaders.default_mesh);
5555

src/examples/meshes.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn on_init() !void {
7878
return;
7979
};
8080
defer base_img.deinit();
81-
const tex_base = graphics.Texture.init(&base_img);
81+
const tex_base = graphics.Texture.init(base_img);
8282

8383
// Load the emissive texture for the mesh
8484
const emissive_texture_file = "assets/meshes/SciFiHelmet_Emissive_512.png";
@@ -87,7 +87,7 @@ fn on_init() !void {
8787
return;
8888
};
8989
defer emissive_img.deinit();
90-
const tex_emissive = graphics.Texture.init(&emissive_img);
90+
const tex_emissive = graphics.Texture.init(emissive_img);
9191

9292
// Make our emissive shader from one that is pre-compiled
9393
shader = try graphics.Shader.initFromBuiltin(.{ .vertex_attributes = mesh.getShaderAttributes() }, emissive_shader_builtin);

src/examples/passes.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ pub fn on_init() !void {
6363
return;
6464
};
6565
defer img.deinit();
66-
const tex = graphics.Texture.init(&img);
66+
const tex = graphics.Texture.init(img);
6767

6868
// Create our offscreen passes
6969
offscreen_pass = graphics.RenderPass.init(.{ .width = 1024, .height = 768 });
7070
offscreen_pass_2 = graphics.RenderPass.init(.{ .width = 640, .height = 480 });
7171

72-
shader = delve.platform.graphics.Shader.initFromBuiltin(.{ .vertex_attributes = delve.graphics.mesh.getShaderAttributes() }, delve.shaders.default_mesh).?;
72+
shader = try delve.platform.graphics.Shader.initFromBuiltin(.{ .vertex_attributes = delve.graphics.mesh.getShaderAttributes() }, delve.shaders.default_mesh);
7373

7474
// Create a material out of the texture
7575
material1 = try graphics.Material.init(.{

src/examples/quakemap.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ pub fn on_init() !void {
192192
continue;
193193
};
194194
defer tex_img.deinit();
195-
const tex = graphics.Texture.init(&tex_img);
195+
const tex = graphics.Texture.init(tex_img);
196196

197197
const mat = try graphics.Material.init(.{
198198
.shader = shader,

src/examples/skinned-meshes.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn on_init() !void {
8686
};
8787
defer base_img.deinit();
8888

89-
const tex_base = graphics.Texture.init(&base_img);
89+
const tex_base = graphics.Texture.init(base_img);
9090

9191
// Create a material out of our shader and textures
9292
material = try delve.platform.graphics.Material.init(.{

0 commit comments

Comments
 (0)