-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Kaze's folded polynomials #64
base: develop/1.0.0
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand a lot how this is working (I'm bad at maths) but here we are
|
||
#ifdef DISABLE_LOOKUP_TABLE | ||
|
||
#define ONE 1.0f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why using a macro for this? it looks weird to me 🤔 (the ONE
one)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah i thought i would need to do the function twice and forgot
it would be nice if we're implementing more optimisation stuff like this, also you should change the target of the PR to should I make dev the default branch and rename master to something like "release"? idk if this would break something (I'll probably do it after all opened PRs targeting master are merged if everyone agrees on that idea) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll approve as soon as I test this
should be good for testing |
I already said this on discord but I'm writing it here just for history purposes, the camera is acting weird so I'll wait until this is fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the camera is still acting weird
include/config/config_game.h
Outdated
@@ -9,6 +9,9 @@ | |||
// Disables AA (Improves console performance but causes visible seams between unconnected geometry). | |||
//#define DISABLE_AA | |||
|
|||
// Use a folded polynomial instead of a lookup table. This has a speed boots and makes the calculation more precise. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boots
src/libultra/gu/sins.c
Outdated
/** | ||
* @param angle binang | ||
* @return sin(angle)*0x7FFF | ||
*/ | ||
s16 sins(u16 angle) { | ||
#ifdef DISABLE_SIN_COS_LOOKUP_TABLE | ||
return Math_SinS(angle) * 0x7FFF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function isn't declared (just add #include "functions.h"
) and it returns a f32, not s16, I feel like we should add a cast here (same comment for coss for the cast)
911ecce
to
5c7a4d1
Compare
farores wind crashes |
so ive been looking into this |
this uses Kaze Emuar's "folded polynomial" sine and cosine functions. it works by calculating a small section of the polynomial and mirrors it for the rest. this not only saves ram but seems faster than the lookup table.
Edit: forgot to mention this vastly improves animation quality.