Path: chuka.playstation.co.uk!scea!greg_labrec@interactive.sony.com From: Tim O'Neil Newsgroups: scea.yaroze.programming.3d_graphics Subject: Re: Creating a TMD on the fly Date: Sun, 15 Jun 1997 11:45:17 -0400 Organization: SCEA Net Yaroze News Lines: 29 Message-ID: <33A40E0D.2342@chat.carleton.ca> References: <338C1E17.60C8@netcom.ca> <338CE63F.7F1E@netcom.ca> <33974F23.5973@chat.carleton.ca> <33975697.36340616@205.149.189.29> NNTP-Posting-Host: obatanga.carleton.ca Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01Gold (Win95; I) Mario Perdue wrote: > > While floating point calculations would make the code easier to write, > it would also cause the program to run slower. I use the FPU (in PC's) > for all my CAD programs, but never in games. > > Mario Actually, depending on the processor, floating point's wouldn't cause any appreciable performance hit at all. True, they take more space than a 16-bit integer but from the information I have seen, float adds and multiplies can be comparable to integer operations (mind you the data I saw was for Pentium processors). I guess it just comes down to the cost of using floating points to the cost of the type conversions that have to happen with integers. For example, how many instructions are generated when multiplying one of the rotational values of the matrix (16-bit, shifted-12 integer) with one of the tranlation values (32-bit un-shifted integer)... a few shifts and a couple of type conversions as opposed to a single float multiply instruction. That question aside, I would have at least liked to see the matrices be all longs as opposed to just shorts for the 3x3 and longs for the rest. At least that way you could represent larger numbers than just +-7 (for scaling etc). That and you wouldn't have to worry about type conversions and losing accuracy whenever you multiply. Not to mention that to load an unaligned short for the playstation's processor generates a fair number more assembler instuctions than for an aligned one or a long (9 shorts in a matrix... almost always going to be at least on unaligned by my reckoning).