82 lines
1.9 KiB
Go
82 lines
1.9 KiB
Go
package json
|
|
|
|
import "gitea.local.lab/Lbenedar/foundry_helper_service/internal/foundry/temp_models/db"
|
|
|
|
type Light struct {
|
|
Alpha float64 `json:"alpha"`
|
|
Angle int `json:"angle"`
|
|
Bright float64 `json:"bright"`
|
|
Coloration float64 `json:"coloration"`
|
|
Dim float64 `json:"dim"`
|
|
Attenuation float64 `json:"attenuation"`
|
|
Luminosity float64 `json:"luminosity"`
|
|
Saturation float64 `json:"saturation"`
|
|
Contrast float64 `json:"contrast"`
|
|
Shadows float64 `json:"shadows"`
|
|
LightAnimation LightAnimation `json:"animation"`
|
|
LightDarkness LightDarkness `json:"darkness"`
|
|
Negative bool `json:"negative"`
|
|
Priority int `json:"priority"`
|
|
Color string `json:"color"`
|
|
}
|
|
|
|
func (l *Light) ToDB(dest *db.Light) bool {
|
|
if dest == nil {
|
|
return false
|
|
}
|
|
|
|
dest.Alpha = l.Alpha
|
|
dest.Angle = l.Angle
|
|
dest.Bright = l.Bright
|
|
dest.Coloration = l.Coloration
|
|
dest.Dim = l.Dim
|
|
dest.Attenuation = l.Attenuation
|
|
dest.Luminosity = l.Luminosity
|
|
dest.Saturation = l.Saturation
|
|
dest.Contrast = l.Contrast
|
|
dest.Shadows = l.Shadows
|
|
dest.Negative = l.Negative
|
|
dest.Priority = l.Priority
|
|
dest.Color = l.Color
|
|
|
|
l.LightAnimation.ToDB(&dest.LightAnimation)
|
|
l.LightDarkness.ToDB(&dest.LightDarkness)
|
|
|
|
return true
|
|
}
|
|
|
|
type LightAnimation struct {
|
|
Type any `json:"type"`
|
|
Speed int `json:"speed"`
|
|
Intensity int `json:"intensity"`
|
|
Reverse bool `json:"reverse"`
|
|
}
|
|
|
|
func (l *LightAnimation) ToDB(dest *db.LightAnimation) bool {
|
|
if dest == nil {
|
|
return false
|
|
}
|
|
|
|
dest.Speed = l.Speed
|
|
dest.Intensity = l.Intensity
|
|
dest.Reverse = l.Reverse
|
|
|
|
return true
|
|
}
|
|
|
|
type LightDarkness struct {
|
|
Min float64 `json:"min"`
|
|
Max float64 `json:"max"`
|
|
}
|
|
|
|
func (l *LightDarkness) ToDB(dest *db.LightDarkness) bool {
|
|
if dest == nil {
|
|
return false
|
|
}
|
|
|
|
dest.Min = l.Min
|
|
dest.Max = l.Max
|
|
|
|
return true
|
|
}
|