mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-04 15:57:59 +03:00
Convert blending factors properly for the character preview
This commit is contained in:
parent
d990c425b8
commit
cb2cbb4181
2 changed files with 40 additions and 9 deletions
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include <components/resource/imagemanager.hpp>
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include "myguicompat.h"
|
||||
#include "myguitexture.hpp"
|
||||
|
||||
|
@ -439,14 +441,23 @@ void RenderManager::doRender(MyGUI::IVertexBuffer *buffer, MyGUI::ITexture *text
|
|||
batch.mVertexBuffer = static_cast<OSGVertexBuffer*>(buffer)->getVertexBuffer();
|
||||
batch.mArray = static_cast<OSGVertexBuffer*>(buffer)->getVertexArray();
|
||||
static_cast<OSGVertexBuffer*>(buffer)->markUsed();
|
||||
bool premultipliedAlpha = false;
|
||||
if (texture)
|
||||
{
|
||||
batch.mTexture = static_cast<OSGTexture*>(texture)->getTexture();
|
||||
if (batch.mTexture->getDataVariance() == osg::Object::DYNAMIC)
|
||||
mDrawable->setDataVariance(osg::Object::DYNAMIC); // only for this frame, reset in begin()
|
||||
batch.mTexture->getUserValue("premultiplied alpha", premultipliedAlpha);
|
||||
}
|
||||
if (mInjectState)
|
||||
batch.mStateSet = mInjectState;
|
||||
else if (premultipliedAlpha)
|
||||
{
|
||||
// This is hacky, but MyGUI made it impossible to use a custom layer for a nested node, so state couldn't be injected 'properly'
|
||||
osg::ref_ptr<osg::StateSet> stateSet = new osg::StateSet();
|
||||
stateSet->setAttribute(new osg::BlendFunc(osg::BlendFunc::ONE, osg::BlendFunc::ONE_MINUS_SRC_ALPHA));
|
||||
batch.mStateSet = stateSet;
|
||||
}
|
||||
|
||||
mDrawable->addBatch(batch);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue