Game Engine Black Book: Wolfenstein 3D by Fabien Sanglard

Game Engine Black Book: Wolfenstein 3D by Fabien Sanglard

Author:Fabien Sanglard [Sanglard, Fabien]
Language: eng
Format: azw3
Published: 2017-10-06T04:00:00+00:00


This part of the code relies heavily on unit circle principles. As we need to know how much to go vertically when advancing on the X axis and how much to go horizontally when advancing on the Y axis, the tan function is especially useful. This is easier to understand with the unit circle drawn (circle radius r is equal to 1).

Figure 4.44: Unit circle.

When advancing 1 on the X axis, the ray moves up tan(θ) on the Y axis. The reciprocal is calculated as follows: move 1 on Y axis, move tan(90 − θ) on X axis. To accelerate cos, sin and tan calculations, the engine uses lookup table. See 4.11.1 "Cos/Sin Table Lookup".



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.