automated snapshot
This commit is contained in:
33
field.go
33
field.go
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user