mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-13 07:49:19 +01:00
WiimoteEmu: Increase Camera FOV constants to 42 by 31.5 degrees.
This commit is contained in:
parent
1063c4e940
commit
761f7798c9
@ -75,9 +75,6 @@ void CameraLogic::Update(const Common::Matrix44& transform)
|
|||||||
using Common::Vec3;
|
using Common::Vec3;
|
||||||
using Common::Vec4;
|
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).
|
// 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.
|
// Sending all 4 points can actually cause some stuttering issues.
|
||||||
constexpr int NUM_POINTS = 2;
|
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.
|
// This is reduced based on distance from sensor bar.
|
||||||
constexpr int MAX_POINT_SIZE = 15;
|
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<Vec3, NUM_POINTS> leds{
|
const std::array<Vec3, NUM_POINTS> leds{
|
||||||
Vec3{-SENSOR_BAR_LED_SEPARATION / 2, 0, 0},
|
Vec3{-SENSOR_BAR_LED_SEPARATION / 2, 0, 0},
|
||||||
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))) *
|
Matrix44::FromMatrix33(Matrix33::RotateX(float(MathUtil::TAU / 4))) *
|
||||||
transform;
|
transform;
|
||||||
|
|
||||||
|
@ -91,13 +91,17 @@ static_assert(sizeof(IRFull) == 9, "Wrong size");
|
|||||||
class CameraLogic : public I2CSlave
|
class CameraLogic : public I2CSlave
|
||||||
{
|
{
|
||||||
public:
|
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_X = 1024;
|
||||||
static constexpr int CAMERA_RES_Y = 768;
|
static constexpr int CAMERA_RES_Y = 768;
|
||||||
|
|
||||||
// Wiibrew claims the camera FOV is about 33 deg by 23 deg.
|
// Jordan: I calculate the FOV at 42 degrees horizontally and having a 4:3 aspect ratio.
|
||||||
// Unconfirmed but it seems to work well enough.
|
// This is 31.5 degrees vertically.
|
||||||
static constexpr int CAMERA_FOV_X_DEG = 33;
|
static constexpr float CAMERA_AR = 4.f / 3;
|
||||||
static constexpr int CAMERA_FOV_Y_DEG = 23;
|
static constexpr float CAMERA_FOV_X = 42 * float(MathUtil::TAU) / 360;
|
||||||
|
static constexpr float CAMERA_FOV_Y = CAMERA_FOV_X / CAMERA_AR;
|
||||||
|
|
||||||
enum : u8
|
enum : u8
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user