Permalink
Browse files

cosine perspective correction

  • Loading branch information...
ssloy committed Feb 9, 2019
1 parent ff7d714 commit 35ed743b6f4fbe84b454edde5d04c1c5518bcbf0
Showing with 1 addition and 1 deletion.
  1. BIN doc/008.gif
  2. BIN doc/008.mkv
  3. +1 −1 tinyraycaster.cpp
BIN +1.62 MB doc/008.gif
Binary file not shown.
BIN +98.9 KB doc/008.mkv
Binary file not shown.
@@ -111,7 +111,7 @@ int main() {
if (map[int(cx)+int(cy)*map_w]!=' ') { // our ray touches a wall, so draw the vertical column to create an illusion of 3D
size_t icolor = map[int(cx)+int(cy)*map_w] - '0';
assert(icolor<ncolors);
size_t column_height = win_h/t;
size_t column_height = win_h/(t*cos(angle-player_a));
draw_rectangle(framebuffer, win_w, win_h, win_w/2+i, win_h/2-column_height/2, 1, column_height, colors[icolor]);
break;
}

0 comments on commit 35ed743

Please sign in to comment.