improve lighting system

This commit is contained in:
asrael 2026-01-23 12:09:35 -06:00
parent 27c6fa628d
commit f18652dc97
15 changed files with 193 additions and 119 deletions

View file

@ -50,6 +50,7 @@
(var fps-sample-count 0)
(var fireball-mesh nil)
(var last-dt 0.016)
(var lights nil)
(local cursor-look? true)
(local FIREBALL_COLOR 218)
@ -248,6 +249,7 @@
(pxl8.update_palette_deps)
(set camera (pxl8.create_camera_3d))
(set world (pxl8.create_world))
(set lights (pxl8.create_lights))
(sky.generate-stars 12345)
(create-fireball-mesh)
@ -469,15 +471,13 @@
r1 (* 0.06 (math.sin (+ (* real-time 1.8) (* phase 0.5))))
r2 (* 0.04 (math.sin (+ (* real-time 3.2) phase)))
light-radius (* 150 (+ 0.95 r1 r2))]
(pxl8.begin_frame_3d camera {
(lights:clear)
(lights:add light-x light-y light-z 255 200 150 light-intensity light-radius)
(pxl8.begin_frame_3d camera lights {
:ambient 30
:fog_density 0.0
:celestial_dir [0.5 -0.8 0.3]
:celestial_intensity 0.5
:lights [{:x light-x :y light-y :z light-z
:r 255 :g 200 :b 150
:intensity light-intensity
:radius light-radius}]})
:celestial_intensity 0.5})
(pxl8.clear_depth)
(sky.update-gradient 1 2 6 6 10 18)