automated snapshot
This commit is contained in:
43
main.go
43
main.go
@@ -62,11 +62,14 @@ func main() {
|
||||
|
||||
sketch := NewSketch(sourceWidth, sourceHeight)
|
||||
|
||||
sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||
|
||||
contourLayer := NewContourLayer(&sketch, rng, field)
|
||||
//sketch.CreateLayer("testPattern", &TestPattern{}, int32(sourceWidth), int32(sourceHeight))
|
||||
//sketch.CreateLayer("actors", &contourLayer, int32(sourceWidth), int32(sourceHeight))
|
||||
//sketch.CreateLayer("field", &FieldLayer{field: &field, dirty: true}, int32(sourceWidth), int32(sourceHeight))
|
||||
sketch.CreateLayer("contours", contourLayer)
|
||||
sketch.CreateLayer("sierpinski", sierpinskiLayer)
|
||||
|
||||
ports := MakePorts()
|
||||
ports["sierpinskiArrowAngle"] = Sine {
|
||||
@@ -136,30 +139,44 @@ func main() {
|
||||
gui.GroupBox(rl.Rectangle{X: 20, Y: 20, Width: controlPanelWidth - 50, Height: 60 }, "Blending")
|
||||
BlendModeToggleGroupActive = gui.ToggleGroup(rl.Rectangle{X: 30, Y: 40, Width: (controlPanelWidth - 70) / 3.0, Height: 24}, "ONE;TWO;THREE", BlendModeToggleGroupActive)
|
||||
|
||||
y := float32(90)
|
||||
for _, layerTools := range sketch.layerToolsOrdered {
|
||||
|
||||
config := layerTools.config
|
||||
|
||||
gui.Label(rl.Rectangle{X: 20, Y: 90, Width: 120, Height: 24}, layerTools.name)
|
||||
gui.Label(rl.Rectangle{X: 20, Y: y, Width: 120, Height: 24}, layerTools.name)
|
||||
|
||||
config.visible = gui.Toggle(rl.Rectangle{X: 40, Y: 136, Width: 16, Height: 16}, "A", config.visible)
|
||||
config.a = uint8(gui.Slider(rl.Rectangle{X: 64, Y: 136, Width: 264, Height: 16}, "", "", float32(config.a), 0, 255))
|
||||
y += 30
|
||||
|
||||
config.rVisible = gui.Toggle(rl.Rectangle{X: 40, Y: 160, Width: 16, Height: 16}, "R", config.rVisible)
|
||||
config.r = uint8(gui.Slider(rl.Rectangle{X: 64, Y: 160, Width: 264, Height: 16}, "", "", float32(config.r), 0, 255))
|
||||
config.visible = gui.Toggle(rl.Rectangle{X: 30, Y: y, Width: 16, Height: 16}, "A", config.visible)
|
||||
config.a = uint8(gui.Slider(rl.Rectangle{X: 50, Y: y, Width: 264, Height: 16}, "", "", float32(config.a), 0, 255))
|
||||
|
||||
config.gVisible = gui.Toggle(rl.Rectangle{X: 40, Y: 184, Width: 16, Height: 16}, "G", config.gVisible)
|
||||
config.g = uint8(gui.Slider(rl.Rectangle{X: 64, Y: 184, Width: 264, Height: 16}, "", "", float32(config.g), 0, 255))
|
||||
y += 24
|
||||
|
||||
config.bVisible = gui.Toggle(rl.Rectangle{X: 40, Y: 208, Width: 16, Height: 16}, "B", config.bVisible)
|
||||
config.b = uint8(gui.Slider(rl.Rectangle{X: 64, Y: 208, Width: 264, Height: 16}, "", "", float32(config.b), 0, 255))
|
||||
config.rVisible = gui.Toggle(rl.Rectangle{X: 30, Y: y, Width: 16, Height: 16}, "R", config.rVisible)
|
||||
config.r = uint8(gui.Slider(rl.Rectangle{X: 50, Y: y, Width: 264, Height: 16}, "", "", float32(config.r), 0, 255))
|
||||
|
||||
config.desaturate = !gui.Toggle(rl.Rectangle{X: 40, Y: 232, Width: 16, Height: 16}, "S", !config.desaturate)
|
||||
config.saturation = gui.Slider(rl.Rectangle{X: 64, Y: 232, Width: 264, Height: 16}, "", "", config.saturation, 0, 100)
|
||||
y += 24
|
||||
|
||||
gui.Label(rl.Rectangle{X: 40, Y: 256, Width: 16, Height: 16}, "S")
|
||||
config.kValue = gui.Slider(rl.Rectangle{X: 64, Y: 256, Width: 264, Height: 16}, "", "", config.kValue, 0, 2)
|
||||
config.gVisible = gui.Toggle(rl.Rectangle{X: 30, Y: y, Width: 16, Height: 16}, "G", config.gVisible)
|
||||
config.g = uint8(gui.Slider(rl.Rectangle{X: 50, Y: y, Width: 264, Height: 16}, "", "", float32(config.g), 0, 255))
|
||||
|
||||
y += 24
|
||||
|
||||
config.bVisible = gui.Toggle(rl.Rectangle{X: 30, Y: y, Width: 16, Height: 16}, "B", config.bVisible)
|
||||
config.b = uint8(gui.Slider(rl.Rectangle{X: 50, Y: y, Width: 264, Height: 16}, "", "", float32(config.b), 0, 255))
|
||||
|
||||
y += 24
|
||||
|
||||
config.desaturate = !gui.Toggle(rl.Rectangle{X: 30, Y: y, Width: 16, Height: 16}, "S", !config.desaturate)
|
||||
config.saturation = gui.Slider(rl.Rectangle{X: 50, Y: y, Width: 264, Height: 16}, "", "", config.saturation, 0, 100)
|
||||
|
||||
y += 24
|
||||
|
||||
gui.Label(rl.Rectangle{X: 30, Y: y, Width: 16, Height: 16}, "K")
|
||||
config.kValue = gui.Slider(rl.Rectangle{X: 50, Y: y, Width: 264, Height: 16}, "", "", config.kValue, 0, 2)
|
||||
|
||||
y += 30
|
||||
}
|
||||
|
||||
rl.EndDrawing()
|
||||
|
||||
@@ -4,12 +4,22 @@ import (
|
||||
rl "github.com/gen2brain/raylib-go/raylib"
|
||||
)
|
||||
|
||||
type SierpinskiArrow struct{}
|
||||
type SierpinskiArrow struct{
|
||||
dirty bool
|
||||
}
|
||||
|
||||
func (s *SierpinskiArrow) Draw(ctx *RenderCtx) {
|
||||
sierpinskiArrow(ctx, int(ctx.Ports["sierpinskiArrowDepth"]), ctx.Ports["sierpinskiArrowLength"])
|
||||
}
|
||||
|
||||
func (s *SierpinskiArrow) Update(ctx *RenderCtx) {
|
||||
s.dirty = true
|
||||
}
|
||||
|
||||
func (s *SierpinskiArrow) IsDirty() bool {
|
||||
return s.dirty
|
||||
}
|
||||
|
||||
func sierpinskiArrow(ctx *RenderCtx, order int, length float64) {
|
||||
if order == 0 {
|
||||
curve(ctx, order, length, ctx.Ports["sierpinskiArrowAngle"])
|
||||
@@ -22,7 +32,8 @@ func sierpinskiArrow(ctx *RenderCtx, order int, length float64) {
|
||||
func curve(ctx *RenderCtx, order int, length float64, angle float64) {
|
||||
if order == 0 {
|
||||
len := int32(length)
|
||||
rl.DrawLine(0, 0, len, 0, rl.Black)
|
||||
rl.SetLineWidth(4)
|
||||
rl.DrawLine(0, 0, len, 0, rl.RayWhite)
|
||||
rl.Translatef(float32(length), 0, 0)
|
||||
} else {
|
||||
curve(ctx, order-1, length/2, -angle)
|
||||
@@ -33,3 +44,4 @@ func curve(ctx *RenderCtx, order int, length float64, angle float64) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user