A ray tracer written in lua for the Ti Nspire CX - II
The scene has to be edited by changing the source code. The default example has 2 spheres placed on a plane, illuminated by a point source of light above them.
the objects
global variable contains a list of all the objects present in the scene. Each object has its own properties,
described in the beginning of each class decleration.
The program checks whether it is being run on a calculator by checking the platform
environment variable. If it is on the calculator, the output is painted on the display, otherwise a bitmap image called p6.bpm
is saved in the current working directory.
The b2m.lua
file is used from rosettacode.org and is only used to check the the image generated on a computer, it is only used for debugging.
The following shapes are supported by the renderer:
- 2D Plane
- Sphere
The colours are stored as vectors, as it was necessary to save on the little memory that we have on the calculator.
instead of the object being interpreted as {x,y,z}
for coordinated, it is interpreted as {R,G,B}
for colour values.