I dont think SDL_math is a good idea from a personal standpoint. Most math
encapsulation is done for use of algorithms. Algorithms that must be
optimized, and encapsulating it defeats the purpose of using a particular
structure or class in the first place.
You have to tie in the data structure quite closely to the algorithm in
some cases. I dont know if this is true in modern game design, but some
function overhead or class overhead could have more impact then the actual
operation itself.
The trick is to design around array operations.
Granted the code can be inlined and you can return
references and operator overloading and everything else, but still. The
more generic it is, the least useful it is. A programmer should write his
own math routines to tailor his graphics engine, not the other way around.
Not quite. These days, there are various SIMD extensions both in the CPUs and
on the video cards, and these happen to fit very nicely behind the APIs of
traditional array based math libraries.
Obviously, you have to design your algorithms around array operations to make
use of this, just as you have to design a 3D game around a 3D API to make use
of hardware 3D acceleration.
IMHO, sometimes too much encapsulation is a bad thing. A simple API lets
the programmer do the programming, and less time reading docs…
Right, but I don’t see how this applies to a high speed math library… I
mean, it has to be array based for performance and SIMD acceleration support,
and the API has to be rather simple to minimize overhead.
Any API that takes too much time to learn in relation to the benefits is very
likely poorly designed, or just the wrong tool for your project.
I mean,
even if it takes the guy twice as long to do it himself then to figure out
the docs, its worth it in my opinion.
That won’t work if you have to code for a living. The priority is getting the
product out in time - all other things are secondary, and can be sacrificed
to meet the deadline, even if that means that lots of code will have to be
thrown away and rewritten for the next release…
I am sick and tired of reading docs…
Thats why people who programmed DOS were so pissed off at Win32 API that
had a function for everything… its a lot more enjoyable just trying to
program instead of spending 90% of your time referencing docs or working
around bugs…I swear if I have to work around one more MFC bug at work Im
going to choke gates
Why are you assuming that “API” is synonymous to various crap from MS? There
is a big difference between "must get all of this in before the deadline"
style APIs and properly designed stuff. It doesn’t have to be nasty just
because it’s called “API”!
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -'On Wednesday 28 March 2001 20:10, Matt Johnson wrote: