GTE: Improve reverse transform freecam
Transform the move direction, that way it behaves more FPS-camera like.
This commit is contained in:
parent
90cb266886
commit
fc5553a8c7
|
@ -56,9 +56,9 @@ namespace {
|
|||
struct ALIGN_TO_CACHE_LINE Config
|
||||
{
|
||||
DisplayAspectRatio aspect_ratio = DisplayAspectRatio::R4_3;
|
||||
u32 custom_aspect_ratio_numerator;
|
||||
u32 custom_aspect_ratio_denominator;
|
||||
float custom_aspect_ratio_f;
|
||||
u32 custom_aspect_ratio_numerator = 0;
|
||||
u32 custom_aspect_ratio_denominator = 0;
|
||||
float custom_aspect_ratio_f = 1.0f;
|
||||
|
||||
#ifdef ENABLE_FREECAM
|
||||
|
||||
|
@ -77,13 +77,13 @@ struct ALIGN_TO_CACHE_LINE Config
|
|||
GSVector4 freecam_translation = GSVector4::cxpr(0.0f);
|
||||
|
||||
ALIGN_TO_CACHE_LINE GSMatrix4x4 freecam_matrix = GSMatrix4x4::Identity();
|
||||
|
||||
GSMatrix4x4 freecam_inverted_rotation_matrix = GSMatrix4x4::Identity();
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
static Config s_config;
|
||||
static constinit Config s_config;
|
||||
|
||||
#define REGS CPU::g_state.gte_regs
|
||||
|
||||
|
@ -1483,7 +1483,11 @@ void GTE::UpdateFreecam(u64 current_time)
|
|||
|
||||
if (!(s_config.freecam_move == GSVector4::zero()).alltrue())
|
||||
{
|
||||
s_config.freecam_translation += s_config.freecam_move * GSVector4(s_config.freecam_move_speed * dt);
|
||||
GSVector4 disp = s_config.freecam_move * GSVector4(s_config.freecam_move_speed * dt);
|
||||
if (s_config.freecam_reverse_transform_order)
|
||||
disp = s_config.freecam_inverted_rotation_matrix * disp;
|
||||
|
||||
s_config.freecam_translation += disp;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
@ -1560,6 +1564,11 @@ void GTE::UpdateFreecam(u64 current_time)
|
|||
any_xform = true;
|
||||
}
|
||||
|
||||
if (any_xform)
|
||||
s_config.freecam_inverted_rotation_matrix = s_config.freecam_matrix.invert();
|
||||
else
|
||||
s_config.freecam_inverted_rotation_matrix = GSMatrix4x4::Identity();
|
||||
|
||||
if (s_config.freecam_translation.x != 0.0f || s_config.freecam_translation.y != 0.0f ||
|
||||
s_config.freecam_translation.z != 0.0f)
|
||||
{
|
||||
|
|
|
@ -85,7 +85,7 @@ static void DrawInputsOverlay();
|
|||
static constexpr size_t NUM_DEBUG_WINDOWS = 7;
|
||||
static constexpr const char* DEBUG_WINDOW_CONFIG_SECTION = "DebugWindows";
|
||||
static constexpr const std::array<DebugWindowInfo, NUM_DEBUG_WINDOWS> s_debug_window_info = {{
|
||||
{"Freecam", "Free Camera", ":icons/applications-system.png", >E::DrawFreecamWindow, 500, 400},
|
||||
{"Freecam", "Free Camera", ":icons/applications-system.png", >E::DrawFreecamWindow, 500, 425},
|
||||
{"SPU", "SPU State", ":icons/applications-system.png", &SPU::DrawDebugStateWindow, 800, 915},
|
||||
{"CDROM", "CD-ROM State", ":icons/applications-system.png", &CDROM::DrawDebugWindow, 800, 540},
|
||||
{"GPU", "GPU State", ":icons/applications-system.png", [](float sc) { g_gpu.DrawDebugStateWindow(sc); }, 450, 550},
|
||||
|
|
Loading…
Reference in New Issue