From 5d3f9aef90bed7713ce07614fdd154d50223ba61 Mon Sep 17 00:00:00 2001 From: s-ol Date: Fri, 10 Apr 2026 19:08:15 +0200 Subject: support arrays of uniforms, remove finished sources --- src/source.zig | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/source.zig') diff --git a/src/source.zig b/src/source.zig index 917e08a..6a3781c 100644 --- a/src/source.zig +++ b/src/source.zig @@ -6,6 +6,7 @@ const util = @import("util.zig"); pub const Source = struct { texture: gl.Texture, + update_fn: ?*const fn (self: *Source) anyerror!bool = null, deinit_fn: *const fn (self: *Source, allocator: std.mem.Allocator) void, register_fn: ?*const fn (self: *Source, name: []const u8, control: *ctrl.ControlServer) void = null, unregister_fn: ?*const fn (self: *Source, name: []const u8, control: *ctrl.ControlServer) void = null, @@ -27,6 +28,14 @@ pub const Source = struct { } } + pub fn update(self: *Source) bool { + if (self.update_fn) |update_fn| { + return update_fn(self) catch return true; + } + + return false; + } + pub fn updateUniform(self: *Source, param: []const u8, value: gl.UniformPointer) anyerror!void { if (self.update_uniform_fn) |update_uniform_fn| { try update_uniform_fn(self, param, value); -- cgit v1.2.3