Trying to improve collisions and failing

This commit is contained in:
2025-12-19 01:36:50 +01:00
parent 04ae797196
commit 71015874a9
10 changed files with 805 additions and 254 deletions

View File

@@ -1,6 +1,6 @@
const std = @import("std");
const Vector2 = @import("math.zig").Vector2;
const Vector2Int = @import("math.zig").Vector2Int;
pub const app_name = "voxel-game";
pub const app_version_string = @import("config").version;
@@ -11,12 +11,33 @@ pub const max_frametime = 1.0 / min_framerate;
pub const default_window_width = 1280;
pub const default_window_height = 720;
pub const default_window_size = Vector2.init(default_window_width, default_window_height);
pub const default_window_size = Vector2Int.init(default_window_width, default_window_height);
pub const min_window_width = 640;
pub const min_window_height = 360;
pub const min_window_size = Vector2.init(default_window_width, default_window_height);
pub const min_window_size = Vector2Int.init(default_window_width, default_window_height);
pub const window_title = "Voxel Game";
pub const temp_allocator_capacity = 16 * 1024 * 1024;
// Coordinate spaces:
// - CS (clip space, as required by Vulkan)
// - VS (view space, looking towards +Y, +X is right and +Z is up)
// - WS (world space, origin at a corner of voxel (0, 0, 0), +Z is up)
// Units:
// - SV (subvoxel) |
// - VX (voxels) | 1 [VX] = 4096 [SV]
// - CK (chunks) | 1 [CK] = 16 [VX]
// Relative units:
// CKSV subvoxels relative to chunk | [0, 65536)
// CKVX voxels relative to chunk | [0, 16)
// VXSV subvoxels relative to voxel | [0, 4096)
pub const sv_per_vx = 4096;
pub const vx_per_ck = 16;
pub const sv_per_ck = sv_per_vx * vx_per_ck;
pub inline fn sv(comptime vx: comptime_float) comptime_int {
return @intFromFloat(@round(vx * sv_per_vx));
}