added render_queue.zig, camera_render_queue.zig and draw_cmd.zig
This commit is contained in:
parent
29c94508cd
commit
c5b5991bbe
7 changed files with 97 additions and 2 deletions
|
|
@ -20,6 +20,7 @@ fn build(
|
|||
try ctx.app.resources.set(resource.Instance{});
|
||||
try ctx.app.resources.set(resource.Device{});
|
||||
try ctx.app.resources.set(resource.window{});
|
||||
try ctx.app.resources.set(resource.RenderQueue.init(ctx.app.alloc));
|
||||
|
||||
// --- INIT ---
|
||||
try ctx.app.schedules.addMany(App.stage.Init, &.{
|
||||
|
|
|
|||
34
src/resource/render_queue.zig
Normal file
34
src/resource/render_queue.zig
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
//! ----------------------------------------------------
|
||||
//! ----------------------------------------------------
|
||||
|
||||
const std = @import("std");
|
||||
const CameraRenderQueue = @import("../template/camera_render_queue.zig");
|
||||
const Self = @This();
|
||||
|
||||
//
|
||||
// FIELDS
|
||||
//
|
||||
|
||||
data: std.ArrayList(CameraRenderQueue),
|
||||
alloc: std.mem.Allocator,
|
||||
|
||||
/// ----------------------------------------------------
|
||||
/// ----------------------------------------------------
|
||||
pub fn init(alloc: std.mem.Allocator) Self {
|
||||
return .{
|
||||
.data = .empty,
|
||||
.alloc = alloc,
|
||||
};
|
||||
}
|
||||
|
||||
/// ----------------------------------------------------
|
||||
/// ----------------------------------------------------
|
||||
pub fn deinit(self: *Self) void {
|
||||
self.data.deinit(self.alloc);
|
||||
}
|
||||
|
||||
/// ----------------------------------------------------
|
||||
/// ----------------------------------------------------
|
||||
pub fn clear(self: *Self) void {
|
||||
self.data.clearRetainingCapacity();
|
||||
}
|
||||
|
|
@ -2,3 +2,6 @@
|
|||
pub const Instance = @import("instance.zig");
|
||||
pub const Device = @import("device.zig");
|
||||
pub const window = @import("window.zig");
|
||||
|
||||
// --- DRAW ---
|
||||
pub const RenderQueue = @import("render_queue.zig");
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
const std = @import("std");
|
||||
43
src/template/camera_render_queue.zig
Normal file
43
src/template/camera_render_queue.zig
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
//! ----------------------------------------------------
|
||||
//! ----------------------------------------------------
|
||||
|
||||
const std = @import("std");
|
||||
const DrawCMD = @import("draw_cmd.zig");
|
||||
const Self = @This();
|
||||
|
||||
//
|
||||
// FIELDS
|
||||
//
|
||||
|
||||
shadows: std.ArrayList(DrawCMD),
|
||||
opaques: std.ArrayList(DrawCMD),
|
||||
transparents: std.ArrayList(DrawCMD),
|
||||
alloc: std.mem.Allocator,
|
||||
|
||||
/// ----------------------------------------------------
|
||||
/// ----------------------------------------------------
|
||||
pub fn init(alloc: std.mem.Allocator) Self {
|
||||
return .{
|
||||
.shadows = .empty,
|
||||
.opaques = .empty,
|
||||
.transparents = .empty,
|
||||
.alloc = alloc,
|
||||
};
|
||||
}
|
||||
|
||||
/// ----------------------------------------------------
|
||||
/// ----------------------------------------------------
|
||||
pub fn deinit(self: *Self) void {
|
||||
self.shadows.deinit(self.alloc);
|
||||
self.opaques.deinit(self.alloc);
|
||||
self.transparents.deinit(self.alloc);
|
||||
}
|
||||
|
||||
/// ----------------------------------------------------
|
||||
/// ----------------------------------------------------
|
||||
pub fn clear(self: *Self) void {
|
||||
self.shadows.clearRetainingCapacity();
|
||||
self.opaques.clearRetainingCapacity();
|
||||
self.transparents.clearRetainingCapacity();
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
//! ----------------------------------------------------
|
||||
//! ----------------------------------------------------
|
||||
|
||||
const std = @import("std");
|
||||
const App = @import("app");
|
||||
const Handle = App.template.Handle;
|
||||
|
||||
//
|
||||
// FIELDS
|
||||
//
|
||||
|
||||
mesh: Handle(undefined),
|
||||
pipeline: Handle(undefined),
|
||||
bind_group: Handle(undefined),
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
pub const Registry = @import("registry.zig").Registry;
|
||||
pub const CameraPass = @import("camera_pass.zig");
|
||||
|
||||
pub const CameraRenderQueue = @import("camera_render_queue.zig");
|
||||
pub const DrawCMD = @import("draw_cmd.zig");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue