@ -433,9 +433,12 @@ void FlipController::operator() (osg::Node* node, osg::NodeVisitor* nv)
{
osg::StateSet* stateset = node->getStateSet();
int curTexture = int(getInputValue(nv) / mDelta) % mTextures.size();
osg::Texture2D* tex = dynamic_cast<osg::Texture2D*>(stateset->getAttribute(osg::StateAttribute::TEXTURE));
osg::Texture2D* tex = dynamic_cast<osg::Texture2D*>(stateset->getTextureAttribute(mTexSlot, osg::StateAttribute::TEXTURE));
if (tex)
tex->setImage(mTextures[curTexture].get());
else
std::cout << "FlipController: can't find target slot" << std::endl;
}
traverse(node, nv);
@ -259,7 +259,6 @@ namespace NifOsg
virtual void operator() (osg::Node* node, osg::NodeVisitor* nv);
};
// untested
class FlipController : public osg::NodeCallback, public Controller
private:
@ -1260,14 +1260,12 @@ namespace NifOsg
else if (i == Nif::NiTexturingProperty::DarkTexture)
osg::TexEnv* texEnv = new osg::TexEnv;
texEnv->setMode(osg::TexEnv::MODULATE);
stateset->setTextureAttributeAndModes(i, texEnv, osg::StateAttribute::ON);
else if (i == Nif::NiTexturingProperty::DetailTexture)
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
texEnv->setScale_RGB(2.f);
texEnv->setCombine_Alpha(GL_MODULATE);