mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 20:39:41 +00:00
Don't use a shared Material in MaterialColorController
This commit is contained in:
parent
de479e35c8
commit
16b8ef3164
2 changed files with 9 additions and 0 deletions
|
@ -387,6 +387,13 @@ MaterialColorController::MaterialColorController(const MaterialColorController &
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaterialColorController::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 MaterialColorController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
void MaterialColorController::apply(osg::StateSet *stateset, osg::NodeVisitor *nv)
|
||||||
{
|
{
|
||||||
if (hasInput())
|
if (hasInput())
|
||||||
|
|
|
@ -208,6 +208,8 @@ namespace NifOsg
|
||||||
|
|
||||||
META_Object(NifOsg, MaterialColorController)
|
META_Object(NifOsg, MaterialColorController)
|
||||||
|
|
||||||
|
virtual void setDefaults(osg::StateSet* stateset);
|
||||||
|
|
||||||
virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv);
|
virtual void apply(osg::StateSet* stateset, osg::NodeVisitor* nv);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue