From e014c4a063b05f7e417b4fd593a4f7033b0e4a9f Mon Sep 17 00:00:00 2001 From: tslil clingman <> Date: Sun, 10 Oct 2021 21:01:14 -0400 Subject: Untested first mock up of polygon intersection in square --- src/level.zig | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/level.zig') diff --git a/src/level.zig b/src/level.zig index a5d7330..dce2a14 100644 --- a/src/level.zig +++ b/src/level.zig @@ -18,26 +18,33 @@ const std = @import("std"); pub const Object = struct { - height : f32, - width : f32, - texture : u8, - pos_x : f32, - pos_y : f32, - pos_z : f32 = 0, + height: f32, + width: f32, + texture: u8, + pos_x: f32, + pos_y: f32, + pos_z: f32 = 0, }; pub const Cell = struct { floor_height: f32 = 0, - ceiling_height : f32 = DEFAULT_HEIGHT, + ceiling_height: f32 = DEFAULT_HEIGHT, draw_down: bool = false, lower_texture: u8 = 0, upper_texture: u8 = 0, floor_texture: u8 = 0, ceiling_texture: u8 = 2, - pub const floor = Cell{ }; + vertices: [][2]f32 = [][2]f32{ + .{ 0, 0 }, + .{ 1, 0 }, + .{ 1, 1 }, + .{ 0, 1 }, + }, - pub const DEFAULT_HEIGHT : f32 = 4; + pub const floor = Cell{}; + + pub const DEFAULT_HEIGHT: f32 = 4; }; pub const Map = struct { -- cgit v1.3.1