diff options
| author | Martin Lehoux <martin@lehoux.net> | 2020-04-04 19:05:10 -0700 |
|---|---|---|
| committer | Martin Lehoux <martin@lehoux.net> | 2020-04-04 19:05:10 -0700 |
| commit | 3eebd8a349152726808ce83eaec1e83f53eb55e4 (patch) | |
| tree | f902e0a99cbddbffa8aba322d245c24789f35c29 | |
| parent | af587dc1d7c30e8ad6af8afda09b78b584d416dc (diff) | |
feat - Add progress bar
| -rw-r--r-- | main.go | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,6 +1,10 @@ package main -import "math/rand" +import ( + "math/rand" + + "github.com/schollz/progressbar" +) const HEIGHT = 100 const WIDTH = 200 @@ -20,6 +24,7 @@ func main() { WORLD := HitableList{EARTH, SPHERE} frame := Frame{} + bar := progressbar.New(HEIGHT) for x := 0; x < HEIGHT; x++ { for y := 0; y < WIDTH; y++ { var color_list [RAY_PER_PIXEL]Color @@ -32,6 +37,7 @@ func main() { color := ColorMeanSquare(color_list) frame[HEIGHT-1-x][y] = color.ToPixel() } + bar.Add(1) } frame.Save("img.ppm") } |
