I rewrote the C module to a Cython file. It runs at about 1.33 the speed of the C module, but I believe that's mainly because I'm using tuples all over the place instead of C structs. My guess is that the decrease in speed would become very moderate after optimizing. The new module also got rid of a bug in the C module where objects would disappear when being too far from the viewing plane.
Even if after optimizing there isn't a huge performance gain, I think the penalty would be well worth it. The code is less than half the length and didn't take long to write..
Here is an image:
Again, two identical, separated spheres.
There is also some primitive lighting. Note the "banding"... It is caused because the program is rounding floats to ints. Shouldn't be very tough to fix.
No comments:
Post a Comment