This small demo was inspired by Left 4k Dead. I wanted to know how the field of view rendering worked, but sadly the code is totally unreadable because it was written by a madman (or genius?). My implementation is hopefully more readable.
Screenshots below shows a flashlight in a map with two rooms connected by a third room.
Figure 1: Flashlight in the left room, beaming light into the right room.
Figure 2: Flashlight in the right room, beaming light into the left room. Only a small part of the light reaches the left room.
Double click on jar file or run java -jar flashlight-final.jar in terminal.
Move the flashlight by dragging it. Direct it by moving the mouse pointer around.