3D Engine / ActionScript 2 / 2005
Found this old thing laying around. Originally started in Flash 4, it's evolved a bit over the years.
The last thing I did was add that shading from the light source.
This is the result of a lot of googling, porting various C code equations, and common sense.
The light is affected by mouse position and you can spin the cube by dragging.