From 2e0ea01b1e2a18f58b290bbab6c6731428acd3de Mon Sep 17 00:00:00 2001 From: sumi Date: Sun, 11 Jan 2026 17:27:32 -0600 Subject: [PATCH] automated snapshot --- blinds.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ contour_layer.go | 2 +- main.go | 7 ++++--- 3 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 blinds.go diff --git a/blinds.go b/blinds.go new file mode 100644 index 0000000..3234722 --- /dev/null +++ b/blinds.go @@ -0,0 +1,54 @@ +package main + +import ( + sg "github.com/d2fn/sumi/internal/graphics" + rl "github.com/gen2brain/raylib-go/raylib" +) + +type BlindsLayer struct { + Field Field + Dirty bool +} + +func NewBlindsLayer(field Field) *BlindsLayer { + return &BlindsLayer { + Field: field, + Dirty: true, + } +} + +func (l *BlindsLayer) Draw(env *Env, g *sg.Graphics) { + + rowHeight := float32(10.0) + rows := int32(g.Bounds.Height / rowHeight) + + g.Clear() + + c := rl.White + c.A = 100 + + g.SetStrokeColor(c) + g.SetStrokeWeight(1.0) + y := float32(10.0) + for range rows { + for x := 10; x < int(g.Width()) - 10; x++ { + fieldValue := l.Field.Get(float32(x), float32(y)) + strokeHeight := rl.Remap(fieldValue, 0.0, 1.0, 0.0, rowHeight * 1.3) + a := sg.Point { X: float32(x), Y: float32(y) - strokeHeight / 2.0 } + b := sg.Point { X: float32(x), Y: float32(y) + strokeHeight / 2.0 } + g.DrawLine(a, b) + } + y += rowHeight + } + + l.Dirty = false +} + +func (l *BlindsLayer) Update(env *Env, g *sg.Graphics) { + +} + +func (l *BlindsLayer) IsDirty() bool { + return l.Dirty +} + diff --git a/contour_layer.go b/contour_layer.go index dfe8bc2..6ac4121 100644 --- a/contour_layer.go +++ b/contour_layer.go @@ -19,7 +19,7 @@ type ContourLayer struct { hiActorAngle float32 } -func NewContourLayer(sketch *Sketch, rng *rand.Rand, field Field, color color.RGBA, loActorAngle float32, hiActorAngle float32) *ContourLayer { +func NewContourLayer(rng *rand.Rand, field Field, color color.RGBA, loActorAngle float32, hiActorAngle float32) *ContourLayer { maxActors := 200000 diff --git a/main.go b/main.go index 08d9f83..5d01e8f 100644 --- a/main.go +++ b/main.go @@ -127,7 +127,7 @@ func main() { }, } - sierpinskiLayer := &SierpinskiArrow { dirty: true } + //sierpinskiLayer := &SierpinskiArrow { dirty: true } sketch := NewSketch(env) @@ -142,9 +142,10 @@ func main() { actorColor := color.RGBA { R: 10, G: 58, B: 59, A: 25 } fmt.Printf("actor color = %v\n", actorColor) - contourLayer := NewContourLayer(&sketch, rng, field, actorColor, -12*math.Pi, 12*math.Pi) + contourLayer := NewContourLayer(rng, field, actorColor, -12*math.Pi, 12*math.Pi) sketch.AddLayer("contours", contourLayer) - sketch.AddLayer("sierpinski-arrowhead", sierpinskiLayer) + sketch.AddLayer("blinds", NewBlindsLayer(field)) + //sketch.AddLayer("sierpinski-arrowhead", sierpinskiLayer) // aurora := NewImageLayer("/home/d/Dropbox/photos/Events/2025/Aurora/Photo Nov 11 2025, 9 52 03 PM.jpg") // sketch.AddLayer("aurora", aurora) // cave := NewImageLayer("/home/d/Dropbox/photos/Events/2025/ Chelsea and James visit Lindell/Photo Nov 29 2025, 5 26 40 PM (29).jpg")