RigTransformHardware fix: warn; don't crash if MAX_MATRIX not found
This commit is contained in:
parent
2bdf56cb4b
commit
5c66ecfc99
@ -251,10 +251,16 @@ bool RigTransformHardware::init(RigGeometry& geom)
|
|||||||
std::string str = _shader->getShaderSource();
|
std::string str = _shader->getShaderSource();
|
||||||
std::string toreplace = std::string("MAX_MATRIX");
|
std::string toreplace = std::string("MAX_MATRIX");
|
||||||
std::size_t start = str.find(toreplace);
|
std::size_t start = str.find(toreplace);
|
||||||
std::stringstream ss;
|
if (std::string::npos != start) {
|
||||||
ss << getMatrixPaletteUniform()->getNumElements();
|
std::stringstream ss;
|
||||||
str.replace(start, toreplace.size(), ss.str());
|
ss << getMatrixPaletteUniform()->getNumElements();
|
||||||
_shader->setShaderSource(str);
|
str.replace(start, toreplace.size(), ss.str());
|
||||||
|
_shader->setShaderSource(str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OSG_WARN << "MAX_MATRIX not found in Shader! " << str << std::endl;
|
||||||
|
}
|
||||||
OSG_INFO << "Shader " << str << std::endl;
|
OSG_INFO << "Shader " << str << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user