1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 12:49:56 +00:00
openmw-tes3mp/apps/openmw/mwvr/openxrswapchainimpl.hpp
Mads Buvik Sandvei c3a312f80d Squashed commit of the following:
commit d8564b8e501c98fa2e3cde582b8d06d7c78ba6ce
Author: Mads Buvik Sandvei <madssandvei@protonmail.com>
Date:   Fri Oct 16 23:43:39 2020 +0200

    bad assignment

commit 84f66e4bf1050ce8a316a27f8b10dc2243e35406
Author: Mads Buvik Sandvei <madssandvei@protonmail.com>
Date:   Fri Oct 16 21:08:27 2020 +0200

    Removed the approach of abstracting xr paths with enums. It is not turning out to be useful. Use the explicit paths instead. Added some default bindings for most currently available controllers, except the xbox controller.

commit ae525d0a239c087a7344528634a078e0812af66d
Author: Mads Buvik Sandvei <madssandvei@protonmail.com>
Date:   Fri Oct 16 21:05:37 2020 +0200

    Cleaned up openxr extensions code. Upgraded openxr to version 1.0.12 to enable support for certain controllers.

commit 2d71a5ecbf699c59f1fcdbebcad867fd28552929
Author: Mads Buvik Sandvei <madssandvei@protonmail.com>
Date:   Thu Sep 24 22:18:25 2020 +0200

    simple_controller
2020-10-17 12:33:46 +02:00

64 lines
2.2 KiB
C++

#ifndef OPENXR_SWAPCHAINIMPL_HPP
#define OPENXR_SWAPCHAINIMPL_HPP
#include "openxrswapchain.hpp"
#include "openxrmanagerimpl.hpp"
struct XrSwapchainSubImage;
struct XrSwapchainImageOpenGLKHR;
namespace MWVR
{
/// \brief Implementation of OpenXRSwapchain
class OpenXRSwapchainImpl
{
public:
OpenXRSwapchainImpl(osg::ref_ptr<osg::State> state, SwapchainConfig config);
~OpenXRSwapchainImpl();
void beginFrame(osg::GraphicsContext* gc);
void endFrame(osg::GraphicsContext* gc);
VRFramebuffer* renderBuffer() const;
uint32_t acquiredColorTexture() const;
uint32_t acquiredDepthTexture() const;
bool isAcquired() const;
XrSwapchain xrSwapchain(void) const { return mSwapchain; };
XrSwapchain xrSwapchainDepth(void) const { return mSwapchainDepth; };
XrSwapchainSubImage xrSubImage(void) const { return mSubImage; };
XrSwapchainSubImage xrSubImageDepth(void) const { return mSubImageDepth; };
int width() const { return mWidth; };
int height() const { return mHeight; };
int samples() const { return mSamples; };
protected:
OpenXRSwapchainImpl(const OpenXRSwapchainImpl&) = delete;
void operator=(const OpenXRSwapchainImpl&) = delete;
void acquire(osg::GraphicsContext* gc);
void release(osg::GraphicsContext* gc);
void checkAcquired() const;
private:
XrSwapchain mSwapchain = XR_NULL_HANDLE;
XrSwapchain mSwapchainDepth = XR_NULL_HANDLE;
std::vector<XrSwapchainImageOpenGLKHR> mSwapchainColorBuffers{};
std::vector<XrSwapchainImageOpenGLKHR> mSwapchainDepthBuffers{};
XrSwapchainSubImage mSubImage{};
XrSwapchainSubImage mSubImageDepth{};
int32_t mWidth = -1;
int32_t mHeight = -1;
int32_t mSamples = -1;
int64_t mSwapchainColorFormat = -1;
int64_t mSwapchainDepthFormat = -1;
bool mHaveDepthSwapchain = false;
uint32_t mFBO = 0;
std::vector<std::unique_ptr<VRFramebuffer> > mRenderBuffers{};
int mRenderBuffer{ 0 };
uint32_t mAcquiredImageIndex{ 0 };
bool mIsAcquired{ false };
};
}
#endif