Day 12, Spheres on a plane
Spheres are nice and all, but we need more shapes to make the world go around. So, a little bit of refactoring to get most the juicy bits from spheres apply to every kind of shape, such as planes. So flat, and infinite.
See, the seemingly flat floor and walls used to be very flat spheres, and not planes at all.
While messing around with non-square aspect ratios, trying to capture the scene, I got bit by a nasty bug in the camera:
def initialize(width, height, fov)
aspect_ratio = width / height
The width
and height
of the camera is measured in canvas pixels, so they are integers, which caused an integer division when calculating the aspect ratio, with surprising results. Rational numbers to the resque:
def initialize(width, height, fov)
aspect_ratio = Rational(width, height)
Next related
Day 13, Big Stripey Lie
Previous related
Day 11, Into the Shadows
After todays work we can render the shadows cast by objects in our scenes!
Day 10, A world full of spheres
With the development environment fixed, using the previous progress to render a world with multiple is as simple as creating the camera:
Day 9, lost to Ruby environment trouble
No progress because it turned out that the Ruby / bundler environment on my laptop was not functional anymore, so the little time I had while away over the weekend got wasted on debugging why nothing worked instead of doing something productive.