Fixed lighting

This commit is contained in:
2025-12-16 09:13:22 -07:00
parent de5f47f47b
commit 32df388c77
6 changed files with 85 additions and 66 deletions

View File

@@ -8,12 +8,18 @@ import (
"github.com/hajimehoshi/ebiten/v2"
)
type TimeOfDay string
type LightSource struct {
X, Y float64
Radius float64
Color color.RGBA
Intensity float64
ShadowDarkness float64
}
const (
Daytime TimeOfDay = "day"
Nighttime TimeOfDay = "night"
)
type LightConfig struct {
AmbientBrightness float64
Sources []LightSource
}
type Map struct {
ID string
@@ -24,7 +30,7 @@ type Map struct {
World *world.World
Portals []*portal.Portal
BackgroundColor color.NRGBA
TimeOfDay TimeOfDay // Day or Night tag
Lighting LightConfig
bakedImage *ebiten.Image
}
@@ -39,7 +45,10 @@ func NewMap(id string, number int, displayName string, width, height float64) *M
World: world.NewWorld(),
Portals: make([]*portal.Portal, 0),
BackgroundColor: color.NRGBA{R: 135, G: 206, B: 235, A: 255},
TimeOfDay: Daytime, // Default to daytime
Lighting: LightConfig{
AmbientBrightness: 1.0,
Sources: []LightSource{},
},
}
}