Realistic Image Synthesis Using Photon Mapping

This appendix contains a full C++ implementation of a photon map class. This class can be integrated into any ray tracer to provide the basic tool to add caustics and simple global illumination. The only additional code to add to such a ray tracer is photon tracing (emission of photons from the lights, and scattering and storing of photons by the materials). These photons can then be handled by the photon map implementation provided below. The usage of the implementation should be fairly easy to understand.
1 //----------------------------------------------------------------------------- // photonmap.cc // An example implementation of the photon map data structure // // Henrik Wann Jensen - February 2001 //----------------------------------------------------------------------------- <i class="emphasis">#</i>include<i class="emphasis">#</i>include 10 <i class="emphasis">#</i>include <i class="emphasis">#</i>include <a name="451"></a><a name="IDX-158"></a> /* This is the photon * The power is not compressed so the * size is 28 bytes */ //********************** typedef struct Photon { 20 //********************** float pos[3]; // photon position short plane; ...