diff options
| author | s-ol <s+removethis@s-ol.nu> | 2025-09-22 15:41:55 +0000 |
|---|---|---|
| committer | s-ol <s+removethis@s-ol.nu> | 2025-09-22 15:41:55 +0000 |
| commit | 5e09bd7d0801c44cff80df8755751aa0ef748eb9 (patch) | |
| tree | 9fea18b18248895caa04a1a74531ad25238b5d43 /alv-lib | |
| parent | lib/love: tsv-output preserves canvas unless name/size changed (diff) | |
| download | alive-5e09bd7d0801c44cff80df8755751aa0ef748eb9.tar.gz alive-5e09bd7d0801c44cff80df8755751aa0ef748eb9.zip | |
global tag IDs
Diffstat (limited to 'alv-lib')
| -rw-r--r-- | alv-lib/glsl-view.moon | 16 | ||||
| -rw-r--r-- | alv-lib/love.moon | 4 |
2 files changed, 11 insertions, 9 deletions
diff --git a/alv-lib/glsl-view.moon b/alv-lib/glsl-view.moon index bc783ed..4e79ec0 100644 --- a/alv-lib/glsl-view.moon +++ b/alv-lib/glsl-view.moon @@ -2,6 +2,8 @@ import Error, Constant, PureOp, Op, template_subst, Input, T, Array, Struct, sig import Message, Bundle, Timetag, add_item from require 'alv-lib._osc' import dns, udp from require 'socket' +fmttag = (tag) -> tag\ident!\gsub '[%.:%-/\\]', '_' + tryprefix = (prefix, filename) -> return filename unless prefix and filename\match '^%./' prefix .. filename @@ -85,14 +87,14 @@ video_source = Constant.meta args: args and Input.cold args samplertype = assert GLSL_SAMPLER_TYPES[@inputs.type!] - @setup_out '=', Uniform, type: samplertype, val: "alv-#{@tag}" + @setup_out '=', Uniform, type: samplertype, val: "alv-#{fmttag @tag}" tick: => { :socket, :type, :filename, :format, :args } = @unwrap_all! with @inputs.socket! filename = tryprefix @prefix, filename - msg = Message.new{ address: "/source/alv-#{@tag}/video", types: "ss", "TEXTURE_#{type}", filename } + msg = Message.new{ address: "/source/alv-#{fmttag @tag}/video", types: "ss", "TEXTURE_#{type}", filename } msg\add 's', format if format add_item msg, @inputs.args\type!, args if args \send Message.pack msg.content @@ -132,14 +134,14 @@ stream_source = Constant.meta args: args and Input.cold args samplertype = assert GLSL_SAMPLER_TYPES[@inputs.type!] - @setup_out '=', Uniform, type: samplertype, val: "alv-#{@tag}" + @setup_out '=', Uniform, type: samplertype, val: "alv-#{fmttag @tag}" tick: => { :socket, :name, :type, :filename, :format, :args } = @unwrap_all! with @inputs.socket! filename = tryprefix @prefix, filename - msg = Message.new{ address: "/source/alv-#{@tag}/stream", types: "ss", "TEXTURE_#{type}", filename } + msg = Message.new{ address: "/source/alv-#{fmttag @tag}/stream", types: "ss", "TEXTURE_#{type}", filename } msg\add 's', format if format add_item msg, @inputs.args\type!, args if args \send Message.pack msg.content @@ -165,13 +167,13 @@ tsv_source = Constant.meta type: Input.hot type or Constant.str "2D" samplertype = assert GLSL_SAMPLER_TYPES[@inputs.type!] - @setup_out '=', Uniform, type: samplertype, val: "alv-#{@tag}" + @setup_out '=', Uniform, type: samplertype, val: "alv-#{fmttag @tag}" tick: => { :socket, :name, :type } = @unwrap_all! with @inputs.socket! - \send Message.pack { address: "/source/alv-#{@tag}/tsv", types: "ss", "TEXTURE_#{type}", name } + \send Message.pack { address: "/source/alv-#{fmttag @tag}/tsv", types: "ss", "TEXTURE_#{type}", name } freeze = Constant.meta meta: @@ -235,7 +237,7 @@ shader_ = Constant.meta value: class extends PureOp pattern: const! + sig!^0 - name: (i) => "alv_u#{(tostring @tag)\gsub '%.', '_'}_#{i}" + name: (i) => "alv_u#{fmttag @tag}_#{i}" type: (args) => uniforms = {} diff --git a/alv-lib/love.moon b/alv-lib/love.moon index c29a2d4..9d3c64c 100644 --- a/alv-lib/love.moon +++ b/alv-lib/love.moon @@ -39,10 +39,10 @@ draw = Constant.meta num = shapes.num or #shapes for i=1, num do shapes[i] or= -> - COPILOT.drawlist[tostring @tag] = shapes + COPILOT.drawlist[@tag\ident!] = shapes destroy: => - COPILOT.drawlist[tostring @tag] = nil + COPILOT.drawlist[@tag\ident!] = nil group = Constant.meta meta: |
