1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-04 02:41:19 +00:00

Merge branch 'first_person_mesh_distortion' into 'master'

Fix distortion breaking in first person meshes

See merge request OpenMW/openmw!4231
This commit is contained in:
psi29a 2024-07-06 07:46:35 +00:00
commit e8c422697f
2 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,8 @@
#include <osg/FrameBufferObject>
#include "postprocessor.hpp"
namespace MWRender
{
void DistortionCallback::drawImplementation(
@ -10,6 +12,11 @@ namespace MWRender
osg::State* state = renderInfo.getState();
size_t frameId = state->getFrameStamp()->getFrameNumber() % 2;
PostProcessor* postProcessor = dynamic_cast<PostProcessor*>(renderInfo.getCurrentCamera()->getUserData());
if (!postProcessor || bin->getStage()->getFrameBufferObject() != postProcessor->getPrimaryFbo(frameId))
return;
mFBO[frameId]->apply(*state);
const osg::Texture* tex

View File

@ -37,7 +37,8 @@ namespace SceneUtil
osg::StateSet* stateset = node.getOrCreateStateSet();
stateset->setRenderBinDetails(14, "Distortion", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
stateset->setNestRenderBins(false);
stateset->setRenderBinDetails(14, "Distortion", osg::StateSet::OVERRIDE_PROTECTED_RENDERBIN_DETAILS);
stateset->addUniform(new osg::Uniform("distortionStrength", distortionStrength));
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);