FlipController fix, DetailTexture & DarkTexture tested

pull/638/head
scrawl 10 years ago
parent b072e803ce
commit 20866b44f7

@ -433,9 +433,12 @@ void FlipController::operator() (osg::Node* node, osg::NodeVisitor* nv)
{ {
osg::StateSet* stateset = node->getStateSet(); osg::StateSet* stateset = node->getStateSet();
int curTexture = int(getInputValue(nv) / mDelta) % mTextures.size(); 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) if (tex)
tex->setImage(mTextures[curTexture].get()); tex->setImage(mTextures[curTexture].get());
else
std::cout << "FlipController: can't find target slot" << std::endl;
} }
traverse(node, nv); traverse(node, nv);
} }

@ -259,7 +259,6 @@ namespace NifOsg
virtual void operator() (osg::Node* node, osg::NodeVisitor* nv); virtual void operator() (osg::Node* node, osg::NodeVisitor* nv);
}; };
// untested
class FlipController : public osg::NodeCallback, public Controller class FlipController : public osg::NodeCallback, public Controller
{ {
private: private:

@ -1260,14 +1260,12 @@ namespace NifOsg
} }
else if (i == Nif::NiTexturingProperty::DarkTexture) else if (i == Nif::NiTexturingProperty::DarkTexture)
{ {
// untested
osg::TexEnv* texEnv = new osg::TexEnv; osg::TexEnv* texEnv = new osg::TexEnv;
texEnv->setMode(osg::TexEnv::MODULATE); texEnv->setMode(osg::TexEnv::MODULATE);
stateset->setTextureAttributeAndModes(i, texEnv, osg::StateAttribute::ON); stateset->setTextureAttributeAndModes(i, texEnv, osg::StateAttribute::ON);
} }
else if (i == Nif::NiTexturingProperty::DetailTexture) else if (i == Nif::NiTexturingProperty::DetailTexture)
{ {
// untested
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine; osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
texEnv->setScale_RGB(2.f); texEnv->setScale_RGB(2.f);
texEnv->setCombine_Alpha(GL_MODULATE); texEnv->setCombine_Alpha(GL_MODULATE);

Loading…
Cancel
Save