From 46b2065533583977501009a46e590bdc47e9ef34 Mon Sep 17 00:00:00 2001 From: Michael Fogleman Date: Tue, 6 Sep 2016 18:32:51 -0400 Subject: [PATCH] update examples --- examples/go.go | 3 ++- examples/gopher.go | 3 ++- examples/hdri.go | 3 ++- examples/hits.go | 3 ++- examples/love.go | 3 ++- examples/materials.go | 3 ++- examples/maze.go | 3 ++- examples/mol.go | 3 ++- examples/noise.go | 3 ++- examples/qbert.go | 3 ++- examples/refraction.go | 3 ++- examples/sdf.go | 3 ++- examples/spheres-anim.go | 3 ++- examples/spheres.go | 3 ++- examples/sponza.go | 3 ++- examples/suzanne.go | 3 ++- examples/teapot.go | 3 ++- examples/toybrick.go | 3 ++- examples/veach_scene.go | 3 ++- examples/volume.go | 3 ++- 20 files changed, 40 insertions(+), 20 deletions(-) diff --git a/examples/go.go b/examples/go.go index a54c12f..97132d9 100644 --- a/examples/go.go +++ b/examples/go.go @@ -66,7 +66,8 @@ func main() { scene.Texture = GetTexture("examples/courtyard_ccby/courtyard_8k.png") camera := LookAt(Vector{-0.5, 5, 5}, Vector{-0.5, 0, 0.5}, Vector{0, 1, 0}, 50) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 2560/2, 1440/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 2560/2, 1440/2) + renderer.IterativeRender("out%03d.png", 1000) } var blackPositions = [][]float64{ diff --git a/examples/gopher.go b/examples/gopher.go index 852c23d..5eabc16 100644 --- a/examples/gopher.go +++ b/examples/gopher.go @@ -30,5 +30,6 @@ func main() { // render the scene sampler := NewSampler(16, 16) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1024, 1024, -1) + renderer := NewRenderer(&scene, &camera, sampler, 1024, 1024) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/hdri.go b/examples/hdri.go index e440461..0736861 100644 --- a/examples/hdri.go +++ b/examples/hdri.go @@ -17,5 +17,6 @@ func main() { scene.Add(NewCube(V(-100, -100, -100), V(100, -1, 100), material)) camera := LookAt(V(2, 3, 4), V(0, 0, 0), V(0, 1, 0), 40) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/hits.go b/examples/hits.go index 6d3cef8..c0648d3 100644 --- a/examples/hits.go +++ b/examples/hits.go @@ -17,5 +17,6 @@ func main() { scene.Add(mesh) camera := LookAt(Vector{1.6, -3, 2}, Vector{-0.25, 0.5, 0.5}, Vector{0, 0, 1}, 50) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1500, 1500, -1) + renderer := NewRenderer(&scene, &camera, sampler, 1500, 1500) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/love.go b/examples/love.go index f908b92..45c1be1 100644 --- a/examples/love.go +++ b/examples/love.go @@ -18,5 +18,6 @@ func main() { scene.Add(NewSphere(Vector{2, 10, 2}, 1, LightMaterial(White, 30))) camera := LookAt(Vector{0, 1.5, 2}, Vector{0, 0.5, 0}, Vector{0, 1, 0}, 35) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/materials.go b/examples/materials.go index a69aeb9..aaf86ad 100644 --- a/examples/materials.go +++ b/examples/materials.go @@ -29,5 +29,6 @@ func main() { scene.Add(NewSphere(V(0, 5, 0), 1, LightMaterial(White, 25))) camera := LookAt(V(0, 3, 6), V(0, 1, 0), V(0, 1, 0), 30) sampler := NewSampler(16, 16) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/maze.go b/examples/maze.go index bb90458..a17ad55 100644 --- a/examples/maze.go +++ b/examples/maze.go @@ -25,5 +25,6 @@ func main() { scene.Add(NewSphere(V(0, 0, 2.25), 0.25, LightMaterial(White, 500))) camera := LookAt(V(1, 0, 30), V(0, 0, 0), V(0, 0, 1), 35) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/mol.go b/examples/mol.go index c0b40aa..a53a87c 100644 --- a/examples/mol.go +++ b/examples/mol.go @@ -95,5 +95,6 @@ func main() { camera := LookAt(eye, center, up, cam.Fovy/1.7) sampler := NewSampler(16, 8) sampler.SpecularMode = SpecularModeAll - IterativeRender("out%03d.png", 10000, &scene, &camera, sampler, 2560, 1440, -1) + renderer := NewRenderer(&scene, &camera, sampler, 2560, 1440) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/noise.go b/examples/noise.go index c8e4e83..2272c6d 100644 --- a/examples/noise.go +++ b/examples/noise.go @@ -27,5 +27,6 @@ func main() { scene.Add(light) camera := LookAt(V(0, 0, -20), V(0, 0, 0), V(0, 1, 0), 30) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/qbert.go b/examples/qbert.go index 93fac7c..100bb23 100644 --- a/examples/qbert.go +++ b/examples/qbert.go @@ -30,5 +30,6 @@ func main() { scene.Add(NewSphere(V(fn, fn/3, fn*2), 1, LightMaterial(White, 100))) camera := LookAt(V(fn*2, fn*2, fn*2), V(0, 0, fn/4), V(0, 0, 1), 35) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/refraction.go b/examples/refraction.go index 2ff643b..0c23fc7 100644 --- a/examples/refraction.go +++ b/examples/refraction.go @@ -29,5 +29,6 @@ func main() { camera := LookAt(V(0, -5, 5), V(0, 0, 0), V(0, 0, 1), 50) sampler := NewSampler(16, 8) sampler.SpecularMode = SpecularModeAll - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/4, 1080/4, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/sdf.go b/examples/sdf.go index b758058..8af1fdd 100644 --- a/examples/sdf.go +++ b/examples/sdf.go @@ -30,5 +30,6 @@ func main() { sampler := NewSampler(4, 4) sampler.LightMode = LightModeAll sampler.SpecularMode = SpecularModeAll - IterativeRender("out%03d.png", 10000, &scene, &camera, sampler, 1600, 1600, -1) + renderer := NewRenderer(&scene, &camera, sampler, 1600, 1600) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/spheres-anim.go b/examples/spheres-anim.go index 5f5e5a1..5f212a2 100644 --- a/examples/spheres-anim.go +++ b/examples/spheres-anim.go @@ -107,7 +107,8 @@ func frame(i int) { template := fmt.Sprintf("out%03d.png", i) // IterativeRender(template, 1, &scene, &camera, 1920, 1080, 16, 16, 4) sampler := NewSampler(16, 16) - IterativeRender(template, 1, &scene, &camera, sampler, 1920/2, 1080/2, 4) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } func easeInOutCubic(t float64) float64 { diff --git a/examples/spheres.go b/examples/spheres.go index 6daf9cd..1fc64d9 100644 --- a/examples/spheres.go +++ b/examples/spheres.go @@ -52,5 +52,6 @@ func main() { scene.Add(NewSphere(Vector{0, 0, 6}, 0.5, LightMaterial(White, 1))) camera := LookAt(Vector{3, 1.75, 1}, Vector{0.75, 0.5, 0}, Vector{0, 0, 1}, 30) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/sponza.go b/examples/sponza.go index 6fb2e1b..ff68a15 100644 --- a/examples/sponza.go +++ b/examples/sponza.go @@ -16,5 +16,6 @@ func main() { scene.Add(NewSphere(Vector{0, 20, 0}, 3, LightMaterial(White, 100))) camera := LookAt(Vector{-10, 2, 0}, Vector{0, 4, 0}, Vector{0, 1, 0}, 45) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/suzanne.go b/examples/suzanne.go index 81c310d..d630064 100644 --- a/examples/suzanne.go +++ b/examples/suzanne.go @@ -15,5 +15,6 @@ func main() { scene.Add(mesh) camera := LookAt(V(1, -0.45, 4), V(1, -0.6, 0.4), V(0, 1, 0), 40) sampler := NewSampler(16, 8) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/teapot.go b/examples/teapot.go index 048c684..901a49c 100644 --- a/examples/teapot.go +++ b/examples/teapot.go @@ -14,5 +14,6 @@ func main() { scene.Add(mesh) camera := LookAt(Vector{2, 5, -6}, Vector{0.5, 1, 0}, Vector{0, 1, 0}, 45) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/toybrick.go b/examples/toybrick.go index c3f3a45..78edca8 100644 --- a/examples/toybrick.go +++ b/examples/toybrick.go @@ -47,7 +47,8 @@ func main() { } camera := LookAt(Vector{-23, 13, 20}, Vector{0, 0, 0}, Vector{0, 0, 1}, 45) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } var Colors = map[int]int{ diff --git a/examples/veach_scene.go b/examples/veach_scene.go index 2602cd3..254057e 100644 --- a/examples/veach_scene.go +++ b/examples/veach_scene.go @@ -43,5 +43,6 @@ func main() { sampler := NewSampler(4, 8) sampler.SpecularMode = SpecularModeAll sampler.LightMode = LightModeAll - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 1920/2, 1080/2, -1) + renderer := NewRenderer(&scene, &camera, sampler, 960, 540) + renderer.IterativeRender("out%03d.png", 1000) } diff --git a/examples/volume.go b/examples/volume.go index 44aebad..04b6c5a 100644 --- a/examples/volume.go +++ b/examples/volume.go @@ -86,5 +86,6 @@ func main() { camera := LookAt(V(0, -3, -3), V(0, 0, 0), V(0, 0, -1), 35) sampler := NewSampler(4, 4) - IterativeRender("out%03d.png", 1000, &scene, &camera, sampler, 512, 512, -1) + renderer := NewRenderer(&scene, &camera, sampler, 512, 512) + renderer.IterativeRender("out%03d.png", 1000) }