added variable to render lighting

This commit is contained in:
devZoGok
2022-03-26 12:31:16 +02:00
parent a38172c3c8
commit ab9bb1f0e3
2 changed files with 49 additions and 37 deletions
+7 -4
View File
@@ -385,11 +385,14 @@ namespace vb01{
for(Mesh *m : meshes){
Material *mat = m->getMaterial();
int numLights = root->getNumLights();
string str = "const int numLights = " + to_string(numLights > 0 ? numLights : 1) + ";";
if(mat)
mat->getShader()->editShader(Shader::FRAGMENT_SHADER, 1, str);
if(mat){
int numLights = root->getNumLights();
string str1 = "const int numLights = " + to_string(numLights > 0 ? numLights : 1) + ";";
mat->getShader()->editShader(Shader::FRAGMENT_SHADER, 1, str1);
string str2 = "const bool checkLights = " + string(numLights > 0 ? "true" : "false") + ";";
mat->getShader()->editShader(Shader::FRAGMENT_SHADER, 2, str2);
}
}
}
}