aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Lehoux <martin@lehoux.net>2020-04-04 19:05:10 -0700
committerMartin Lehoux <martin@lehoux.net>2020-04-04 19:05:10 -0700
commit3eebd8a349152726808ce83eaec1e83f53eb55e4 (patch)
treef902e0a99cbddbffa8aba322d245c24789f35c29
parentaf587dc1d7c30e8ad6af8afda09b78b584d416dc (diff)
feat - Add progress bar
-rw-r--r--main.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/main.go b/main.go
index f85ad8a..61ab73c 100644
--- a/main.go
+++ b/main.go
@@ -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")
}