diff options
author | ubq323 <ubq323@ubq323.website> | 2023-06-18 22:28:37 +0100 |
---|---|---|
committer | ubq323 <ubq323@ubq323.website> | 2023-06-18 22:28:37 +0100 |
commit | f55c9f415a081a175e48b51db894f23e59ce47a2 (patch) | |
tree | ee63f98d5c4f1a2a11e9800ced9c2861eb3085a7 /client/drawing2.lua | |
parent | 598bd4332deddd5f4c506689cbd136f495835ea7 (diff) |
fix line lengths
Diffstat (limited to 'client/drawing2.lua')
-rw-r--r-- | client/drawing2.lua | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/client/drawing2.lua b/client/drawing2.lua index c894e4c..800df78 100644 --- a/client/drawing2.lua +++ b/client/drawing2.lua @@ -21,8 +21,12 @@ do local function ve(n,f) return {cos(th(n)),sin(th(n)), f} end local function vi(n,f) return {ri*cos(th(n)),ri*sin(th(n)), f} end local function vo(n,f) return {ro*cos(th(n)),ro*sin(th(n)), f} end - local function apv(...) for _,x in ipairs({...}) do table.insert(vertices,x) end end - local function apm(...) for _,x in ipairs({...}) do table.insert(map,x) end end + local function apv(...) + for _,x in ipairs({...}) do table.insert(vertices,x) end + end + local function apm(...) + for _,x in ipairs({...}) do table.insert(map,x) end + end vertices[1] = {0,0, 1} for n=0,5 do apv(ve(n,1)) end @@ -88,7 +92,9 @@ vec4 position(mat4 transform_projection, vec4 vertex_position) { - vec2 instance_pos = vec2( floor(love_InstanceID/CHUNK_SIZE), mod(love_InstanceID, CHUNK_SIZE) ); + vec2 instance_pos = vec2( + floor(love_InstanceID/CHUNK_SIZE), + mod(love_InstanceID, CHUNK_SIZE) ); vertex_position.xy += hex_to_pos * instance_pos; float a = clamp( (zoom-zthr0)/zthrd, 0, 1); @@ -104,7 +110,8 @@ vec4 position(mat4 transform_projection, vec4 vertex_position) #pragma language glsl3 varying vec4 tcol; -vec4 effect(vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords) +vec4 effect(vec4 color, Image tex, + vec2 texture_coords, vec2 screen_coords) { // return vec4(tcol.xyz,0.5); return tcol; @@ -133,7 +140,9 @@ local function draw_map(camera,map) local tl = htl:to_pos() local br = hbr:to_pos() - if br.x < cam_tl.x or cam_br.x < tl.x or br.y < cam_tl.y or cam_br.y < tl.y then + if br.x < cam_tl.x or cam_br.x < tl.x + or br.y < cam_tl.y or cam_br.y < tl.y + then -- definitely not visible on screen -- this does not catch every single nonvisible chunk goto next |