mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-27 12:40:25 +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:
commit
e8c422697f
2 changed files with 9 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <osg/FrameBufferObject>
|
#include <osg/FrameBufferObject>
|
||||||
|
|
||||||
|
#include "postprocessor.hpp"
|
||||||
|
|
||||||
namespace MWRender
|
namespace MWRender
|
||||||
{
|
{
|
||||||
void DistortionCallback::drawImplementation(
|
void DistortionCallback::drawImplementation(
|
||||||
|
@ -10,6 +12,11 @@ namespace MWRender
|
||||||
osg::State* state = renderInfo.getState();
|
osg::State* state = renderInfo.getState();
|
||||||
size_t frameId = state->getFrameStamp()->getFrameNumber() % 2;
|
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);
|
mFBO[frameId]->apply(*state);
|
||||||
|
|
||||||
const osg::Texture* tex
|
const osg::Texture* tex
|
||||||
|
|
|
@ -37,7 +37,8 @@ namespace SceneUtil
|
||||||
|
|
||||||
osg::StateSet* stateset = node.getOrCreateStateSet();
|
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->addUniform(new osg::Uniform("distortionStrength", distortionStrength));
|
||||||
|
|
||||||
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);
|
stateset->setAttributeAndModes(depth, osg::StateAttribute::ON);
|
||||||
|
|
Loading…
Reference in a new issue