mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-07 03:13:49 +00:00
Correct vNumLights cast to int in calc_light.
Fixed calc_light work on NVidia cards.
This commit is contained in:
parent
048a1576fb
commit
1cbb35be65
|
@ -447,7 +447,7 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
|
|||
#ifdef GLES2
|
||||
strFragmentShader.append(" lowp float intensity = calc_light(int(vNumLights), vShadeColor.rgb, input_color); \n");
|
||||
#else
|
||||
strFragmentShader.append(" float intensity = calc_light(int(vNumLights), vShadeColor.rgb, input_color); \n");
|
||||
strFragmentShader.append(" float intensity = calc_light(vNumLights, vShadeColor.rgb, input_color); \n");
|
||||
#endif
|
||||
else
|
||||
strFragmentShader.append(" input_color = vShadeColor.rgb;\n");
|
||||
|
|
12
Shaders.h
12
Shaders.h
|
@ -189,14 +189,14 @@ static const char* fragment_shader_header_common_functions =
|
|||
#ifdef SHADER_PRECISION
|
||||
" \n"
|
||||
"lowp float snoise(in mediump vec2 v); \n"
|
||||
"mediump float calc_light(in lowp int nLights, in lowp vec3 input_color, out lowp vec3 output_color);\n"
|
||||
"mediump float calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color);\n"
|
||||
"mediump float mipmap(out lowp vec4 readtex0, out lowp vec4 readtex1); \n"
|
||||
"lowp bool depth_compare(); \n"
|
||||
"lowp bool alpha_test(in lowp float alphaValue); \n"
|
||||
#else
|
||||
" \n"
|
||||
"float snoise(in vec2 v); \n"
|
||||
"float calc_light(in int nLights, in vec3 input_color, out vec3 output_color);\n"
|
||||
"float calc_light(in float fLights, in vec3 input_color, out vec3 output_color);\n"
|
||||
"float mipmap(out vec4 readtex0, out vec4 readtex1); \n"
|
||||
"bool depth_compare(); \n"
|
||||
"bool alpha_test(in float alphaValue); \n"
|
||||
|
@ -212,8 +212,9 @@ static const char* fragment_shader_calc_light =
|
|||
"uniform mediump vec3 uLightDirection[8]; \n"
|
||||
"uniform lowp vec3 uLightColor[8]; \n"
|
||||
" \n"
|
||||
"mediump float calc_light(in lowp int nLights, in lowp vec3 input_color, out lowp vec3 output_color) {\n"
|
||||
"mediump float calc_light(in lowp float fLights, in lowp vec3 input_color, out lowp vec3 output_color) {\n"
|
||||
" output_color = input_color; \n"
|
||||
" lowp int nLights = int(floor(fLights + 0.5)); \n"
|
||||
" if (nLights == 0) \n"
|
||||
" return 1.0; \n"
|
||||
" mediump float full_intensity = 0.0; \n"
|
||||
|
@ -227,14 +228,16 @@ static const char* fragment_shader_calc_light =
|
|||
" lightColor = intensity*uLightColor[i]; \n"
|
||||
" output_color += lightColor; \n"
|
||||
" }; \n"
|
||||
" clamp(output_color, 0.0, 1.0); \n"
|
||||
" return full_intensity; \n"
|
||||
"} \n"
|
||||
#else
|
||||
"uniform vec3 uLightDirection[8]; \n"
|
||||
"uniform vec3 uLightColor[8]; \n"
|
||||
" \n"
|
||||
"float calc_light(in int nLights, in vec3 input_color, out vec3 output_color) {\n"
|
||||
"float calc_light(in float fLights, in vec3 input_color, out vec3 output_color) {\n"
|
||||
" output_color = input_color; \n"
|
||||
" int nLights = int(floor(fLights + 0.5)); \n"
|
||||
" if (nLights == 0) \n"
|
||||
" return 1.0; \n"
|
||||
" float full_intensity = 0.0; \n"
|
||||
|
@ -248,6 +251,7 @@ static const char* fragment_shader_calc_light =
|
|||
" lightColor = intensity*uLightColor[i]; \n"
|
||||
" output_color += lightColor; \n"
|
||||
" }; \n"
|
||||
" clamp(output_color, 0.0, 1.0); \n"
|
||||
" return full_intensity; \n"
|
||||
"} \n"
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user