diff --git a/components/nifosg/nifloader.cpp b/components/nifosg/nifloader.cpp index b7eb9d8a7..8ffb8d5de 100644 --- a/components/nifosg/nifloader.cpp +++ b/components/nifosg/nifloader.cpp @@ -1374,6 +1374,7 @@ namespace NifOsg case Nif::NiTexturingProperty::DarkTexture: case Nif::NiTexturingProperty::BumpTexture: case Nif::NiTexturingProperty::DetailTexture: + case Nif::NiTexturingProperty::DecalTexture: break; case Nif::NiTexturingProperty::GlossTexture: { @@ -1382,11 +1383,6 @@ namespace NifOsg std::cerr << "NiTexturingProperty::GlossTexture in " << mFilename << " not currently used." << std::endl; continue; } - case Nif::NiTexturingProperty::DecalTexture: - { - std::cerr << "NiTexturingProperty::DecalTexture in " << mFilename << " not currently used." << std::endl; - continue; - } default: { std::cerr << "Warning: unhandled texture stage " << i << " in " << mFilename << std::endl; @@ -1454,6 +1450,21 @@ namespace NifOsg // 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); } + else if (i == Nif::NiTexturingProperty::DecalTexture) + { + osg::TexEnvCombine* texEnv = new osg::TexEnvCombine; + texEnv->setCombine_RGB(GL_INTERPOLATE); + texEnv->setSource0_RGB(GL_TEXTURE); + texEnv->setOperand0_RGB(GL_SRC_COLOR); + texEnv->setSource1_RGB(GL_PREVIOUS_ARB); + texEnv->setOperand1_RGB(GL_SRC_COLOR); + texEnv->setSource2_RGB(GL_TEXTURE); + texEnv->setOperand2_RGB(GL_SRC_ALPHA); + texEnv->setCombine_Alpha(GL_REPLACE); + texEnv->setSource0_Alpha(GL_PREVIOUS); + texEnv->setOperand0_Alpha(GL_SRC_ALPHA); + stateset->setTextureAttributeAndModes(texUnit, texEnv, osg::StateAttribute::ON); + } switch (i) { @@ -1472,6 +1483,9 @@ namespace NifOsg case Nif::NiTexturingProperty::DetailTexture: texture2d->setName("detailMap"); break; + case Nif::NiTexturingProperty::DecalTexture: + texture2d->setName("decalMap"); + break; default: break; } diff --git a/components/shader/shadervisitor.cpp b/components/shader/shadervisitor.cpp index b06ceafde..92bdac7b7 100644 --- a/components/shader/shadervisitor.cpp +++ b/components/shader/shadervisitor.cpp @@ -88,11 +88,11 @@ namespace Shader return newStateSet.get(); } - const char* defaultTextures[] = { "diffuseMap", "normalMap", "emissiveMap", "darkMap", "detailMap", "envMap", "specularMap" }; + const char* defaultTextures[] = { "diffuseMap", "normalMap", "emissiveMap", "darkMap", "detailMap", "envMap", "specularMap", "decalMap" }; bool isTextureNameRecognized(const std::string& name) { for (unsigned int i=0; i