|
|
@ -470,7 +470,7 @@ namespace NifOsg
|
|
|
|
const Nif::NiTextureEffect* textureEffect = static_cast<const Nif::NiTextureEffect*>(nifNode);
|
|
|
|
const Nif::NiTextureEffect* textureEffect = static_cast<const Nif::NiTextureEffect*>(nifNode);
|
|
|
|
if (textureEffect->textureType != Nif::NiTextureEffect::Environment_Map)
|
|
|
|
if (textureEffect->textureType != Nif::NiTextureEffect::Environment_Map)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "Unhandled NiTextureEffect type " << textureEffect->textureType << std::endl;
|
|
|
|
std::cerr << "Unhandled NiTextureEffect type " << textureEffect->textureType << " in " << mFilename << std::endl;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -487,7 +487,7 @@ namespace NifOsg
|
|
|
|
texGen->setMode(osg::TexGen::SPHERE_MAP);
|
|
|
|
texGen->setMode(osg::TexGen::SPHERE_MAP);
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
std::cerr << "Unhandled NiTextureEffect coordGenType " << textureEffect->coordGenType << std::endl;
|
|
|
|
std::cerr << "Unhandled NiTextureEffect coordGenType " << textureEffect->coordGenType << " in " << mFilename << std::endl;
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1374,17 +1374,15 @@ namespace NifOsg
|
|
|
|
case Nif::NiTexturingProperty::DarkTexture:
|
|
|
|
case Nif::NiTexturingProperty::DarkTexture:
|
|
|
|
case Nif::NiTexturingProperty::BumpTexture:
|
|
|
|
case Nif::NiTexturingProperty::BumpTexture:
|
|
|
|
case Nif::NiTexturingProperty::DetailTexture:
|
|
|
|
case Nif::NiTexturingProperty::DetailTexture:
|
|
|
|
|
|
|
|
case Nif::NiTexturingProperty::DecalTexture:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case Nif::NiTexturingProperty::GlossTexture:
|
|
|
|
case Nif::NiTexturingProperty::GlossTexture:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
// Not used by the vanilla engine. MCP (Morrowind Code Patch) adds an option to use Gloss maps:
|
|
|
|
|
|
|
|
// "- Gloss map fix. Morrowind removed gloss map entries from model files after loading them. This stops Morrowind from removing them."
|
|
|
|
std::cerr << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used." << std::endl;
|
|
|
|
std::cerr << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used." << std::endl;
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
case Nif::NiTexturingProperty::DecalTexture:
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
std::cerr << "NiTexturingProperty::DecalTexture in " << mFilename << " not currently used." << std::endl;
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::cerr << "Warning: unhandled texture stage " << i << " in " << mFilename << std::endl;
|
|
|
|
std::cerr << "Warning: unhandled texture stage " << i << " in " << mFilename << std::endl;
|
|
|
@ -1435,16 +1433,16 @@ namespace NifOsg
|
|
|
|
{
|
|
|
|
{
|
|
|
|
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(osg::TexEnvCombine::MODULATE);
|
|
|
|
texEnv->setOperand0_Alpha(GL_SRC_ALPHA);
|
|
|
|
texEnv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA);
|
|
|
|
texEnv->setOperand1_Alpha(GL_SRC_ALPHA);
|
|
|
|
texEnv->setOperand1_Alpha(osg::TexEnvCombine::SRC_ALPHA);
|
|
|
|
texEnv->setSource0_Alpha(GL_PREVIOUS_ARB);
|
|
|
|
texEnv->setSource0_Alpha(osg::TexEnvCombine::PREVIOUS);
|
|
|
|
texEnv->setSource1_Alpha(GL_TEXTURE);
|
|
|
|
texEnv->setSource1_Alpha(osg::TexEnvCombine::TEXTURE);
|
|
|
|
texEnv->setCombine_RGB(GL_MODULATE);
|
|
|
|
texEnv->setCombine_RGB(osg::TexEnvCombine::MODULATE);
|
|
|
|
texEnv->setOperand0_RGB(GL_SRC_COLOR);
|
|
|
|
texEnv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
|
|
|
|
texEnv->setOperand1_RGB(GL_SRC_COLOR);
|
|
|
|
texEnv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
|
|
|
|
texEnv->setSource0_RGB(GL_PREVIOUS_ARB);
|
|
|
|
texEnv->setSource0_RGB(osg::TexEnvCombine::PREVIOUS);
|
|
|
|
texEnv->setSource1_RGB(GL_TEXTURE);
|
|
|
|
texEnv->setSource1_RGB(osg::TexEnvCombine::TEXTURE);
|
|
|
|
stateset->setTextureAttributeAndModes(texUnit, texEnv, osg::StateAttribute::ON);
|
|
|
|
stateset->setTextureAttributeAndModes(texUnit, texEnv, osg::StateAttribute::ON);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (i == Nif::NiTexturingProperty::BumpTexture)
|
|
|
|
else if (i == Nif::NiTexturingProperty::BumpTexture)
|
|
|
@ -1452,6 +1450,21 @@ namespace NifOsg
|
|
|
|
// Set this texture to Off by default since we can't render it with the fixed-function pipeline
|
|
|
|
// Set this texture to Off by default since we can't render it with the fixed-function pipeline
|
|
|
|
stateset->setTextureMode(texUnit, GL_TEXTURE_2D, osg::StateAttribute::OFF);
|
|
|
|
stateset->setTextureMode(texUnit, GL_TEXTURE_2D, osg::StateAttribute::OFF);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (i == Nif::NiTexturingProperty::DecalTexture)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
osg::TexEnvCombine* texEnv = new osg::TexEnvCombine;
|
|
|
|
|
|
|
|
texEnv->setCombine_RGB(osg::TexEnvCombine::INTERPOLATE);
|
|
|
|
|
|
|
|
texEnv->setSource0_RGB(osg::TexEnvCombine::TEXTURE);
|
|
|
|
|
|
|
|
texEnv->setOperand0_RGB(osg::TexEnvCombine::SRC_COLOR);
|
|
|
|
|
|
|
|
texEnv->setSource1_RGB(osg::TexEnvCombine::PREVIOUS);
|
|
|
|
|
|
|
|
texEnv->setOperand1_RGB(osg::TexEnvCombine::SRC_COLOR);
|
|
|
|
|
|
|
|
texEnv->setSource2_RGB(osg::TexEnvCombine::TEXTURE);
|
|
|
|
|
|
|
|
texEnv->setOperand2_RGB(osg::TexEnvCombine::SRC_ALPHA);
|
|
|
|
|
|
|
|
texEnv->setCombine_Alpha(osg::TexEnvCombine::REPLACE);
|
|
|
|
|
|
|
|
texEnv->setSource0_Alpha(osg::TexEnvCombine::PREVIOUS);
|
|
|
|
|
|
|
|
texEnv->setOperand0_Alpha(osg::TexEnvCombine::SRC_ALPHA);
|
|
|
|
|
|
|
|
stateset->setTextureAttributeAndModes(texUnit, texEnv, osg::StateAttribute::ON);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
switch (i)
|
|
|
|
switch (i)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1470,6 +1483,9 @@ namespace NifOsg
|
|
|
|
case Nif::NiTexturingProperty::DetailTexture:
|
|
|
|
case Nif::NiTexturingProperty::DetailTexture:
|
|
|
|
texture2d->setName("detailMap");
|
|
|
|
texture2d->setName("detailMap");
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case Nif::NiTexturingProperty::DecalTexture:
|
|
|
|
|
|
|
|
texture2d->setName("decalMap");
|
|
|
|
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|