automated snapshot

This commit is contained in:
sumi
2025-12-26 14:42:39 -06:00
parent 6ab7c8d7e1
commit 80d3a0fde8
3 changed files with 47 additions and 34 deletions

View File

@@ -90,3 +90,36 @@ func (f *ImageField) Get(x, y float32) float32 {
c := f.pixels.Get(int(x+float32(f.offsetX)), int(y+float32(f.offsetY)))
return Brightness(c)
}
/** LAYER HELPERS **/
type FieldLayer struct {
field Field
loColor rl.Color
hiColor rl.Color
dirty bool
}
func (fl *FieldLayer) Update(ctx *RenderCtx) {
;
}
func (fl *FieldLayer) Draw(ctx *RenderCtx) {
rl.ClearBackground(rl.Blank)
rl.BeginBlendMode(rl.BlendAlphaPremultiply)
for x := range ctx.SourceWidth {
for y := range ctx.SourceHeight {
v := fl.field.Get(float32(x), float32(y))
clr := LerpCurve(v, 1.3, fl.loColor, fl.hiColor)
rl.DrawPixel(x, y, clr)
}
}
rl.EndBlendMode()
fl.dirty = false
}
func (fl *FieldLayer) IsDirty() bool {
return fl.dirty
}