you are describing projected textures + shadow mapping.

http://en.wikipedia.org/wiki/Shadow_mapping

see: http://www.delphi3d.net/listfiles.php?category=4

Specifically these two:

http://www.delphi3d.net/download/shadowmap.zip
http://www.delphi3d.net/download/projshadow.zip