41 lines
1.1 KiB
Zig
41 lines
1.1 KiB
Zig
|
|
const App = @import("app");
|
||
|
|
const system = @import("system/root.zig");
|
||
|
|
const resource = @import("resource/root.zig");
|
||
|
|
|
||
|
|
/// ----------------------------------------------------
|
||
|
|
/// ----------------------------------------------------
|
||
|
|
pub const plugin: App.plugin.Plugin = .{
|
||
|
|
.name = "Renderer",
|
||
|
|
.description = "WebGPU Renderer",
|
||
|
|
.build = build,
|
||
|
|
};
|
||
|
|
|
||
|
|
/// ----------------------------------------------------
|
||
|
|
/// ----------------------------------------------------
|
||
|
|
fn build(
|
||
|
|
_: *App.plugin.Plugin,
|
||
|
|
ctx: App.plugin.Context,
|
||
|
|
) !void {
|
||
|
|
// --- RESOURCES ---
|
||
|
|
try ctx.app.resources.set(resource.Instance{});
|
||
|
|
try ctx.app.resources.set(resource.Device{});
|
||
|
|
try ctx.app.resources.set(resource.window{});
|
||
|
|
|
||
|
|
// --- INIT ---
|
||
|
|
try ctx.app.schedules.addMany(App.stage.Init, &.{
|
||
|
|
system.instance.init,
|
||
|
|
system.window.init,
|
||
|
|
system.device.init,
|
||
|
|
});
|
||
|
|
|
||
|
|
// --- DEINIT ---
|
||
|
|
try ctx.app.schedules.addMany(App.stage.Deinit, &.{
|
||
|
|
system.device.deinit,
|
||
|
|
system.window.deinit,
|
||
|
|
system.instance.deinit,
|
||
|
|
});
|
||
|
|
|
||
|
|
// --- INPUT ---
|
||
|
|
try ctx.app.schedules.addMany(App.stage.Inputs, &.{});
|
||
|
|
}
|