Tweak the galaxy
diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp
index 0ecdf9a..5f8ee2a 100644
--- a/libs/rs/rsScriptC_Lib.cpp
+++ b/libs/rs/rsScriptC_Lib.cpp
@@ -170,6 +170,44 @@
#define DEG_TO_RAD PI / 180.0f
#define RAD_TO_DEG 180.0f / PI
+static float SC_sinf_fast(float x)
+{
+ const float A = 1.0f / (2.0f * M_PI);
+ const float B = -16.0f;
+ const float C = 8.0f;
+
+ // scale angle for easy argument reduction
+ x *= A;
+
+ if (fabsf(x) >= 0.5f) {
+ // argument reduction
+ x = x - ceilf(x + 0.5f) + 1.0f;
+ }
+
+ const float y = B * x * fabsf(x) + C * x;
+ return 0.2215f * (y * fabsf(y) - y) + y;
+}
+
+static float SC_cosf_fast(float x)
+{
+ x += float(M_PI / 2);
+
+ const float A = 1.0f / (2.0f * M_PI);
+ const float B = -16.0f;
+ const float C = 8.0f;
+
+ // scale angle for easy argument reduction
+ x *= A;
+
+ if (fabsf(x) >= 0.5f) {
+ // argument reduction
+ x = x - ceilf(x + 0.5f) + 1.0f;
+ }
+
+ const float y = B * x * fabsf(x) + C * x;
+ return 0.2215f * (y * fabsf(y) - y) + y;
+}
+
static float SC_randf(float max)
{
float r = (float)rand();
@@ -846,6 +884,10 @@
"int", "(int)" },
{ "absf", (void *)&fabs,
"float", "(float)" },
+ { "sinf_fast", (void *)&SC_sinf_fast,
+ "float", "(float)" },
+ { "cosf_fast", (void *)&SC_cosf_fast,
+ "float", "(float)" },
{ "sinf", (void *)&sinf,
"float", "(float)" },
{ "cosf", (void *)&cosf,