From 8ab550f8a6fe476fc03a26cf9bba59da4f2b1ce5 Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sat, 6 Aug 2022 01:22:46 +0100 Subject: vlorb --- img/better_disp.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'img') diff --git a/img/better_disp.lua b/img/better_disp.lua index 4122836..4419b95 100644 --- a/img/better_disp.lua +++ b/img/better_disp.lua @@ -22,6 +22,10 @@ local function vlorb(onc,offc, g1,g2,g3,g4,g5,g6) return textc,bgc,string.char(vlorbchar) end +local should_be_on(col) + return col[1]+col[2]+col[3] > 1.5 +end + -- todo: refactor common stuff into a common file local function disp(R,img,scrx,scry,w,h,imgx,imgy) -- w and h are image coords @@ -43,7 +47,8 @@ local function disp(R,img,scrx,scry,w,h,imgx,imgy) local gs = {} for goffy=0,2 do for goffx=0,1 do - table.insert(gs,img[imgy+ioffy+goffy][imgx+ioffx+goffx] or {0,0,0}) + local ic = img[imgy+ioffy+goffy][imgx+ioffx+goffx] or {0,0,0} + table.insert(gs,should_be_on(ic)) end end local tc,bc,ch = vlorb(colors.white,colors.black,table.unpack(gs)) @@ -58,4 +63,4 @@ end -return {vlorb=vlorb} +return {vlorb=vlorb,disp=disp} -- cgit v1.2.3