1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 06:19:55 +00:00
openmw-tes3mp/apps/openmw/mwvr/openxrlayer.cpp

44 lines
1 KiB
C++

#include "openxrlayer.hpp"
namespace MWVR {
void OpenXRLayerStack::setLayer(Layer layer, OpenXRLayer* layerObj)
{
mLayers[layer] = nullptr;
mLayerObjects[layer] = layerObj;
}
int OpenXRLayerStack::layerCount()
{
int count = 0;
for (auto* layer : mLayers)
if (layer)
count++;
return count;
}
const XrCompositionLayerBaseHeader** OpenXRLayerStack::layerHeaders()
{
// If i had more than two layers i'd make a general solution using a vector member instead.
for (unsigned i = 0; i < mLayerObjects.size(); i++)
if (mLayerObjects[i])
mLayers[i] = mLayerObjects[i]->layer();
else
mLayers[i] = nullptr;
if (mLayers[0])
return mLayers.data();
if (!mLayers[0])
if (mLayers[1])
return mLayers.data() + 1;
if (!mLayers[0])
if (!mLayers[1])
return nullptr;
}
}