Minor refactors and cleanups
This commit is contained in:
18
src/Game.zig
18
src/Game.zig
@@ -151,8 +151,6 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
var blocks = try Blocks.init(allocator);
|
||||
errdefer blocks.deinit(allocator);
|
||||
|
||||
blocks.loadAll(engine, &materials, &textures, allocator);
|
||||
|
||||
const sampler = try engine.createSampler(.{
|
||||
.mag_filter = .linear,
|
||||
.min_filter = .linear,
|
||||
@@ -510,6 +508,13 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
});
|
||||
engine.setObjectName(global_descriptor_set, "DS Global", .{});
|
||||
|
||||
const block_grass = try blocks.getOrLoadFilename(engine, &materials, &textures, "Grass.json", allocator);
|
||||
const block_dirt = try blocks.getOrLoadFilename(engine, &materials, &textures, "Dirt.json", allocator);
|
||||
const block_stone = try blocks.getOrLoadFilename(engine, &materials, &textures, "Stone.json", allocator);
|
||||
const block_bedrock = try blocks.getOrLoadFilename(engine, &materials, &textures, "Bedrock.json", allocator);
|
||||
|
||||
// VOLATILE Load all assets before this point
|
||||
|
||||
const descriptor_images = try allocator.alloc(vk.DescriptorImageInfo, textures.textures.items.len);
|
||||
for (textures.textures.items, descriptor_images) |texture, *info| {
|
||||
info.* = .{
|
||||
@@ -603,12 +608,7 @@ 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(-10, -10, 9, 9);
|
||||
|
||||
const block_grass = blocks.getFilename("Grass.json").?;
|
||||
const block_dirt = blocks.getFilename("Dirt.json").?;
|
||||
const block_stone = blocks.getFilename("Stone.json").?;
|
||||
const block_bedrock = blocks.getFilename("Bedrock.json").?;
|
||||
var it = Interator2(i16).init(-8, -8, 7, 7);
|
||||
|
||||
while (it.next()) |chunk_coords2| {
|
||||
const chunk_coords3 = chunk_coords2 ++ [_]i16{0};
|
||||
@@ -729,7 +729,7 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Game) void {
|
||||
std.log.debug("Deinitializing {*}", .{self});
|
||||
std.log.scoped(.deinit).debug("Deinitializing {*}", .{self});
|
||||
|
||||
self.vertex_buffer.deinit(self.engine);
|
||||
self.index_buffer.deinit(self.engine);
|
||||
|
||||
Reference in New Issue
Block a user