diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-03-20 17:37:42 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-03-20 17:37:42 +0000 |
| commit | 13019304a68bf6191c0a3ba6ae5e1cab0155de8a (patch) | |
| tree | 0b9f0687a55bc4482990bfa77bea38ff2d383ff1 | |
| parent | lib: add ad, decay to link-time (diff) | |
| download | alive-13019304a68bf6191c0a3ba6ae5e1cab0155de8a.tar.gz alive-13019304a68bf6191c0a3ba6ae5e1cab0155de8a.zip | |
lib: separate glsl-view video/tsv-input ops
| -rw-r--r-- | alv-lib/glsl-view.moon | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/alv-lib/glsl-view.moon b/alv-lib/glsl-view.moon index 4b859b3..4c27be0 100644 --- a/alv-lib/glsl-view.moon +++ b/alv-lib/glsl-view.moon @@ -47,14 +47,11 @@ uniform = Constant.meta tick: => @out\set @unwrap_all! -texture = Constant.meta +video = Constant.meta meta: - name: 'texture' - summary: "override uniform binding type." - examples: { '(texture [socket] name filename [type])' } - description: "Generates a struct as received by [shader][]: - -`(uniform 'sampler2D' 'image.png')` is equivalent to `{'type' 'sampler2d' 'val' 'image.png'}`." + name: 'video' + summary: "load a video texture source." + examples: { '(video [socket] name filename [type])' } value: class extends Op pattern = -sig['osc/out'] + const.str + const.str + -const.str @@ -74,13 +71,38 @@ texture = Constant.meta { :socket, :name, :type, :filename } = @unwrap_all! with @inputs.socket! - \send Message.pack { address: "/texture/#{name}", types: "ss", "TEXTURE_#{type}", filename } + \send Message.pack { address: "/texture/#{name}/video", types: "ss", "TEXTURE_#{type}", filename } -- destroy: => -- name = @inputs.name! -- with @inputs.socket! -- \send Message.pack { address: "/texture/#{name}/destroy", types: "" } +tsv_input = Constant.meta + meta: + name: 'tsv-input' + summary: "load a texture-share-vk texture source." + examples: { '(texture [socket] name [type])' } + + value: class extends Op + pattern = -sig['osc/out'] + const.str + -const.str + setup: (inputs, scope) => + { socket, name, type } = pattern\match inputs + + super + socket: Input.hot socket or scope\get '*oscout*' + name: Input.hot name + type: Input.hot type or Constant.str "2D" + + samplertype = assert GLSL_SAMPLER_TYPES[@inputs.type!] + @setup_out '=', (Struct type: T.str, val: T.str), type: samplertype, val: @inputs.name! + + tick: => + { :socket, :name, :type } = @unwrap_all! + + with @inputs.socket! + \send Message.pack { address: "/texture/#{name}/tsv", types: "ss", "TEXTURE_#{type}", name } + shader = Constant.meta meta: name: 'shader' @@ -168,6 +190,7 @@ Constant.meta summary: "glsl-view integration via OSC." value: - :uniform + :video + 'tsv-input': tsv_input :texture :shader |
