glow rendering fixes to bring stars back
This commit is contained in:
parent
657b590b6f
commit
c538641ec8
26 changed files with 773 additions and 1491 deletions
|
|
@ -10,17 +10,19 @@
|
|||
(var door-tex nil)
|
||||
(var fireball-mesh nil)
|
||||
|
||||
(fn create-door-mesh []
|
||||
(fn create-door-mesh [bsp ambient]
|
||||
(let [verts []
|
||||
indices []
|
||||
hw (/ DOOR_WIDTH 2)
|
||||
y0 0
|
||||
y1 DOOR_HEIGHT
|
||||
x DOOR_X]
|
||||
(table.insert verts {:x x :y y0 :z (- DOOR_Z hw) :u 0 :v 1 :nx -1 :ny 0 :nz 0 :color 80 :light 200})
|
||||
(table.insert verts {:x x :y y0 :z (+ DOOR_Z hw) :u 1 :v 1 :nx -1 :ny 0 :nz 0 :color 80 :light 200})
|
||||
(table.insert verts {:x x :y y1 :z (+ DOOR_Z hw) :u 1 :v 0 :nx -1 :ny 0 :nz 0 :color 80 :light 200})
|
||||
(table.insert verts {:x x :y y1 :z (- DOOR_Z hw) :u 0 :v 0 :nx -1 :ny 0 :nz 0 :color 80 :light 200})
|
||||
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)
|
||||
|
|
@ -150,13 +152,15 @@
|
|||
20)
|
||||
|
||||
(fn init [textures]
|
||||
(when (not door-mesh)
|
||||
(create-door-mesh))
|
||||
(when (not fireball-mesh)
|
||||
(create-fireball-mesh))
|
||||
(when (and (not door-tex) textures)
|
||||
(set door-tex (textures.door))))
|
||||
|
||||
(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
|
||||
|
|
@ -176,4 +180,5 @@
|
|||
:get-door-radius get-door-radius
|
||||
:init init
|
||||
:render-door render-door
|
||||
:render-fireball render-fireball}
|
||||
:render-fireball render-fireball
|
||||
:setup-lighting setup-lighting}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue