Skip to content

Commit

Permalink
cosine perspective correction
Browse files Browse the repository at this point in the history
  • Loading branch information
ssloy committed Feb 10, 2019
1 parent ff7d714 commit 35ed743
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 1 deletion.
Binary file added doc/008.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/008.mkv
Binary file not shown.
2 changes: 1 addition & 1 deletion tinyraycaster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 35ed743

Please sign in to comment.