-- how it works -- takes the distance between the mouse cursor and normalizes it. Then it takes the end point of the line and adds the normalized vector to it (multiplied by the diagonal of the screen width and height). it clips the line at the edge of the screen and returns those coordinates in a triangle array. the program figures out the vertices of the shadow and triangulates it (defiantly the most tedious task that I did) and uses a triangle filler to draw the shadows approximately 2 - 6 triangles per shadow (i could try to optimize it further as it does draw useless triangles but i don't want to do that right now) haven't got around to optimizing this yet can you make a faster raycaster than this (using maths)? -- credits -- line clippings by @PutneyCat (too lazy to make my own) all other code by myself