-
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?
Changes from 7 commits
62a67e0
f73b53b
8497877
92bef06
397468f
5c7a4d1
bfae4f1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -218,3 +218,11 @@ extern struct GraphicsContext* __gfxCtx; | |
} while (0) | ||
|
||
#endif | ||
|
||
#ifdef DISABLE_SIN_COS_LOOKUP_TABLE | ||
|
||
#define ONE 1.0f | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why using a macro for this? it looks weird to me 🤔 (the There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
#define SECOND_ORDER_COEFFICIENT 0.0000000010911122665310369f | ||
Yanis002 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
#define quasi_cos_2(x) (ONE - SECOND_ORDER_COEFFICIENT * x * x) | ||
|
||
#endif |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
#include "global.h" | ||
|
||
#include "config.h" | ||
/** | ||
* @param angle binang | ||
* @return cos(angle)*0x7FFF | ||
*/ | ||
s16 coss(u16 angle) { | ||
#ifdef DISABLE_SIN_COS_LOOKUP_TABLE | ||
return Math_CosS(angle) * 0x7FFF; | ||
#else | ||
return sins(angle + 0x4000); | ||
#endif | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
#include "ultra64.h" | ||
|
||
#include "config.h" | ||
#ifndef DISABLE_SIN_COS_LOOKUP_TABLE | ||
#include "sintable.inc.c" | ||
|
||
#endif | ||
/** | ||
* @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 commentThe reason will be displayed to describe this comment to others. Learn more. this function isn't declared (just add |
||
#else | ||
s16 value; | ||
|
||
angle >>= 4; | ||
|
@@ -22,4 +27,5 @@ s16 sins(u16 angle) { | |
} else { | ||
return value; | ||
} | ||
#endif | ||
} |
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