More wrappers, more cleanup
This commit is contained in:
34
src/Game.zig
34
src/Game.zig
@@ -1,30 +1,28 @@
|
||||
const Game = @This();
|
||||
const std = @import("std");
|
||||
|
||||
const math = @import("math.zig");
|
||||
const glfw = @import("zglfw");
|
||||
const vk = @import("vulkan");
|
||||
|
||||
const math = @import("math.zig");
|
||||
const worldgen = @import("worldgen.zig");
|
||||
|
||||
const Blocks = @import("assets/Blocks.zig");
|
||||
const Chunk = @import("assets/Chunk.zig");
|
||||
const Materials = @import("assets/Materials.zig");
|
||||
const Textures = @import("assets/Textures.zig");
|
||||
const CommandBuffer = @import("engine/CommandBuffer.zig").CommandBuffer;
|
||||
const CommandBuffer = @import("engine/CommandBuffer.zig");
|
||||
const Engine = @import("engine/Engine.zig");
|
||||
const GenericBuffer = @import("engine/GenericBuffer.zig").GenericBuffer;
|
||||
const Iterator2 = math.Iterator2;
|
||||
const Materials = @import("assets/Materials.zig");
|
||||
const Matrix4x4 = math.Matrix4x4;
|
||||
const Player = @import("Player.zig");
|
||||
const Quaternion = math.Quaternion;
|
||||
const StagingBuffer = @import("engine/StagingBuffer.zig");
|
||||
const Swapchain = @import("engine/Swapchain.zig");
|
||||
const Player = @import("Player.zig");
|
||||
const Interator2 = math.Interator2;
|
||||
const Matrix4x4 = math.Matrix4x4;
|
||||
const Quaternion = math.Quaternion;
|
||||
const Textures = @import("assets/Textures.zig");
|
||||
const Vector2 = math.Vector2;
|
||||
const Vector2x8 = math.Vector2x8;
|
||||
const Vector3 = math.Vector3;
|
||||
const Vector4 = math.Vector4;
|
||||
const ps = math.ps;
|
||||
|
||||
const PointLight = extern struct {
|
||||
positionWS: [3]f32,
|
||||
@@ -121,7 +119,7 @@ index_buffer: IndexBuffer,
|
||||
|
||||
global_uniforms: GlobalUniformsBuffer,
|
||||
global_uniforms_staging_buffer: StagingBuffer,
|
||||
global_uniforms_transfer_command_buffer: CommandBuffer(.transfer, .persistent),
|
||||
global_uniforms_transfer_command_buffer: CommandBuffer,
|
||||
global_uniforms_transfer_semaphores: []vk.Semaphore,
|
||||
point_lights: PointLightBuffer,
|
||||
directional_lights: DirectionalLightBuffer,
|
||||
@@ -305,10 +303,10 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
});
|
||||
errdefer global_uniforms_staging_buffer.deinit(engine);
|
||||
|
||||
var global_uniforms_transfer_command_buffer: CommandBuffer(.transfer, .persistent) = try .init(engine);
|
||||
var global_uniforms_transfer_command_buffer: CommandBuffer = try .init(engine, .transfer, .persistent);
|
||||
errdefer global_uniforms_transfer_command_buffer.deinit(engine);
|
||||
|
||||
try global_uniforms_transfer_command_buffer.beginCommandBuffer(.{});
|
||||
try global_uniforms_transfer_command_buffer.beginCommandBuffer();
|
||||
global_uniforms_transfer_command_buffer.copyBuffer(
|
||||
global_uniforms_staging_buffer.buffer,
|
||||
global_uniforms.buffer,
|
||||
@@ -608,8 +606,10 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
|
||||
const world_seed = engine.random.int(u64);
|
||||
std.log.info("Using world seed 0x{x:0<16}", .{world_seed});
|
||||
var it = Interator2(i16).init(-8, -8, 7, 7);
|
||||
|
||||
var it = Iterator2(i16).init(.{
|
||||
.min = .{ -8, -8 },
|
||||
.max = .{ 7, 7 },
|
||||
});
|
||||
while (it.next()) |chunk_coords2| {
|
||||
const chunk_coords3 = chunk_coords2 ++ [_]i16{0};
|
||||
|
||||
@@ -852,10 +852,10 @@ fn render(self: *Game) !void {
|
||||
|
||||
const extent = self.swapchain.extent;
|
||||
|
||||
const command_buffer: CommandBuffer(.graphics, .transient) = try .init(self.engine);
|
||||
const command_buffer: CommandBuffer = try .init(self.engine, .graphics, .transient);
|
||||
// NOTE Do not free command buffer yet
|
||||
|
||||
try command_buffer.beginCommandBuffer(.{});
|
||||
try command_buffer.beginCommandBuffer();
|
||||
{
|
||||
command_buffer.beginRenderPass(.{
|
||||
.render_pass = self.swapchain.render_pass,
|
||||
|
||||
Reference in New Issue
Block a user