I'm writing a ray tracer based on Peter Shirley's "Ray tracing in one weekend" book. The code in the book is written in C++ and he used virtual functions (ugh) to delegate the task of computing if an object in the scene has been hit by a ray to the object themselves. I rewrote it in Go, and the interfaces there are so much better to work with, because of the real separation between interface and implementation. Now I'd like to rewrite it in C, but how should I deal with polymorphism? I ask here because maybe someone came up with a simple solution which works in general, when you have to implement polymorphism in C.