Day 13, Big Stripey Lie
Single color objects are boring, so some color patterns would be a nice addition. Like stripes, alternating between two colors, a
and b
.
def color_at(point)
(point.x.floor % 2).zero? ? @a : @b
end
Ok, uniform stripes all over the world is not the best thing, so they need to have transforms attached, like everything else. That’s more like it.
def color_at_object(object, point)
object_point = object.inverse * point
pattern_point = @inverse * object_point
color_at(pattern_point)
end
Next related
Day 14, Patterns, patterns, patterns
Previous related
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.
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: