Skip to content

Commit

Permalink
adjust background pattern for Fyne display. Make display output selec…
Browse files Browse the repository at this point in the history
…table.
  • Loading branch information
flynn-nrg committed Oct 20, 2024
1 parent 009c0ee commit c6c5013
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
41 changes: 26 additions & 15 deletions cmd/izpi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ const (
defaultMaxDepth = "50"
defaultOutputFile = "output.png"
defaultSceneFile = "examples/cornell_box.yaml"

displayWindowTitle = "Izpi Render Output"
)

var flags struct {
LogLevel string `name:"log-level" help:"The log level: error, warn, info, debug, trace." default:"info"`
Scene string `type:"existingfile" name:"scene" help:"Scene file to render" default:"${defaultSceneFile}"`
NumWorkers int64 `name:"num-workers" help:"Number of worker threads" default:"${defaultNumWorkers}"`
XSize int64 `name:"x" help:"Output image x size" default:"${defaultXSize}"`
YSize int64 `name:"y" help:"Output image y size" default:"${defaultYSize}"`
Samples int64 `name:"samples" help:"Number of samples per ray" default:"${defaultSamples}"`
Sampler string `name:"sampler-type" help:"Sampler function to use: colour, albedo, normal, wireframe" default:"colour"`
Depth int64 `name:"max-depth" help:"Maximum depth" default:"${defaultMaxDepth}"`
OutputMode string `name:"output-mode" help:"Output mode: png, hdr or pfm" default:"png"`
OutputFile string `type:"file" name:"output-file" help:"Output file." default:"${defaultOutputFile}"`
Verbose bool `name:"v" help:"Print rendering progress bar" default:"true"`
Preview bool `name:"p" help:"Display rendering progress in a window" default:"true"`
CpuProfile string `name:"cpu-profile" help:"Enable cpu profiling"`
LogLevel string `name:"log-level" help:"The log level: error, warn, info, debug, trace." default:"info"`
Scene string `type:"existingfile" name:"scene" help:"Scene file to render" default:"${defaultSceneFile}"`
NumWorkers int64 `name:"num-workers" help:"Number of worker threads" default:"${defaultNumWorkers}"`
XSize int64 `name:"x" help:"Output image x size" default:"${defaultXSize}"`
YSize int64 `name:"y" help:"Output image y size" default:"${defaultYSize}"`
Samples int64 `name:"samples" help:"Number of samples per ray" default:"${defaultSamples}"`
Sampler string `name:"sampler-type" help:"Sampler function to use: colour, albedo, normal, wireframe" default:"colour"`
Depth int64 `name:"max-depth" help:"Maximum depth" default:"${defaultMaxDepth}"`
OutputMode string `name:"output-mode" help:"Output mode: png, hdr or pfm" default:"png"`
OutputFile string `type:"file" name:"output-file" help:"Output file." default:"${defaultOutputFile}"`
Verbose bool `name:"v" help:"Print rendering progress bar" default:"true"`
Preview bool `name:"p" help:"Display rendering progress in a window" default:"true"`
DisplayMode string `name:"display-mode" help:"Display mode: fyne or sdl" default:"fyne"`
CpuProfile string `name:"cpu-profile" help:"Enable cpu profiling"`
}

func main() {
Expand Down Expand Up @@ -104,8 +107,16 @@ func main() {
}()

if flags.Preview {
disp = display.NewFyneDisplay("Izpi Render Output", int(flags.XSize), int(flags.YSize), previewChan)
disp.Start()
switch flags.DisplayMode {
case "fyne":
disp = display.NewFyneDisplay(displayWindowTitle, int(flags.XSize), int(flags.YSize), previewChan)
disp.Start()
case "sdl":
disp = display.NewSDLDisplay(displayWindowTitle, int(flags.XSize), int(flags.YSize), previewChan)
disp.Start()
default:
log.Fatalf("unknown display mode %q", flags.DisplayMode)
}
}

wg.Wait()
Expand Down
6 changes: 3 additions & 3 deletions pkg/display/fyne.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ func (fd *FyneDisplay) busyLoop() {
func (fd *FyneDisplay) makeBackdrop() {
cols := []color.Color{
color.RGBA{
R: 255,
G: 255,
B: 255,
R: 0,
G: 0,
B: 0,
A: 255,
},
color.RGBA{
Expand Down

0 comments on commit c6c5013

Please sign in to comment.