feat(gui): add toolbar widget
feat(gui): add grid_select, toggle, panel, status_bar, image widgets fix(bsp): fill in exterior cells
This commit is contained in:
parent
5a565844dd
commit
8d491612ab
63 changed files with 3150 additions and 1686 deletions
|
|
@ -1,36 +1,9 @@
|
|||
(local pxl8 (require :pxl8))
|
||||
|
||||
(local DOOR_HEIGHT 96)
|
||||
(local DOOR_WIDTH 48)
|
||||
(local DOOR_X 892)
|
||||
(local DOOR_Z 416)
|
||||
(local FIREBALL_COLOR 218)
|
||||
|
||||
(var door-mesh nil)
|
||||
(var door-tex nil)
|
||||
(var fireball-mesh nil)
|
||||
|
||||
(fn create-door-mesh [bsp ambient]
|
||||
(let [verts []
|
||||
indices []
|
||||
hw (/ DOOR_WIDTH 2)
|
||||
y0 0
|
||||
y1 DOOR_HEIGHT
|
||||
x DOOR_X
|
||||
sample (fn [vx vy vz]
|
||||
(if bsp (bsp:light_at vx vy vz (or ambient 0)) 200))]
|
||||
(table.insert verts {:x x :y y0 :z (- DOOR_Z hw) :u 0 :v 1 :nx -1 :ny 0 :nz 0 :color 80 :light (sample x y0 (- DOOR_Z hw))})
|
||||
(table.insert verts {:x x :y y0 :z (+ DOOR_Z hw) :u 1 :v 1 :nx -1 :ny 0 :nz 0 :color 80 :light (sample x y0 (+ DOOR_Z hw))})
|
||||
(table.insert verts {:x x :y y1 :z (+ DOOR_Z hw) :u 1 :v 0 :nx -1 :ny 0 :nz 0 :color 80 :light (sample x y1 (+ DOOR_Z hw))})
|
||||
(table.insert verts {:x x :y y1 :z (- DOOR_Z hw) :u 0 :v 0 :nx -1 :ny 0 :nz 0 :color 80 :light (sample x y1 (- DOOR_Z hw))})
|
||||
(table.insert indices 0)
|
||||
(table.insert indices 1)
|
||||
(table.insert indices 2)
|
||||
(table.insert indices 0)
|
||||
(table.insert indices 2)
|
||||
(table.insert indices 3)
|
||||
(set door-mesh (pxl8.create_mesh verts indices))))
|
||||
|
||||
(fn create-fireball-mesh []
|
||||
(let [verts []
|
||||
indices []
|
||||
|
|
@ -145,40 +118,15 @@
|
|||
|
||||
(set fireball-mesh (pxl8.create_mesh verts indices))))
|
||||
|
||||
(fn get-door-position []
|
||||
(values DOOR_X DOOR_Z))
|
||||
|
||||
(fn get-door-radius []
|
||||
20)
|
||||
|
||||
(fn init [textures]
|
||||
(when (not fireball-mesh)
|
||||
(create-fireball-mesh))
|
||||
(when (and (not door-tex) textures)
|
||||
(set door-tex (textures.door))))
|
||||
(create-fireball-mesh)))
|
||||
|
||||
(fn setup-lighting [bsp ambient]
|
||||
(when (and (not door-mesh) bsp)
|
||||
(create-door-mesh bsp ambient)))
|
||||
|
||||
(fn render-door [wireframe floor-y]
|
||||
(when (and door-mesh door-tex)
|
||||
(pxl8.draw_mesh door-mesh {:x 0 :y (or floor-y 0) :z 0
|
||||
:texture door-tex
|
||||
:lighting true
|
||||
:double_sided true
|
||||
:wireframe wireframe})))
|
||||
|
||||
(fn render-fireball [x y z wireframe]
|
||||
(fn render-fireball [x y z]
|
||||
(when fireball-mesh
|
||||
(pxl8.draw_mesh fireball-mesh {:x x :y y :z z
|
||||
:emissive true
|
||||
:wireframe wireframe})))
|
||||
:emissive true})))
|
||||
|
||||
{:FIREBALL_COLOR FIREBALL_COLOR
|
||||
:get-door-position get-door-position
|
||||
:get-door-radius get-door-radius
|
||||
:init init
|
||||
:render-door render-door
|
||||
:render-fireball render-fireball
|
||||
:setup-lighting setup-lighting}
|
||||
:render-fireball render-fireball}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue