Menu
Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Vault
Time Travel Schematics
T.E.C. Time Archive
The Why Files
Have You Seen...?
Chronovisor
TimeTravelForum.tk
TimeTravelForum.net
ParanormalNetwork.net
Paranormalis.com
ConspiracyCafe.net
Streams
Live streams
Featured streams
Multi-Viewer
Members
Current visitors
New profile posts
Search profile posts
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
General Discussion Forum
Computing, Gaming & Tech Talk
My first experience at Doom mapping
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Martian" data-source="post: 225953" data-attributes="member: 6511"><p>Doom was innovative in its day. Back before GPU shaders & everything being done for you, you had to (as a programmer) actually optimize code & make sure it would run fast enough. One of the most basic tasks which required optimization was normalizing vectors, which involves the reciprocal of the square root. They implemented it like this:</p><p></p><p>[CODE=c]float fastInvSqrt(float number) {</p><p> long i;</p><p> float x2, y;</p><p> const float threehalfs = 1.5f;</p><p></p><p> x2 = number * 0.5f;</p><p> y = number;</p><p> i = * ( long * ) &y; // evil floating point bit level hacking</p><p> i = 0x5f3759df - ( i >> 1 ); // what the fuck?</p><p> y = * ( float * ) &i;</p><p> y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration</p><p>// y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed</p><p></p><p> return y;</p><p>}</p><p>[/CODE]</p><p></p><p>This was the 1990s equivalent of witchcraft. <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite45" alt=":D" title="Big grin :D" loading="lazy" data-shortname=":D" /></p><p></p><p>Edit: I'm a complete idiot. It was Quake III Arena that implemented that, not Doom. Same company though! <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite44" alt=":p" title="Stick out tongue :p" loading="lazy" data-shortname=":p" /> That's what I get for trying to comment on technical stuff when drinking. lol</p></blockquote><p></p>
[QUOTE="Martian, post: 225953, member: 6511"] Doom was innovative in its day. Back before GPU shaders & everything being done for you, you had to (as a programmer) actually optimize code & make sure it would run fast enough. One of the most basic tasks which required optimization was normalizing vectors, which involves the reciprocal of the square root. They implemented it like this: [CODE=c]float fastInvSqrt(float number) { long i; float x2, y; const float threehalfs = 1.5f; x2 = number * 0.5f; y = number; i = * ( long * ) &y; // evil floating point bit level hacking i = 0x5f3759df - ( i >> 1 ); // what the fuck? y = * ( float * ) &i; y = y * ( threehalfs - ( x2 * y * y ) ); // 1st iteration // y = y * ( threehalfs - ( x2 * y * y ) ); // 2nd iteration, this can be removed return y; } [/CODE] This was the 1990s equivalent of witchcraft. :D Edit: I'm a complete idiot. It was Quake III Arena that implemented that, not Doom. Same company though! :P That's what I get for trying to comment on technical stuff when drinking. lol [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
General Discussion Forum
Computing, Gaming & Tech Talk
My first experience at Doom mapping
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top