Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
fogleman committed Sep 6, 2016
1 parent e813704 commit 46b2065
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 20 deletions.
3 changes: 2 additions & 1 deletion examples/go.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion examples/gopher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/hdri.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/hits.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/love.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/materials.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/maze.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/mol.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/qbert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/refraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/sdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/spheres-anim.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion examples/spheres.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/sponza.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/suzanne.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/teapot.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/toybrick.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 2 additions & 1 deletion examples/veach_scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
3 changes: 2 additions & 1 deletion examples/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 46b2065

Please sign in to comment.