mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-03 06:39:33 +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())
|
if (xf_state_manager.DidProjectionChange() || g_freelook_camera.GetController()->IsDirty())
|
||||||
{
|
{
|
||||||
xf_state_manager.ResetProjection();
|
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));
|
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()
|
bool VertexShaderManager::UseVertexDepthRange()
|
||||||
{
|
{
|
||||||
// We can't compute the depth range in the vertex shader if we don't support depth clamp.
|
// 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();
|
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));
|
memcpy(constants.projection.data(), corrected_matrix.data.data(), 4 * sizeof(float4));
|
||||||
dirty = true;
|
dirty = true;
|
||||||
|
|
|
@ -25,6 +25,8 @@ public:
|
||||||
|
|
||||||
// constant management
|
// constant management
|
||||||
void SetProjectionMatrix(XFStateManager& xf_state_manager);
|
void SetProjectionMatrix(XFStateManager& xf_state_manager);
|
||||||
|
void ForceProjectionMatrixUpdate(XFStateManager& xf_state_manager,
|
||||||
|
const Common::Matrix44& modifier);
|
||||||
void SetConstants(XFStateManager& xf_state_manager);
|
void SetConstants(XFStateManager& xf_state_manager);
|
||||||
|
|
||||||
// data: 3 floats representing the X, Y and Z vertex model coordinates and the posmatrix index.
|
// 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;
|
alignas(16) std::array<float, 16> m_projection_matrix;
|
||||||
|
|
||||||
// track changes
|
// track changes
|
||||||
|
Common::Matrix44 m_last_camera_modifier = Common::Matrix44::Identity();
|
||||||
|
|
||||||
Common::Matrix44 LoadProjectionMatrix();
|
Common::Matrix44 LoadProjectionMatrix();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue