This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
trs:fundamentals [2020/05/19 14:14]
zdimension [32 bit Fixed Point Data Type]
trs:fundamentals [2020/05/19 14:16] (current)
zdimension [Fixed Point Data Types]
Line 75: Line 75:
 ...where $P_{whole}$ is whole part of mixed float (signed for ''fixed'', unsigned for ''ufixed16''), and $P_{frac}$ is fractional part (unsigned). ...where $P_{whole}$ is whole part of mixed float (signed for ''fixed'', unsigned for ''ufixed16''), and $P_{frac}$ is fractional part (unsigned).
 +The reason why such complicated setup was invented is to avoid using floating-point numbers. In 90% of all cases, Tomb Raider engines use integer numbers, even
 +for geometry calculations and animation interpolations. The root of this setup lies in multi-platform nature of the code, which was simultaneously written for PC and PlayStation. While PCs had enough computational power to deal with floats at that time, PlayStation relied only on integers.
 +However, some internal variables and constants (like drawing distance, fog distance constants and some light properties) are PC-specific and stored in floating
 +point numbers. Also, last game in series, TR5, extensively used floating-point numbers for certain data types – like colours, vertices and coordinates.
 ==== Data Alignment ==== ==== Data Alignment ====
trs/fundamentals.txt · Last modified: 2020/05/19 14:16 (external edit)
Back to top
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0