Merge branch 'master' of ssh://git.kingsh.it:2322/d2fn/sumi
This commit is contained in:
73
main.go
73
main.go
@@ -17,32 +17,61 @@ import (
|
|||||||
//"github.com/ojrac/opensimplex-go"
|
//"github.com/ojrac/opensimplex-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var snapshotsPath string
|
var (
|
||||||
|
snapshotsPath string
|
||||||
|
storage *Storage
|
||||||
|
sourceWidth, sourceHeight int
|
||||||
|
targetWidth, targetHeight int
|
||||||
|
)
|
||||||
|
|
||||||
|
func bootstrap() {
|
||||||
|
|
||||||
|
rl.InitWindow(800, 600, "bootstrap")
|
||||||
|
|
||||||
|
monitor := rl.GetCurrentMonitor()
|
||||||
|
fmt.Printf("Using monitor %d\n", monitor)
|
||||||
|
|
||||||
|
monitorWidth := rl.GetMonitorWidth(monitor)
|
||||||
|
monitorHeight := rl.GetMonitorHeight(monitor)
|
||||||
|
|
||||||
|
defaultTargetWidth := int(float32(monitorWidth) * 0.95)
|
||||||
|
defaultTargetHeight := int(float32(monitorHeight) * 0.9)
|
||||||
|
defaultSourceWidth := 5*defaultTargetWidth
|
||||||
|
defaultSourceHeight := 5*defaultTargetHeight
|
||||||
|
|
||||||
|
fmt.Printf("monitor : %d x %d / window : %d x %d / buffer : %d x %d",
|
||||||
|
monitorWidth, monitorHeight,
|
||||||
|
defaultTargetWidth, defaultTargetHeight,
|
||||||
|
defaultSourceWidth, defaultSourceHeight)
|
||||||
|
|
||||||
|
flag.StringVar(&snapshotsPath, "path", "snapshots", "Path to snapshots and db")
|
||||||
|
flag.IntVar(&sourceWidth, "bw", defaultSourceWidth, "Width of the internal graphics source")
|
||||||
|
flag.IntVar(&sourceHeight, "bh", defaultSourceHeight, "Height of the internal graphics source")
|
||||||
|
flag.IntVar(&targetWidth, "w", defaultTargetWidth, "Width of the display window")
|
||||||
|
flag.IntVar(&targetHeight, "h", defaultTargetHeight, "Height of the display window")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
rl.CloseWindow()
|
||||||
|
|
||||||
|
log.Printf("Storing snapshots at '%s'\n", snapshotsPath)
|
||||||
|
|
||||||
|
os.MkdirAll(snapshotsPath, 0755)
|
||||||
|
var err error
|
||||||
|
storage, err = NewStorage(snapshotsPath)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Error loading storage: %v\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
log := log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lshortfile)
|
log := log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lshortfile)
|
||||||
|
|
||||||
flag.StringVar(&snapshotsPath, "path", "snapshots", "Path to snapshots and db")
|
bootstrap()
|
||||||
flag.Parse()
|
|
||||||
|
|
||||||
var sourceWidth int32 = 8000
|
|
||||||
var sourceHeight int32 = 6400
|
|
||||||
|
|
||||||
var targetWidth int32 = int32(1600)
|
|
||||||
var targetHeight int32 = int32(1000)
|
|
||||||
|
|
||||||
log.Printf("Storing snapshots at '%s'\n", snapshotsPath)
|
|
||||||
|
|
||||||
os.MkdirAll(snapshotsPath, 0755)
|
|
||||||
storage, err := NewStorage(snapshotsPath)
|
|
||||||
if err != nil {
|
|
||||||
log.Printf("Error loading storage: %v\n", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
//rl.SetConfigFlags(rl.FlagMsaa4xHint)
|
//rl.SetConfigFlags(rl.FlagMsaa4xHint)
|
||||||
rl.InitWindow(targetWidth, targetHeight, "sumi sierpinski arrow")
|
rl.InitWindow(int32(targetWidth), int32(targetHeight), "sumi sierpinski arrow")
|
||||||
|
|
||||||
// reproducable flourescent color cycle
|
// reproducable flourescent color cycle
|
||||||
colorCycle := g.NewFixedColorCycle(g.FlourescentColors).Shuffle(0)
|
colorCycle := g.NewFixedColorCycle(g.FlourescentColors).Shuffle(0)
|
||||||
@@ -66,8 +95,8 @@ func main() {
|
|||||||
scale: 100.0,
|
scale: 100.0,
|
||||||
field: &AdderField {
|
field: &AdderField {
|
||||||
fields: []Field {
|
fields: []Field {
|
||||||
|
&ScaleField { scale: 10,field: noiseField },
|
||||||
sinXYField,
|
sinXYField,
|
||||||
noiseField,
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -75,7 +104,7 @@ func main() {
|
|||||||
|
|
||||||
//sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
//sierpinskiLayer := &SierpinskiArrow { dirty: true }
|
||||||
|
|
||||||
sketch := NewSketch(sourceWidth, sourceHeight)
|
sketch := NewSketch(int32(sourceWidth), int32(sourceHeight))
|
||||||
|
|
||||||
fieldColor := colorCycle.Next()
|
fieldColor := colorCycle.Next()
|
||||||
fmt.Printf("field color = %v\n", fieldColor)
|
fmt.Printf("field color = %v\n", fieldColor)
|
||||||
@@ -96,7 +125,7 @@ func main() {
|
|||||||
//NewColor(11, 35, 176, 50),
|
//NewColor(11, 35, 176, 50),
|
||||||
|
|
||||||
//r
|
//r
|
||||||
contourLayer := NewContourLayer(&sketch, rng, field, actorColor, -10*math.Pi, 10*math.Pi)
|
contourLayer := NewContourLayer(&sketch, rng, field, actorColor, -25*math.Pi, 25*math.Pi)
|
||||||
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")
|
||||||
|
|||||||
Reference in New Issue
Block a user