1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2024-12-27 06:14:09 +00:00

[Multiview] Fix transparent pass and vertex shader

This commit is contained in:
Mads Buvik Sandvei 2023-04-01 20:27:07 +00:00 committed by psi29a
parent 6f8b4d16d9
commit e666f36b60
6 changed files with 24 additions and 10 deletions

View File

@ -340,7 +340,6 @@ namespace MWRender
mTransparentDepthPostPass->mFbo[frameId] = mFbos[frameId][FBO_Primary];
mTransparentDepthPostPass->mMsaaFbo[frameId] = mFbos[frameId][FBO_Multisample];
mTransparentDepthPostPass->mOpaqueFbo[frameId] = mFbos[frameId][FBO_OpaqueDepth];
mTransparentDepthPostPass->dirtyFrame(frameId);
}
size_t frame = cv->getTraversalNumber();

View File

@ -80,6 +80,11 @@ namespace MWRender
mMultiviewResolve[frameId] = std::make_unique<Stereo::MultiviewFramebufferResolve>(
msaaFbo ? msaaFbo : fbo, opaqueFbo, GL_DEPTH_BUFFER_BIT);
}
else
{
mMultiviewResolve[frameId]->setResolveFbo(opaqueFbo);
mMultiviewResolve[frameId]->setMsaaFbo(msaaFbo ? msaaFbo : fbo);
}
mMultiviewResolve[frameId]->resolveImplementation(state);
}
else
@ -133,11 +138,4 @@ namespace MWRender
: fbo->apply(state, osg::FrameBufferObject::DRAW_FRAMEBUFFER);
state.checkGLErrors("after TransparentDepthBinCallback::drawImplementation");
}
void TransparentDepthBinCallback::dirtyFrame(int frameId)
{
if (mMultiviewResolve[frameId])
mMultiviewResolve[frameId]->dirty();
}
}

View File

@ -28,7 +28,6 @@ namespace MWRender
void drawImplementation(
osgUtil::RenderBin* bin, osg::RenderInfo& renderInfo, osgUtil::RenderLeaf*& previous) override;
void dirtyFrame(int frameId);
std::array<osg::ref_ptr<osg::FrameBufferObject>, 2> mFbo;
std::array<osg::ref_ptr<osg::FrameBufferObject>, 2> mMsaaFbo;

View File

@ -735,6 +735,20 @@ namespace Stereo
{
}
void MultiviewFramebufferResolve::setResolveFbo(osg::FrameBufferObject* resolveFbo)
{
if (resolveFbo != mResolveFbo)
dirty();
mResolveFbo = resolveFbo;
}
void MultiviewFramebufferResolve::setMsaaFbo(osg::FrameBufferObject* msaaFbo)
{
if (msaaFbo != mMsaaFbo)
dirty();
mMsaaFbo = msaaFbo;
}
void MultiviewFramebufferResolve::resolveImplementation(osg::State& state)
{
if (mDirtyLayers)

View File

@ -125,6 +125,9 @@ namespace Stereo
const osg::FrameBufferObject* resolveFbo() const { return mResolveFbo; }
const osg::FrameBufferObject* msaaFbo() const { return mMsaaFbo; }
void setResolveFbo(osg::FrameBufferObject* resolveFbo);
void setMsaaFbo(osg::FrameBufferObject* msaaFbo);
private:
void setupLayers();

View File

@ -1,4 +1,5 @@
#version 330
#version 330 compatibility
// Note: compatibility profile required to access gl_ModelViewMatrix
#extension GL_OVR_multiview : require
#extension GL_OVR_multiview2 : require