Fix default uniform values;

Not supported in GLES.
This commit is contained in:
bjorn 2019-08-09 17:36:14 -07:00
parent b8cb53e021
commit 93f076acc9
2 changed files with 10 additions and 3 deletions

View File

@ -1458,6 +1458,13 @@ static int l_lovrGraphicsNewShader(lua_State* L) {
}
shader = lovrShaderCreateDefault(shaderType, flags, flagCount);
// Builtin uniforms
if (shaderType == SHADER_STANDARD) {
lovrShaderSetFloats(shader, "lovrExposure", (float[1]) { 1.f }, 0, 1);
lovrShaderSetFloats(shader, "lovrLightDirection", (float[3]) { -1.f, -1.f, -1.f }, 0, 3);
lovrShaderSetFloats(shader, "lovrLightColor", (float[4]) { 1.f, 1.f, 1.f, 1.f }, 0, 4);
}
} else {
luax_readshadersource(L, 1);
luax_readshadersource(L, 2);

View File

@ -151,12 +151,12 @@ const char* lovrStandardFragmentShader = ""
"in vec3 vNormal; \n"
"#endif \n"
"uniform vec3 lovrLightDirection = vec3(-1., -1., -1.); \n"
"uniform vec4 lovrLightColor = vec4(1.); \n"
"uniform vec3 lovrLightDirection; \n"
"uniform vec4 lovrLightColor; \n"
"uniform samplerCube lovrSpecularIrradianceTexture; \n"
"uniform sampler2D lovrBRDFLookup; \n"
"uniform vec3 lovrIrradiance[9]; \n"
"uniform float lovrExposure = 1.; \n"
"uniform float lovrExposure; \n"
"float D_GGX(float NoH, float roughness); \n"
"float G_SmithGGXCorrelated(float NoV, float NoL, float roughness); \n"