mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-28 07:32:00 -04:00
Fix AlphaController affecting all instances of the StateSet
This commit is contained in:
parent
a391579382
commit
de479e35c8
@ -353,6 +353,13 @@ AlphaController::AlphaController(const AlphaController ©, const osg::CopyOp
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlphaController::setDefaults(osg::StateSet *stateset)
|
||||||
|
{
|
||||||
|
// need to create a deep copy of StateAttributes we will modify
|
||||||
|
osg::Material* mat = static_cast<osg::Material*>(stateset->getAttribute(osg::StateAttribute::MATERIAL));
|
||||||
|
stateset->setAttribute(osg::clone(mat, osg::CopyOp::DEEP_COPY_ALL), osg::StateAttribute::ON);
|
||||||
|
}
|
||||||
|
|
||||||
void AlphaController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
void AlphaController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
||||||
{
|
{
|
||||||
if (hasInput())
|
if (hasInput())
|
||||||
|
@ -189,6 +189,8 @@ namespace NifOsg
|
|||||||
AlphaController();
|
AlphaController();
|
||||||
AlphaController(const AlphaController& copy, const osg::CopyOp& copyop);
|
AlphaController(const AlphaController& copy, const osg::CopyOp& copyop);
|
||||||
|
|
||||||
|
virtual void setDefaults(osg::StateSet* stateset);
|
||||||
|
|
||||||
virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv);
|
virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv);
|
||||||
|
|
||||||
META_Object(NifOsg, AlphaController)
|
META_Object(NifOsg, AlphaController)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user