aboutsummaryrefslogtreecommitdiff
path: root/rtiaw
blob: 234aa854535a3da1f43d04bc991da0d449bf5694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env ruby

Maths = Math

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), 'lib'))
require 'interval'
require 'vec3'
require 'ray'
require 'hittable'
require 'camera'
require 'material'

mat_ground = Lambertian.new(0.8, 0.8, 0.0)
mat_centre = Lambertian.new(0.1, 0.2, 0.5)
mat_left = Dielectric.new(1.5)
mat_bubble = Dielectric.new(1 / 1.5)
mat_right = Metal.new(0.8, 0.6, 0.2, 1.0)

world = Hittables.new
world << Sphere.new( 0, -100.5,   -1,    100,    mat_ground)
world << Sphere.new( 0,      0, -1.2,    0.5,    mat_centre)
world << Sphere.new(-1,      0,   -1,    0.5,    mat_left)
world << Sphere.new(-1,      0,   -1,    0.4,    mat_bubble)
world << Sphere.new( 1,      0,   -1,    0.5,    mat_right)

camera = Camera.new(400, 16.0 / 9,
                    vfov: 20,
                    lookfrom: Point.new(-2,2,1))
camera.render(world)