restructured program for shadow mapping