Lighting experiments

This commit is contained in:
2025-12-16 00:44:52 -07:00
parent c70f85abe5
commit de5f47f47b
12 changed files with 664 additions and 17 deletions

View File

@@ -27,6 +27,8 @@ type SettingsScreen struct {
fpsMonitorValue *bool
fpsCapValue FPSCapSetting
portalVisibilityValue *bool
raycastEnabledValue *bool
raycastDebugValue *bool
}
func NewSettingsScreen() *SettingsScreen {
@@ -48,6 +50,11 @@ func (s *SettingsScreen) SetPortalVisibility(enabled *bool) {
s.portalVisibilityValue = enabled
}
func (s *SettingsScreen) SetRaycastSettings(enabled *bool, debugMode *bool) {
s.raycastEnabledValue = enabled
s.raycastDebugValue = debugMode
}
func (s *SettingsScreen) Update() bool {
if inpututil.IsKeyJustPressed(ebiten.KeyEscape) {
if s.currentScreen == settingsDebugOptions {
@@ -92,7 +99,7 @@ func (s *SettingsScreen) updateMain() bool {
}
func (s *SettingsScreen) updateDebugOptions() bool {
debugOptionsCount := 3
debugOptionsCount := 5 // FPS Monitor, Portal Visibility, Raycast Enabled, Raycast Debug, Back
if inpututil.IsKeyJustPressed(ebiten.KeyArrowUp) || inpututil.IsKeyJustPressed(ebiten.KeyW) {
s.selectedIndex--
if s.selectedIndex < 0 {
@@ -111,7 +118,11 @@ func (s *SettingsScreen) updateDebugOptions() bool {
*s.fpsMonitorValue = !*s.fpsMonitorValue
} else if s.selectedIndex == 1 && s.portalVisibilityValue != nil {
*s.portalVisibilityValue = !*s.portalVisibilityValue
} else if s.selectedIndex == 2 {
} else if s.selectedIndex == 2 && s.raycastEnabledValue != nil {
*s.raycastEnabledValue = !*s.raycastEnabledValue
} else if s.selectedIndex == 3 && s.raycastDebugValue != nil {
*s.raycastDebugValue = !*s.raycastDebugValue
} else if s.selectedIndex == 4 {
s.currentScreen = settingsMain
s.selectedIndex = 0
}
@@ -211,10 +222,44 @@ func (s *SettingsScreen) drawDebugOptions(screen *ebiten.Image, screenWidth, scr
s.drawText(screen, portalVisText, color.RGBA{R: 180, G: 180, B: 200, A: 255}, leftMargin, portalY)
}
// Raycast enabled toggle
raycastText := "Lighting: "
if s.raycastEnabledValue != nil && *s.raycastEnabledValue {
raycastText += "ON"
} else {
raycastText += "OFF"
}
raycastY := startY + 80
if s.selectedIndex == 2 {
indicatorX := leftMargin - 20
s.drawText(screen, ">", color.RGBA{R: 255, G: 200, B: 0, A: 255}, indicatorX, raycastY)
s.drawText(screen, raycastText, color.RGBA{R: 255, G: 255, B: 100, A: 255}, leftMargin, raycastY)
} else {
s.drawText(screen, raycastText, color.RGBA{R: 180, G: 180, B: 200, A: 255}, leftMargin, raycastY)
}
// Raycast debug toggle
raycastDebugText := "Debug Rays: "
if s.raycastDebugValue != nil && *s.raycastDebugValue {
raycastDebugText += "ON"
} else {
raycastDebugText += "OFF"
}
raycastDebugY := startY + 120
if s.selectedIndex == 3 {
indicatorX := leftMargin - 20
s.drawText(screen, ">", color.RGBA{R: 255, G: 200, B: 0, A: 255}, indicatorX, raycastDebugY)
s.drawText(screen, raycastDebugText, color.RGBA{R: 255, G: 255, B: 100, A: 255}, leftMargin, raycastDebugY)
} else {
s.drawText(screen, raycastDebugText, color.RGBA{R: 180, G: 180, B: 200, A: 255}, leftMargin, raycastDebugY)
}
// back option
backText := "< Back"
backY := startY + 80
if s.selectedIndex == 2 {
backY := startY + 160
if s.selectedIndex == 4 {
indicatorX := leftMargin - 20
s.drawText(screen, ">", color.RGBA{R: 255, G: 200, B: 0, A: 255}, indicatorX, backY)
s.drawText(screen, backText, color.RGBA{R: 255, G: 255, B: 100, A: 255}, leftMargin, backY)