From 40bfeacf21c6c814b676c41f92f4860881563476 Mon Sep 17 00:00:00 2001 From: Imanol Fernandez Date: Fri, 23 Nov 2018 11:37:24 +0100 Subject: [PATCH] Fix 360 video layer after a source quad layer resize (#822) --- app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp b/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp index 23cdd1255..dcc373a93 100644 --- a/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp +++ b/app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp @@ -143,7 +143,7 @@ class OculusLayer { layer->SetCurrentEye(aEye); } - bool IsDrawRequested() const { + virtual bool IsDrawRequested() const { return swapChain && composited && layer->IsDrawRequested(); } @@ -385,7 +385,7 @@ class OculusLayerEquirect: public OculusLayer sourceLayer; - static OculusLayerEquirectPtr Create(const VRLayerEquirectPtr& aLayer, const OculusLayerQuadPtr& aSourceLayer = nullptr) { + static OculusLayerEquirectPtr Create(const VRLayerEquirectPtr& aLayer, const OculusLayerQuadPtr& aSourceLayer) { auto result = std::make_shared(); result->layer = aLayer; result->sourceLayer = aSourceLayer; @@ -416,7 +416,16 @@ class OculusLayerEquirect: public OculusLayerswapChain && source->composited && layer->IsDrawRequested(); + } + void Update(const ovrTracking2& aTracking) override { + OculusLayerQuadPtr source = sourceLayer.lock(); + if (source) { + swapChain = source->swapChain; + } OculusLayer::Update(aTracking); vrb::Quaternion q(layer->GetModelTransform(device::Eye::Left)); @@ -550,7 +559,7 @@ struct DeviceDelegateOculusVR::State { } void GetStandaloneRenderSize(uint32_t& aWidth, uint32_t& aHeight) { - const float scale = layersEnabled ? 1.0 : 1.5f; + const float scale = layersEnabled ? 1.0f : 1.5f; aWidth = scale * (uint32_t)(vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_WIDTH)); aHeight = scale * (uint32_t)(vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_SUGGESTED_EYE_TEXTURE_HEIGHT)); }