mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-20 19:39:41 +00:00
NpcAnimation::setAlpha
This commit is contained in:
parent
bed31996c9
commit
987918ca15
1 changed files with 25 additions and 1 deletions
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <osg/UserDataContainer>
|
||||
#include <osg/MatrixTransform>
|
||||
#include <osg/BlendFunc>
|
||||
#include <osg/Material>
|
||||
|
||||
#include <components/misc/rng.hpp>
|
||||
|
||||
|
@ -991,7 +993,29 @@ void NpcAnimation::setAlpha(float alpha)
|
|||
return;
|
||||
mAlpha = alpha;
|
||||
|
||||
// TODO
|
||||
if (alpha != 1.f)
|
||||
{
|
||||
osg::StateSet* stateset (new osg::StateSet);
|
||||
|
||||
osg::BlendFunc* blendfunc (new osg::BlendFunc);
|
||||
stateset->setAttributeAndModes(blendfunc, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
||||
|
||||
// FIXME: overriding diffuse/ambient/emissive colors
|
||||
osg::Material* material (new osg::Material);
|
||||
material->setColorMode(osg::Material::DIFFUSE);
|
||||
material->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,alpha));
|
||||
material->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4f(1,1,1,1));
|
||||
stateset->setAttributeAndModes(material, osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);
|
||||
|
||||
stateset->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
|
||||
stateset->setRenderBinMode(osg::StateSet::OVERRIDE_RENDERBIN_DETAILS);
|
||||
stateset->setNestRenderBins(false);
|
||||
mObjectRoot->setStateSet(stateset);
|
||||
}
|
||||
else
|
||||
{
|
||||
mObjectRoot->setStateSet(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void NpcAnimation::enableHeadAnimation(bool enable)
|
||||
|
|
Loading…
Reference in a new issue