mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-24 13:09:16 +01:00
fix(render): the free camera blurs with its own movement in the OpenGL 4.6 and Vulkan renderers
This commit is contained in:
27
rendering/common/freecameramotion.cpp
Normal file
27
rendering/common/freecameramotion.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
This Source Code Form is subject to the
|
||||
terms of the Mozilla Public License, v.
|
||||
2.0. If a copy of the MPL was not
|
||||
distributed with this file, You can
|
||||
obtain one at
|
||||
http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "rendering/common/freecameramotion.h"
|
||||
|
||||
glm::vec3 gfx::free_camera_motion::next_frame(glm::dvec3 const &Position)
|
||||
{
|
||||
glm::vec3 movement{0.f};
|
||||
if (m_previous)
|
||||
{
|
||||
auto const step{glm::vec3{Position - *m_previous}};
|
||||
// a position that isn't a number (a camera gone wrong) fails the comparison and gives no movement either
|
||||
if (auto const length{glm::length(step)}; length < static_cast<float>(jump))
|
||||
{
|
||||
movement = (length > longest) ? step * (longest / length) : step;
|
||||
}
|
||||
}
|
||||
m_previous = Position;
|
||||
return movement;
|
||||
}
|
||||
Reference in New Issue
Block a user