Load and convert skybox to cubemap
This commit is contained in:
@@ -16,6 +16,7 @@ const Materials = @import("assets/Materials.zig");
|
||||
const Matrix4x4 = math.Matrix4x4;
|
||||
const Player = @import("Player.zig");
|
||||
const Quaternion = math.Quaternion;
|
||||
const Skybox = @import("engine/Skybox.zig");
|
||||
const StagingBuffer = @import("engine/StagingBuffer.zig");
|
||||
const Swapchain = @import("engine/Swapchain.zig");
|
||||
const Textures = @import("assets/Textures.zig");
|
||||
@@ -48,6 +49,7 @@ blocks: Blocks,
|
||||
materials: Materials,
|
||||
textures: Textures,
|
||||
chunks: std.AutoHashMapUnmanaged([3]i16, Chunk),
|
||||
skybox: Skybox,
|
||||
|
||||
player: Player,
|
||||
|
||||
@@ -616,6 +618,9 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
.elements = directional_lights_data,
|
||||
});
|
||||
|
||||
var skybox = try Skybox.load("skybox.hdr", engine, 512, allocator);
|
||||
errdefer skybox.deinit(engine);
|
||||
|
||||
return .{
|
||||
.allocator = allocator,
|
||||
.engine = engine,
|
||||
@@ -642,6 +647,7 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
|
||||
.materials = materials,
|
||||
.textures = textures,
|
||||
.chunks = chunks,
|
||||
.skybox = skybox,
|
||||
|
||||
.player = .init(player_position, 0, 0),
|
||||
};
|
||||
@@ -658,6 +664,7 @@ pub fn deinit(self: *Game) void {
|
||||
chunk.deinit(self.engine, self.descriptor_pool);
|
||||
}
|
||||
self.chunks.deinit(self.allocator);
|
||||
self.skybox.deinit(self.engine);
|
||||
|
||||
self.global_uniforms.deinit(self.engine);
|
||||
self.global_uniforms_staging_buffer.deinit(self.engine);
|
||||
|
||||
Reference in New Issue
Block a user