alphaFunc->setReferenceValue(_alpha_clamp);
stateSet->setAttribute(alphaFunc);
stateSet->setMode(GL_ALPHA_TEST, osg::StateAttribute::ON);
+ stateSet->setMode(GL_BLEND, osg::StateAttribute::ON);
stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
}
}
void cloneMaterial(osg::StateSet* stateSet)
{
-
osg::StateAttribute* stateAttr;
stateAttr = stateSet->getAttribute(osg::StateAttribute::MATERIAL);
if (!stateAttr)
}
stateSet->setAttribute(material);
}
- std::vector<osg::Material*> materialList;
+ std::vector<osg::ref_ptr<osg::Material> > materialList;
};
void SGMaterialAnimation::cloneMaterials(osg::Group *b)
void SGMaterialAnimation::setMaterialBranch(osg::Group *b)
{
- std::vector<osg::Material*>::iterator i;
+ std::vector<osg::ref_ptr<osg::Material> >::iterator i;
for (i = _materialList.begin(); i != _materialList.end(); ++i) {
- osg::Material* material = *i;
+ osg::Material* material = i->get();
if (_update & DIFFUSE) {
osg::Vec4 v = _diff.rgba();
float alpha = material->getDiffuse(osg::Material::FRONT_AND_BACK)[3];
SGPropertyNode_ptr _shi_prop;
SGPropertyNode_ptr _thresh_prop;
SGPropertyNode_ptr _tex_prop;
- std::vector<osg::Material*> _materialList;
+ std::vector<osg::ref_ptr<osg::Material> > _materialList;
osg::ref_ptr<osg::AlphaFunc> _alphaFunc;
osg::ref_ptr<osg::Texture2D> _texture2D;