aboutsummaryrefslogtreecommitdiff
path: root/camera.go
diff options
context:
space:
mode:
Diffstat (limited to 'camera.go')
-rw-r--r--camera.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/camera.go b/camera.go
index 8ca0664..5eefad5 100644
--- a/camera.go
+++ b/camera.go
@@ -4,6 +4,7 @@ import (
"fmt"
maths "math"
"os"
+ "time"
)
type Camera struct {
@@ -68,6 +69,8 @@ func NewCamera(wi uint, ar float64,
}
func (cam Camera) Render(world Hittable) {
+ start := time.Now();
+
fmt.Printf("P3\n%d %d\n255\n", cam.ImageWidth, cam.ImageHeight);
for row := uint(0); row < cam.ImageHeight; row++ {
fmt.Fprintf(os.Stderr,
@@ -85,6 +88,11 @@ func (cam Camera) Render(world Hittable) {
}
fmt.Printf("\n");
}
+
+ dur := time.Since(start);
+ fmt.Fprintf(os.Stderr,
+ "Done, in %5.2f seconds! \n",
+ dur.Seconds());
}
func (cam Camera) GetRay(row uint, col uint) Ray {