Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from LibreVR:master #77

Merged
merged 5 commits into from
Oct 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ReviveXR: Flip the field-of-view to flip the image
Image rect flipping is no longer supported.
  • Loading branch information
CrossVR committed Oct 3, 2019
commit 5526c11fd3d63fd136f10421d575f517b25a23fb
12 changes: 8 additions & 4 deletions ReviveXR/REV_CAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1014,14 +1014,18 @@ OVR_PUBLIC_FUNCTION(ovrResult) ovr_EndFrame(ovrSession session, long long frameI
break;
}

// Flip the field-of-view to flip the image
if (upsideDown)
OVR::OVRMath_Swap(view.fov.angleUp, view.fov.angleDown);

if (type == ovrLayerType_EyeFovDepth && g_Extensions.CompositionDepth)
{
depthData.emplace_back();
XrCompositionLayerDepthInfoKHR& depthInfo = depthData.back();
depthInfo = XR_TYPE(COMPOSITION_LAYER_DEPTH_INFO_KHR);

depthInfo.subImage.swapchain = layer->EyeFovDepth.DepthTexture[i]->Swapchain;
depthInfo.subImage.imageRect = XR::Recti(layer->EyeFovDepth.Viewport[i], upsideDown);
depthInfo.subImage.imageRect = XR::Recti(layer->EyeFovDepth.Viewport[i]);
depthInfo.subImage.imageArrayIndex = 0;

const ovrTimewarpProjectionDesc& projDesc = layer->EyeFovDepth.ProjectionDesc;
Expand All @@ -1040,7 +1044,7 @@ OVR_PUBLIC_FUNCTION(ovrResult) ovr_EndFrame(ovrSession session, long long frameI
}

view.subImage.swapchain = texture->Swapchain;
view.subImage.imageRect = XR::Recti(layer->EyeFov.Viewport[i], upsideDown);
view.subImage.imageRect = XR::Recti(layer->EyeFov.Viewport[i]);
view.subImage.imageArrayIndex = 0;
}

Expand All @@ -1060,7 +1064,7 @@ OVR_PUBLIC_FUNCTION(ovrResult) ovr_EndFrame(ovrSession session, long long frameI
quad = XR_TYPE(COMPOSITION_LAYER_QUAD);
quad.eyeVisibility = XR_EYE_VISIBILITY_BOTH;
quad.subImage.swapchain = layer->Quad.ColorTexture->Swapchain;
quad.subImage.imageRect = XR::Recti(layer->Quad.Viewport, upsideDown);
quad.subImage.imageRect = XR::Recti(layer->Quad.Viewport);
quad.subImage.imageArrayIndex = 0;
quad.pose = XR::Posef(layer->Quad.QuadPoseCenter);
quad.size = XR::Vector2f(layer->Quad.QuadSize);
Expand All @@ -1074,7 +1078,7 @@ OVR_PUBLIC_FUNCTION(ovrResult) ovr_EndFrame(ovrSession session, long long frameI
cylinder = XR_TYPE(COMPOSITION_LAYER_CYLINDER_KHR);
cylinder.eyeVisibility = XR_EYE_VISIBILITY_BOTH;
cylinder.subImage.swapchain = layer->Cylinder.ColorTexture->Swapchain;
cylinder.subImage.imageRect = XR::Recti(layer->Cylinder.Viewport, upsideDown);
cylinder.subImage.imageRect = XR::Recti(layer->Cylinder.Viewport);
cylinder.subImage.imageArrayIndex = 0;
cylinder.pose = XR::Posef(layer->Cylinder.CylinderPoseCenter);
cylinder.radius = layer->Cylinder.CylinderRadius;
Expand Down
10 changes: 0 additions & 10 deletions ReviveXR/XR_Math.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ namespace XR {
)
{ }

// Specialized flip constructor
Recti(const ovrRecti& s, bool flipped)
: OVR::Recti(
s.Pos.x,
flipped ? s.Size.h - s.Pos.y : s.Pos.y,
s.Size.w,
flipped ? -s.Size.h : s.Size.h
)
{ }

operator const XrRect2Di& () const
{
return reinterpret_cast<const XrRect2Di&>(*this);
Expand Down