From 657f2455ff276a72f52708890fba83e9065b89cd Mon Sep 17 00:00:00 2001 From: elijah-thomas774 Date: Sun, 8 Jun 2025 00:35:02 -0400 Subject: [PATCH] use cmath for sinf/cosf --- .../MSL/MSL_C/MSL_Common/Include/cmath | 6 +++++- src/d/d_light_env.cpp | 18 +++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath index d6685a2a..492c6fda 100644 --- a/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath +++ b/src/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/Include/cmath @@ -33,7 +33,7 @@ using ::modff; using ::pow; using ::scalbn; using ::sin; -using ::sinf; +// using ::sinf; using ::sqrt; // using ::sqrtf; using ::tan; @@ -51,6 +51,10 @@ inline float cosf(float x) { return cos(x); } +inline float sinf(float x) { + return sin(x); +} + inline float sqrtf(float x) { return ::sqrtf(x); } diff --git a/src/d/d_light_env.cpp b/src/d/d_light_env.cpp index 8ddcbe90..00671095 100644 --- a/src/d/d_light_env.cpp +++ b/src/d/d_light_env.cpp @@ -11,6 +11,8 @@ #include "m/m_vec.h" #include "nw4r/math/math_arithmetic.h" +#include + dLightEnv_c dLightEnv_c::sInstance; dLightEnv_c *dLightEnv_c::sPInstance; @@ -39,24 +41,14 @@ void dLightEnv_c::get_vectle_calc(const mVec3_c *pInA, const mVec3_c *pInB, mVec vectle_calc(&pos, pOut); } -// TODO(??) -inline f32 sinf(f32 x) { - return sin(x); -} - -// TODO(??) -inline f32 cosf(f32 x) { - return cos(x); -} - void dLightEnv_c::sphere_to_cartesian(f32 angY, f32 angXZ, mVec3_c *pOut) { f32 radY = angY / (180.f / M_PI); f32 radXZ = angXZ / (180.f / M_PI); mVec3_c pos; - pos.x = cosf(radY) * sinf(radXZ); - pos.y = sinf(radY); - pos.z = cosf(radY) * cosf(radXZ); + pos.x = std::cosf(radY) * std::sinf(radXZ); + pos.y = std::sinf(radY); + pos.z = std::cosf(radY) * std::cosf(radXZ); pOut->x = pos.x; pOut->y = pos.y;