Box & Reflective Tetrahedron

Articles

Using a BSP tree for reflections and object intersection

Raytrace.class 160x160

This was built for efficiency with a single-class binary space tree implementation. The tree is stored in flattened, fixed size arrays for optimal performance - no expensive memory allocation and object creation or deletion.

The render buffer is a byte array which is displayed using a MemoryImageSource and an IndexColorModel (this is 256 colours).

Java applet, run in your browser by CheerpJ (needs an internet connection for the runtime). Main class: Raytrace.class.

Source (3 files)