automated snapshot
This commit is contained in:
15
main.go
15
main.go
@@ -61,21 +61,21 @@ func main() {
|
||||
field: imageField,
|
||||
},
|
||||
}
|
||||
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||
|
||||
sketch := NewSketch(sourceWidth, sourceHeight)
|
||||
|
||||
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||
|
||||
sketch.AddColorLayer("background-magenta", rl.Magenta)
|
||||
//sketch.AddColorLayer("background-black", rl.Black)
|
||||
sketch.AddColorLayer("background-black", rl.Black)
|
||||
sketch.AddLayer("field", &FieldLayer{field: field, loColor: rl.NewColor(0, 0, 0, 0), hiColor: rl.Yellow, dirty: true})
|
||||
contourLayer := NewContourLayer(&sketch, rng, field)
|
||||
sketch.AddLayer("contours", contourLayer)
|
||||
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")
|
||||
sketch.AddLayer("cave", cave)
|
||||
// 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")
|
||||
// sketch.AddLayer("cave", cave)
|
||||
|
||||
ports := MakePorts()
|
||||
ports["sierpinskiArrowAngle"] =
|
||||
@@ -235,6 +235,8 @@ 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))
|
||||
@@ -242,6 +244,7 @@ func (fl *FieldLayer) Draw(ctx *RenderCtx) {
|
||||
rl.DrawPixel(x, y, clr)
|
||||
}
|
||||
}
|
||||
rl.EndBlendMode()
|
||||
fl.dirty = false
|
||||
}
|
||||
|
||||
|
||||
36
sketch.go
36
sketch.go
@@ -127,8 +127,40 @@ func (s *Sketch) Draw(ctx *RenderCtx) {
|
||||
}
|
||||
|
||||
viewport := s.CalcViewport(ctx)
|
||||
outputRect := s.calcOutputRectKeepingAspectRatio(ctx)
|
||||
|
||||
x := float32(0)
|
||||
y := float32(0)
|
||||
w := outputRect.Width
|
||||
h := outputRect.Height
|
||||
rl.PushMatrix()
|
||||
rl.Translatef(outputRect.X, outputRect.Y, 0)
|
||||
rl.BeginScissorMode(int32(outputRect.X), int32(outputRect.Y), int32(outputRect.Width), int32(outputRect.Height))
|
||||
checkSize := float32(25.0)
|
||||
grey := rl.NewColor(220, 220, 220, 255)
|
||||
cellX := 0
|
||||
cellY := 0
|
||||
for y < h {
|
||||
x = 0
|
||||
cellX = 0
|
||||
for x < w {
|
||||
c := rl.White
|
||||
if ((cellX + cellY) & 1) == 1 {
|
||||
c = grey
|
||||
}
|
||||
rl.DrawRectangle(int32(x), int32(y), int32(checkSize), int32(checkSize), c)
|
||||
x += checkSize
|
||||
cellX++
|
||||
}
|
||||
y += checkSize
|
||||
cellY++
|
||||
}
|
||||
rl.EndScissorMode()
|
||||
rl.PopMatrix()
|
||||
|
||||
|
||||
rl.BeginBlendMode(rl.BlendAlphaPremultiply)
|
||||
//rl.BeginBlendMode(rl.BlendAlpha)
|
||||
rl.BeginTextureMode(s.composite)
|
||||
rl.ClearBackground(rl.Blank)
|
||||
//rl.ClearBackground(rl.Black)
|
||||
@@ -147,6 +179,9 @@ func (s *Sketch) Draw(ctx *RenderCtx) {
|
||||
if config.bVisible {
|
||||
b = config.b
|
||||
}
|
||||
r = uint8(float32(r) * (float32(config.a) / 255.0))
|
||||
g = uint8(float32(g) * (float32(config.a) / 255.0))
|
||||
b = uint8(float32(b) * (float32(config.a) / 255.0))
|
||||
tint := rl.NewColor(r, g, b, config.a)
|
||||
rl.DrawTexturePro(instance.texture.Texture, src, dst, rl.Vector2{}, 0, tint)
|
||||
}
|
||||
@@ -157,7 +192,6 @@ func (s *Sketch) Draw(ctx *RenderCtx) {
|
||||
rl.GenTextureMipmaps(&s.composite.Texture)
|
||||
rl.SetTextureFilter(s.composite.Texture, rl.FilterTrilinear)
|
||||
|
||||
outputRect := s.calcOutputRectKeepingAspectRatio(ctx)
|
||||
rl.DrawTexturePro(s.composite.Texture, viewport, outputRect, rl.Vector2{}, 0, rl.White)
|
||||
|
||||
outlineRect := outputRect.ToInt32()
|
||||
|
||||
Reference in New Issue
Block a user