Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Fix 360 video layer after a source quad layer resize (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro authored Nov 23, 2018
1 parent ff588a2 commit 40bfeac
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions app/src/oculusvr/cpp/DeviceDelegateOculusVR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class OculusLayer {
layer->SetCurrentEye(aEye);
}

bool IsDrawRequested() const {
virtual bool IsDrawRequested() const {
return swapChain && composited && layer->IsDrawRequested();
}

Expand Down Expand Up @@ -385,7 +385,7 @@ class OculusLayerEquirect: public OculusLayer<VRLayerEquirectPtr, ovrLayerEquire
public:
std::weak_ptr<OculusLayerQuad> 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<OculusLayerEquirect>();
result->layer = aLayer;
result->sourceLayer = aSourceLayer;
Expand Down Expand Up @@ -416,7 +416,16 @@ class OculusLayerEquirect: public OculusLayer<VRLayerEquirectPtr, ovrLayerEquire
OculusLayer::Destroy();
}

bool IsDrawRequested() const override {
OculusLayerQuadPtr source = sourceLayer.lock();
return source && source->swapChain && 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));
Expand Down Expand Up @@ -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));
}
Expand Down

0 comments on commit 40bfeac

Please sign in to comment.