added cpp implementation of restore (raytracing)