mirror of
https://github.com/overte-org/overte.git
synced 2025-04-15 12:28:51 +02:00
Added history of view to try to adjust for GPU slower than game
This commit is contained in:
parent
ebe05d1f6f
commit
ae63610582
8 changed files with 21 additions and 4 deletions
|
@ -5447,7 +5447,9 @@ void Application::update(float deltaTime) {
|
|||
|
||||
{
|
||||
QMutexLocker viewLocker(&_viewMutex);
|
||||
appRenderArgs._prevView = glm::inverse(_displayViewFrustum.getView());
|
||||
_myCamera.loadViewFrustum(_displayViewFrustum);
|
||||
appRenderArgs._view = glm::inverse(_displayViewFrustum.getView());
|
||||
}
|
||||
|
||||
{
|
||||
|
|
|
@ -617,6 +617,8 @@ private:
|
|||
struct AppRenderArgs {
|
||||
render::Args _renderArgs;
|
||||
glm::mat4 _eyeToWorld;
|
||||
glm::mat4 _view;
|
||||
glm::mat4 _prevView;
|
||||
glm::mat4 _eyeOffsets[2];
|
||||
glm::mat4 _eyeProjections[2];
|
||||
glm::mat4 _headPose;
|
||||
|
|
|
@ -64,6 +64,7 @@ void Application::paintGL() {
|
|||
glm::mat4 HMDSensorPose;
|
||||
glm::mat4 HMDSensorPrevPose;
|
||||
glm::mat4 eyeToWorld;
|
||||
glm::mat4 prevEyeToWorld;
|
||||
glm::mat4 sensorToWorld;
|
||||
|
||||
bool isStereo;
|
||||
|
@ -92,7 +93,8 @@ void Application::paintGL() {
|
|||
|
||||
{
|
||||
PROFILE_RANGE(render, "/gpuContextReset");
|
||||
_gpuContext->beginFrame(HMDSensorPose, HMDSensorPrevPose);
|
||||
_gpuContext->beginFrame(_appRenderArgs._view, _appRenderArgs._prevView,
|
||||
HMDSensorPose, HMDSensorPrevPose);
|
||||
// Reset the gpu::Context Stages
|
||||
// Back to the default framebuffer;
|
||||
gpu::doInBatch("Application_render::gpuContextReset", _gpuContext, [&](gpu::Batch& batch) {
|
||||
|
|
|
@ -341,10 +341,12 @@ void HmdDisplayPlugin::updateFrameData() {
|
|||
auto invBatchPose = glm::inverse(_currentFrame->pose);
|
||||
auto invPrevBatchPose = glm::inverse(_currentFrame->prevPose);
|
||||
auto correction = invBatchPose * _currentPresentFrameInfo.presentPose;
|
||||
auto prevCorrection = invPrevBatchPose * _previousPresentFrameInfo.presentPose;
|
||||
auto prevCorrection = /*_currentFrame->prevView * glm::inverse(_prevRenderView) */ invPrevBatchPose * _previousPresentFrameInfo.presentPose;
|
||||
|
||||
getGLBackend()->setCameraCorrection(correction, prevCorrection);
|
||||
|
||||
_previousPresentFrameInfo = _currentPresentFrameInfo;
|
||||
_prevRenderView = _currentFrame->view;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -80,6 +80,7 @@ protected:
|
|||
FrameInfo _currentPresentFrameInfo;
|
||||
FrameInfo _previousPresentFrameInfo;
|
||||
FrameInfo _currentRenderFrameInfo;
|
||||
mat4 _prevRenderView;
|
||||
RateCounter<> _stutterRate;
|
||||
|
||||
bool _disablePreview { true };
|
||||
|
|
|
@ -53,12 +53,15 @@ const std::string& Context::getBackendVersion() const {
|
|||
return _backend->getVersion();
|
||||
}
|
||||
|
||||
void Context::beginFrame(const glm::mat4& renderPose, const glm::mat4& prevRenderPose) {
|
||||
void Context::beginFrame(const glm::mat4& renderView, const glm::mat4& prevRenderView,
|
||||
const glm::mat4& renderPose, const glm::mat4& prevRenderPose) {
|
||||
assert(!_frameActive);
|
||||
_frameActive = true;
|
||||
_currentFrame = std::make_shared<Frame>();
|
||||
_currentFrame->pose = renderPose;
|
||||
_currentFrame->prevPose = prevRenderPose;
|
||||
_currentFrame->view = renderView;
|
||||
_currentFrame->prevView = prevRenderView;
|
||||
|
||||
if (!_frameRangeTimer) {
|
||||
_frameRangeTimer = std::make_shared<RangeTimer>("gpu::Context::Frame");
|
||||
|
|
|
@ -161,7 +161,8 @@ public:
|
|||
|
||||
const std::string& getBackendVersion() const;
|
||||
|
||||
void beginFrame(const glm::mat4& renderPose = glm::mat4(), const glm::mat4& prevRenderPose = glm::mat4());
|
||||
void beginFrame(const glm::mat4& renderView = glm::mat4(), const glm::mat4& prevRenderView = glm::mat4(),
|
||||
const glm::mat4& renderPose = glm::mat4(), const glm::mat4& prevRenderPose = glm::mat4());
|
||||
void appendFrameBatch(Batch& batch);
|
||||
FramePointer endFrame();
|
||||
|
||||
|
|
|
@ -28,6 +28,10 @@ namespace gpu {
|
|||
|
||||
StereoState stereoState;
|
||||
uint32_t frameIndex{ 0 };
|
||||
/// The view matrix used for rendering the frame, only applicable for HMDs
|
||||
Mat4 view;
|
||||
/// The view matrix used for rendering the previous frame, only applicable for HMDs
|
||||
Mat4 prevView;
|
||||
/// The sensor pose used for rendering the frame, only applicable for HMDs
|
||||
Mat4 pose;
|
||||
/// The sensor pose used for rendering the previous frame, only applicable for HMDs
|
||||
|
|
Loading…
Reference in a new issue