mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-20 11:35:54 +00:00
VideoCommon: add way to force a projection view in the VertexShaderManager
This commit is contained in:
parent
6a21af498a
commit
4c71e8c48b
2 changed files with 16 additions and 2 deletions
|
@ -122,11 +122,21 @@ void VertexShaderManager::SetProjectionMatrix(XFStateManager& xf_state_manager)
|
|||
if (xf_state_manager.DidProjectionChange() || g_freelook_camera.GetController()->IsDirty())
|
||||
{
|
||||
xf_state_manager.ResetProjection();
|
||||
auto corrected_matrix = LoadProjectionMatrix();
|
||||
auto corrected_matrix = LoadProjectionMatrix() * m_last_camera_modifier;
|
||||
memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4));
|
||||
}
|
||||
}
|
||||
|
||||
void VertexShaderManager::ForceProjectionMatrixUpdate(XFStateManager& xf_state_manager,
|
||||
const Common::Matrix44& modifier)
|
||||
{
|
||||
m_last_camera_modifier = modifier;
|
||||
xf_state_manager.ResetProjection();
|
||||
auto corrected_matrix = LoadProjectionMatrix() * m_last_camera_modifier;
|
||||
memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4));
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
bool VertexShaderManager::UseVertexDepthRange()
|
||||
{
|
||||
// We can't compute the depth range in the vertex shader if we don't support depth clamp.
|
||||
|
@ -388,7 +398,7 @@ void VertexShaderManager::SetConstants(XFStateManager& xf_state_manager)
|
|||
{
|
||||
xf_state_manager.ResetProjection();
|
||||
|
||||
auto corrected_matrix = LoadProjectionMatrix();
|
||||
auto corrected_matrix = LoadProjectionMatrix() * m_last_camera_modifier;
|
||||
|
||||
memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4));
|
||||
dirty = true;
|
||||
|
|
|
@ -25,6 +25,8 @@ public:
|
|||
|
||||
// constant management
|
||||
void SetProjectionMatrix(XFStateManager& xf_state_manager);
|
||||
void ForceProjectionMatrixUpdate(XFStateManager& xf_state_manager,
|
||||
const Common::Matrix44& modifier);
|
||||
void SetConstants(XFStateManager& xf_state_manager);
|
||||
|
||||
// data: 3 floats representing the X, Y and Z vertex model coordinates and the posmatrix index.
|
||||
|
@ -81,5 +83,7 @@ private:
|
|||
alignas(16) std::array<float, 16> m_projection_matrix;
|
||||
|
||||
// track changes
|
||||
Common::Matrix44 m_last_camera_modifier = Common::Matrix44::Identity();
|
||||
|
||||
Common::Matrix44 LoadProjectionMatrix();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue