1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-16 05:17:39 +08:00

ovis: handle bg material change after shader genration

This commit is contained in:
Pavel Rojtberg
2022-01-25 18:27:56 +01:00
parent 758c1a9b94
commit 678d0fc5be

View File

@@ -443,14 +443,21 @@ public:
_createTexture(name, image.getMat());
bgplane->setDefaultUVs();
Pass* rpass = bgplane->getMaterial()->getBestTechnique()->getPasses()[0];
rpass->getTextureUnitStates()[0]->setTextureName(name);
rpass->getTextureUnitStates()[0]->setTextureAddressingMode(TAM_CLAMP);
// ensure bgplane is visible
bgplane->setVisible(true);
bgplane->setDefaultUVs();
Pass* rpass = bgplane->getMaterial()->getTechnique(0)->getPasses()[0];
auto tus = rpass->getTextureUnitStates()[0];
if(tus->getTextureName() != name)
{
RTShader::ShaderGenerator::getSingleton().invalidateMaterial(
RTShader::ShaderGenerator::DEFAULT_SCHEME_NAME, *bgplane->getMaterial());
tus->setTextureName(name);
tus->setTextureAddressingMode(TAM_CLAMP);
}
}
void setCompositors(const std::vector<String>& names) CV_OVERRIDE