automated snapshot
This commit is contained in:
25
main.go
25
main.go
@@ -3,7 +3,7 @@ package main
|
||||
import (
|
||||
// "fmt"
|
||||
"log"
|
||||
//"math/rand"
|
||||
"math/rand"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
@@ -38,16 +38,12 @@ func main() {
|
||||
// layout_name: controls initialization
|
||||
var ControlScrollPaneScrollView rl.Rectangle
|
||||
var ControlScrollPaneScrollOffset rl.Vector2
|
||||
//var ControlScrollPaneBoundsOffset rl.Vector2
|
||||
|
||||
BlendModeToggleGroupActive := int32(0)
|
||||
|
||||
rl.SetTargetFPS(60)
|
||||
t0 := time.Now()
|
||||
|
||||
/*
|
||||
|
||||
|
||||
rng := rand.New(rand.NewSource(0))
|
||||
imageField := NewImageField("/home/d/Dropbox/art/passage/data/david.png")
|
||||
field :=
|
||||
@@ -59,21 +55,25 @@ func main() {
|
||||
field: imageField,
|
||||
},
|
||||
}
|
||||
*/
|
||||
|
||||
sketch := NewSketch(sourceWidth, sourceHeight)
|
||||
|
||||
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||
|
||||
//contourLayer := NewContourLayer(&sketch, rng, field)
|
||||
//sketch.CreateLayer("field", &FieldLayer{field: field, dirty: true})
|
||||
//sketch.CreateLayer("contours", contourLayer)
|
||||
imageLayer := NewImageLayer("/home/d/Dropbox/photos/Events/2025/Aurora/Photo Nov 11 2025, 9 52 03 PM.jpg")
|
||||
|
||||
contourLayer := NewContourLayer(&sketch, rng, field)
|
||||
sketch.CreateLayer("field", &FieldLayer{field: field, dirty: true})
|
||||
sketch.CreateLayer("contours", contourLayer)
|
||||
sketch.CreateLayer("sierpinski", sierpinskiLayer)
|
||||
sketch.CreateLayer("aurora", imageLayer)
|
||||
|
||||
ports := MakePorts()
|
||||
ports["sierpinskiArrowAngle"] =
|
||||
Const {
|
||||
V: 60,
|
||||
Sine {
|
||||
Amp: 5,
|
||||
Freq: 0.1,
|
||||
Bias: 60,
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ func main() {
|
||||
|
||||
ports["sierpinskiArrowLength"] =
|
||||
Const {
|
||||
V: 10000,
|
||||
V: 8000,
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ func main() {
|
||||
|
||||
sketch.Draw(renderCtx)
|
||||
|
||||
//gui.LoadStyle("styles/dark.rgs")
|
||||
gui.SetStyle(gui.DEFAULT, gui.BACKGROUND_COLOR, 0x181818FF)
|
||||
gui.SetStyle(gui.DEFAULT, gui.BASE_COLOR_NORMAL, 0x2A2A2AFF)
|
||||
gui.SetStyle(gui.DEFAULT, gui.BASE_COLOR_FOCUSED, 0x3A3A3AFF)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
rl "github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
@@ -24,7 +23,6 @@ func (s *SierpinskiArrow) IsDirty() bool {
|
||||
}
|
||||
|
||||
func sierpinskiArrow(ctx *RenderCtx, order int, length float64) {
|
||||
fmt.Printf("drawing SierpinskiArrow, order = %d, length = %.2f\n", order, length)
|
||||
if order == 0 {
|
||||
curve(ctx, order, length, ctx.Ports["sierpinskiArrowAngle"])
|
||||
} else {
|
||||
|
||||
29
sketch.go
29
sketch.go
@@ -265,6 +265,35 @@ type Layer interface {
|
||||
IsDirty() bool
|
||||
}
|
||||
|
||||
|
||||
type ImageLayer struct {
|
||||
texture rl.Texture2D
|
||||
dirty bool
|
||||
}
|
||||
|
||||
func NewImageLayer(path string) *ImageLayer {
|
||||
image := rl.LoadImage(path)
|
||||
tex := rl.LoadTextureFromImage(image)
|
||||
return &ImageLayer {
|
||||
texture: tex,
|
||||
dirty: true,
|
||||
}
|
||||
}
|
||||
|
||||
func (il *ImageLayer) Update(ctx *RenderCtx) {
|
||||
;
|
||||
}
|
||||
|
||||
func (il *ImageLayer) Draw(ctx *RenderCtx) {
|
||||
rl.Translatef(float32(ctx.SourceWidth) / 2.0 - float32(il.texture.Width) / 2.0, float32(ctx.SourceHeight) / 2.0 - float32(il.texture.Height) / 2.0, 0)
|
||||
rl.DrawTexture(il.texture, 0, 0, rl.White)
|
||||
}
|
||||
|
||||
func (il *ImageLayer) IsDirty() bool {
|
||||
return il.dirty
|
||||
}
|
||||
|
||||
|
||||
type TestPattern struct{
|
||||
dirty bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user