Commit 3c1b9ca9 authored by Jan's avatar Jan

Fixed some sprintf warnings

parent 6eef6823
......@@ -1065,11 +1065,8 @@ void ShaderProgGenerator::initGenDefines(ShaderGenerator* _gen)
_gen->addDefine(lightTypeNames[i]);
for (int i = 0; i < desc_.numLights; ++i)
{
QString strLightType;
strLightType.sprintf("SG_LIGHT_TYPE_%d %s", i, lightTypeNames[desc_.lightTypes[i]]);
_gen->addDefine(strLightType);
for (int i = 0; i < desc_.numLights; ++i) {
_gen->addDefine( QString ("SG_LIGHT_TYPE_%1 %2").arg(i).arg(lightTypeNames[desc_.lightTypes[i]]) );
}
_gen->addDefine("SG_ALPHA g_vMaterial.y");
......@@ -2072,20 +2069,16 @@ void ShaderProgGenerator::addTexGenCode( QStringList* _code, bool _fragmentShade
_code->push_back("vec3 sg_TexGenRefl2 = sg_TexGenRefl; sg_TexGenRefl2.z += 1.0;");
_code->push_back("float sg_TexGenMRcp = 0.5 * inversesqrt(dot(sg_TexGenRefl2, sg_TexGenRefl2));");
for (int i = 0; i < desc_.texGenDim; ++i)
{
QString assignmentInstrString;
assignmentInstrString.sprintf("sg_vTexCoord.%s = sg_TexGenRefl.%s * sg_TexGenMRcp + 0.5;", texGenCoordString[i], texGenCoordString[i]);
_code->push_back(assignmentInstrString);
{
_code->push_back(QString ("sg_vTexCoord.%1 = sg_TexGenRefl.%2 * sg_TexGenMRcp + 0.5;").arg(texGenCoordString[i]).arg(texGenCoordString[i]));
}
} break;
case GL_NORMAL_MAP:
{
for (int i = 0; i < desc_.texGenDim; ++i)
{
QString assignmentInstrString;
assignmentInstrString.sprintf("sg_vTexCoord.%s = sg_vNormalVS.%s;", texGenCoordString[i], texGenCoordString[i]);
_code->push_back(assignmentInstrString);
{
_code->push_back( QString ("sg_vTexCoord.%1 = sg_vNormalVS.%2;").arg(texGenCoordString[i]).arg(texGenCoordString[i]) );
}
} break;
......@@ -2095,9 +2088,8 @@ void ShaderProgGenerator::addTexGenCode( QStringList* _code, bool _fragmentShade
_code->push_back("vec3 sg_TexGenRefl = reflect(sg_vPosVS_unit, sg_vNormalVS);");
for (int i = 0; i < desc_.texGenDim; ++i)
{
QString assignmentInstrString;
assignmentInstrString.sprintf("sg_vTexCoord.%s = sg_TexGenRefl.%s;", texGenCoordString[i], texGenCoordString[i]);
_code->push_back(assignmentInstrString);
_code->push_back( QString ("sg_vTexCoord.%1 = sg_TexGenRefl.%2;").arg(texGenCoordString[i]).arg(texGenCoordString[i]) );
}
} break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment