automated snapshot
This commit is contained in:
11
main.go
11
main.go
@@ -61,21 +61,21 @@ func main() {
|
|||||||
field: imageField,
|
field: imageField,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||||
|
|
||||||
sketch := NewSketch(sourceWidth, sourceHeight)
|
sketch := NewSketch(sourceWidth, sourceHeight)
|
||||||
|
|
||||||
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
|
||||||
|
|
||||||
sketch.AddColorLayer("background-magenta", rl.Magenta)
|
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})
|
sketch.AddLayer("field", &FieldLayer{field: field, loColor: rl.NewColor(0, 0, 0, 0), hiColor: rl.Yellow, dirty: true})
|
||||||
contourLayer := NewContourLayer(&sketch, rng, field)
|
contourLayer := NewContourLayer(&sketch, rng, field)
|
||||||
sketch.AddLayer("contours", contourLayer)
|
sketch.AddLayer("contours", contourLayer)
|
||||||
sketch.AddLayer("sierpinski-arrowhead", sierpinskiLayer)
|
sketch.AddLayer("sierpinski-arrowhead", sierpinskiLayer)
|
||||||
// aurora := NewImageLayer("/home/d/Dropbox/photos/Events/2025/Aurora/Photo Nov 11 2025, 9 52 03 PM.jpg")
|
// aurora := NewImageLayer("/home/d/Dropbox/photos/Events/2025/Aurora/Photo Nov 11 2025, 9 52 03 PM.jpg")
|
||||||
// sketch.AddLayer("aurora", aurora)
|
// 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")
|
// 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)
|
// sketch.AddLayer("cave", cave)
|
||||||
|
|
||||||
ports := MakePorts()
|
ports := MakePorts()
|
||||||
ports["sierpinskiArrowAngle"] =
|
ports["sierpinskiArrowAngle"] =
|
||||||
@@ -235,6 +235,8 @@ func (fl *FieldLayer) Update(ctx *RenderCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (fl *FieldLayer) Draw(ctx *RenderCtx) {
|
func (fl *FieldLayer) Draw(ctx *RenderCtx) {
|
||||||
|
rl.ClearBackground(rl.Blank)
|
||||||
|
rl.BeginBlendMode(rl.BlendAlphaPremultiply)
|
||||||
for x := range ctx.SourceWidth {
|
for x := range ctx.SourceWidth {
|
||||||
for y := range ctx.SourceHeight {
|
for y := range ctx.SourceHeight {
|
||||||
v := fl.field.Get(float32(x), float32(y))
|
v := fl.field.Get(float32(x), float32(y))
|
||||||
@@ -242,6 +244,7 @@ func (fl *FieldLayer) Draw(ctx *RenderCtx) {
|
|||||||
rl.DrawPixel(x, y, clr)
|
rl.DrawPixel(x, y, clr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rl.EndBlendMode()
|
||||||
fl.dirty = false
|
fl.dirty = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
sketch.go
36
sketch.go
@@ -127,8 +127,40 @@ func (s *Sketch) Draw(ctx *RenderCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
viewport := s.CalcViewport(ctx)
|
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.BlendAlphaPremultiply)
|
||||||
|
//rl.BeginBlendMode(rl.BlendAlpha)
|
||||||
rl.BeginTextureMode(s.composite)
|
rl.BeginTextureMode(s.composite)
|
||||||
rl.ClearBackground(rl.Blank)
|
rl.ClearBackground(rl.Blank)
|
||||||
//rl.ClearBackground(rl.Black)
|
//rl.ClearBackground(rl.Black)
|
||||||
@@ -147,6 +179,9 @@ func (s *Sketch) Draw(ctx *RenderCtx) {
|
|||||||
if config.bVisible {
|
if config.bVisible {
|
||||||
b = config.b
|
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)
|
tint := rl.NewColor(r, g, b, config.a)
|
||||||
rl.DrawTexturePro(instance.texture.Texture, src, dst, rl.Vector2{}, 0, tint)
|
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.GenTextureMipmaps(&s.composite.Texture)
|
||||||
rl.SetTextureFilter(s.composite.Texture, rl.FilterTrilinear)
|
rl.SetTextureFilter(s.composite.Texture, rl.FilterTrilinear)
|
||||||
|
|
||||||
outputRect := s.calcOutputRectKeepingAspectRatio(ctx)
|
|
||||||
rl.DrawTexturePro(s.composite.Texture, viewport, outputRect, rl.Vector2{}, 0, rl.White)
|
rl.DrawTexturePro(s.composite.Texture, viewport, outputRect, rl.Vector2{}, 0, rl.White)
|
||||||
|
|
||||||
outlineRect := outputRect.ToInt32()
|
outlineRect := outputRect.ToInt32()
|
||||||
|
|||||||
Reference in New Issue
Block a user