class Rubytracer::Camera
Public Class Methods
new(view, scene)
click to toggle source
# File lib/rubytracer/camera.rb, line 3 def initialize(view, scene) @view = view @scene = scene end
Public Instance Methods
colour_of_pixel(row, col)
click to toggle source
# File lib/rubytracer/camera.rb, line 8 def colour_of_pixel(row, col) ray = @view.eye_ray(row, col) obj, t = @scene.intersect(ray) if t == Float::INFINITY Colour.new(0.6,0.6,0.6) else pos = ray.pos(t) normal = obj.normal(pos) obj.material.lit_colour(@scene, normal, -ray.dir, pos) end end