diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp index 05e28c7930..46ec87f672 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Camera.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/Camera.cpp @@ -75,9 +75,6 @@ void CameraLogic::Update(const Common::Matrix44& transform) using Common::Vec3; using Common::Vec4; - constexpr auto CAMERA_FOV_Y = float(CAMERA_FOV_Y_DEG * MathUtil::TAU / 360); - constexpr auto CAMERA_ASPECT_RATIO = float(CAMERA_FOV_X_DEG) / CAMERA_FOV_Y_DEG; - // FYI: A real wiimote normally only returns 1 point for each LED cluster (2 total). // Sending all 4 points can actually cause some stuttering issues. constexpr int NUM_POINTS = 2; @@ -86,16 +83,12 @@ void CameraLogic::Update(const Common::Matrix44& transform) // This is reduced based on distance from sensor bar. constexpr int MAX_POINT_SIZE = 15; - // Sensor bar: - // Distance in meters between LED clusters. - constexpr float SENSOR_BAR_LED_SEPARATION = 0.2f; - const std::array leds{ Vec3{-SENSOR_BAR_LED_SEPARATION / 2, 0, 0}, Vec3{SENSOR_BAR_LED_SEPARATION / 2, 0, 0}, }; - const auto camera_view = Matrix44::Perspective(CAMERA_FOV_Y, CAMERA_ASPECT_RATIO, 0.001f, 1000) * + const auto camera_view = Matrix44::Perspective(CAMERA_FOV_Y, CAMERA_AR, 0.001f, 1000) * Matrix44::FromMatrix33(Matrix33::RotateX(float(MathUtil::TAU / 4))) * transform; diff --git a/Source/Core/Core/HW/WiimoteEmu/Camera.h b/Source/Core/Core/HW/WiimoteEmu/Camera.h index 4a98d33325..6d07d720da 100644 --- a/Source/Core/Core/HW/WiimoteEmu/Camera.h +++ b/Source/Core/Core/HW/WiimoteEmu/Camera.h @@ -91,13 +91,17 @@ static_assert(sizeof(IRFull) == 9, "Wrong size"); class CameraLogic : public I2CSlave { public: + // OEM sensor bar distance between LED clusters in meters. + static constexpr float SENSOR_BAR_LED_SEPARATION = 0.2f; + static constexpr int CAMERA_RES_X = 1024; static constexpr int CAMERA_RES_Y = 768; - // Wiibrew claims the camera FOV is about 33 deg by 23 deg. - // Unconfirmed but it seems to work well enough. - static constexpr int CAMERA_FOV_X_DEG = 33; - static constexpr int CAMERA_FOV_Y_DEG = 23; + // Jordan: I calculate the FOV at 42 degrees horizontally and having a 4:3 aspect ratio. + // This is 31.5 degrees vertically. + static constexpr float CAMERA_AR = 4.f / 3; + static constexpr float CAMERA_FOV_X = 42 * float(MathUtil::TAU) / 360; + static constexpr float CAMERA_FOV_Y = CAMERA_FOV_X / CAMERA_AR; enum : u8 {