Lameguy64 / PSn00bSDK

The most powerful open source SDK for the PS1 (as far as open source PS1 SDKs go). Not recommended for beginner use.
Other
845 stars 68 forks source link

Core math library missing #20

Open barf opened 4 years ago

barf commented 4 years ago

Hi this is my first dabble into PSX coding, sorry if I am missing something obvious

I need implementations of cos(), sqrt(), asin(), atan2(), sin() and pow() to build a project, what solutions do other people use for these basic functions?

I cannot find a core math library in here (no libm or libmath), and the other PSX SDKs seem to provide one, do I need to roll my own cos() and sin() etc?

Lameguy64 commented 4 years ago

Floating point math functions are not implemented for the most part in PSn00bSDK as such facilities will perform poorly since the PS1 does not have hardware floating point capability whatsoever. Only math functions implemented are integer based such as isin() and icos() and some GTE accelerated operations such as Square0(), VectorNormalS() and most of the matrix related functions. If you really want floating point math functions you can probably use a math library from another SDK project, but I can't really help you on that as I've never tried or looked into them myself.

ijacquez commented 4 years ago

You need to use fixed point math.

As for trig functions, it's recommended to use tables of precomputed values.