Fixed lighting
This commit is contained in:
@@ -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{},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user