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