Make use of some globals to stop typing engine everywhere.

This commit is contained in:
2026-05-15 02:20:08 +02:00
parent 36434f8107
commit ad80fb4fd9
21 changed files with 902 additions and 798 deletions

View File

@@ -253,11 +253,9 @@ pub fn onMouseDown(self: *Player, button: glfw.MouseButton, game: *Game) void {
game.chunks.setVoxelAt(
raycast_hit.voxel,
.air,
game.engine,
&game.blocks,
game.descriptor_pool,
game.per_batch_descriptor_set_layout,
game.allocator,
) catch |err| {
std.log.err("Error while destroying voxel {f}: {}", .{ raycast_hit.voxel, err });
};
@@ -265,13 +263,10 @@ pub fn onMouseDown(self: *Player, button: glfw.MouseButton, game: *Game) void {
.right => blk: {
const target_vx = raycast_hit.voxel.add(raycast_hit.side.getSignVector());
const id = game.blocks.getOrLoad(
game.engine,
&game.materials,
&game.textures,
&game.stbi,
blocks[self.block_index],
game.allocator,
game.io,
) catch |err| {
std.log.err("Error while placing voxel at {f}: {}", .{ target_vx, err });
break :blk;
@@ -279,11 +274,9 @@ pub fn onMouseDown(self: *Player, button: glfw.MouseButton, game: *Game) void {
game.chunks.setVoxelAt(
target_vx,
id,
game.engine,
&game.blocks,
game.descriptor_pool,
game.per_batch_descriptor_set_layout,
game.allocator,
) catch |err| {
std.log.err("Error while placing voxel at {f}: {}", .{ target_vx, err });
};