diff options
| author | s-ol <s+removethis@s-ol.nu> | 2026-04-10 17:08:15 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2026-04-10 22:22:45 +0000 |
| commit | 5d3f9aef90bed7713ce07614fdd154d50223ba61 (patch) | |
| tree | c6cfdc75e645773de14bf4cad8bbb89f60f267d6 /src/source.zig | |
| parent | more TSV logging (diff) | |
| download | glsl-view-5d3f9aef90bed7713ce07614fdd154d50223ba61.tar.gz glsl-view-5d3f9aef90bed7713ce07614fdd154d50223ba61.zip | |
support arrays of uniforms, remove finished sources
Diffstat (limited to 'src/source.zig')
| -rw-r--r-- | src/source.zig | 9 |
1 files changed, 9 insertions, 0 deletions
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); |
