Use builtin fabs
This commit is contained in:
parent
d534aaa834
commit
0cec4acd6b
@ -11,6 +11,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
#include <math.h>
|
||||||
#ifdef SWITCH
|
#ifdef SWITCH
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,9 +5,5 @@
|
|||||||
float approxSin(float x);
|
float approxSin(float x);
|
||||||
|
|
||||||
inline float clamp(float x, float min, float max) {
|
inline float clamp(float x, float min, float max) {
|
||||||
return x<min ? min : x>max ? max : x;
|
return x<min ? min : x > max ? max : x;
|
||||||
}
|
|
||||||
|
|
||||||
inline float nxfabs(float x) {
|
|
||||||
return x < 0 ? -x : x;
|
|
||||||
}
|
}
|
@ -219,7 +219,7 @@ void drawWave(float timer, color_t color, float height, float phase, float speed
|
|||||||
new_color = waveBlendAdd(existing_color, color, clamp(alpha, 0.0, 1.0) * 0.3);
|
new_color = waveBlendAdd(existing_color, color, clamp(alpha, 0.0, 1.0) * 0.3);
|
||||||
}
|
}
|
||||||
else if (alpha < 0.3) { // anti-aliasing
|
else if (alpha < 0.3) { // anti-aliasing
|
||||||
alpha = nxfabs(alpha);
|
alpha = fabs(alpha);
|
||||||
new_color = MakeColor(color.r * (1.0 - alpha) + existing_color.r * alpha, color.g * (1.0 - alpha) + existing_color.g * alpha, color.b * (1.0 - alpha) + existing_color.b * alpha, 255);
|
new_color = MakeColor(color.r * (1.0 - alpha) + existing_color.r * alpha, color.g * (1.0 - alpha) + existing_color.g * alpha, color.b * (1.0 - alpha) + existing_color.b * alpha, 255);
|
||||||
}
|
}
|
||||||
else { // darken closer to bottom of the waves
|
else { // darken closer to bottom of the waves
|
||||||
|
Loading…
Reference in New Issue
Block a user