Browse Source

gpu: fix GLSL ES syntax errors in various shaders.

legacy
Sam Hocevar sam 11 years ago
parent
commit
36c36525a2
2 changed files with 8 additions and 8 deletions
  1. +5
    -5
      src/easymesh/shinydebugUV.lolfx
  2. +3
    -3
      src/easymesh/shinydebugnormal.lolfx

+ 5
- 5
src/easymesh/shinydebugUV.lolfx View File

@@ -53,14 +53,14 @@ void main(void)
float mode = 0.0; float mode = 0.0;
if (mode == 0.0) if (mode == 0.0)
{ {
gl_FragColor = vec4(mod(pass_TexCoord.x, 1.0f),
gl_FragColor = vec4(mod(pass_TexCoord.x, 1.0),
0.1, 0.1,
mod(pass_TexCoord.y, 1.0), 1.0); mod(pass_TexCoord.y, 1.0), 1.0);
} }
else else
{ {
float col = ((mod(mode, 2.0) == 1)?(mod(pass_TexCoord.x, 1.0)):(mod(pass_TexCoord.y, 1.0)));
if (mode == 1 || mode == 2)
float col = ((mod(mode, 2.0) == 1.0)?(mod(pass_TexCoord.x, 1.0)):(mod(pass_TexCoord.y, 1.0)));
if (mode == 1.0 || mode == 2.0)
{ {
if (col > 1.0/3.0) gl_FragColor.r = 0.0; if (col > 1.0/3.0) gl_FragColor.r = 0.0;
else gl_FragColor.r = min(col, 1.0/3.0); else gl_FragColor.r = min(col, 1.0/3.0);
@@ -68,14 +68,14 @@ void main(void)
else gl_FragColor.g = min(max(col, 1.0/3.0) - 1.0/3.0, 1.0/3.0); else gl_FragColor.g = min(max(col, 1.0/3.0) - 1.0/3.0, 1.0/3.0);
gl_FragColor.b = min(max(col, 2.0/3.0) - 2.0/3.0, 1.0/3.0); gl_FragColor.b = min(max(col, 2.0/3.0) - 2.0/3.0, 1.0/3.0);
} }
else if (mode == 3 || mode == 4)
else if (mode == 3.0 || mode == 4.0)
{ {
if (col > 0.5) gl_FragColor.r = 0.0; if (col > 0.5) gl_FragColor.r = 0.0;
else gl_FragColor.r = min(col, 0.5); else gl_FragColor.r = min(col, 0.5);
gl_FragColor.g = min(max(col, 0.5) - 0.5, 0.5); gl_FragColor.g = min(max(col, 0.5) - 0.5, 0.5);
gl_FragColor.b = 0.1; gl_FragColor.b = 0.1;
} }
else if (mode == 5 || mode == 6)
else if (mode == 5.0 || mode == 6.0)
{ {
gl_FragColor.r = col; gl_FragColor.r = col;
gl_FragColor.g = 0.1; gl_FragColor.g = 0.1;


+ 3
- 3
src/easymesh/shinydebugnormal.lolfx View File

@@ -47,9 +47,9 @@ varying vec4 pass_Color;
void main(void) void main(void)
{ {
vec3 real_color = vec3(0.0, 0.0, 0.0); vec3 real_color = vec3(0.0, 0.0, 0.0);
real_color += abs(pass_TNormal.x) * ((pass_TNormal.x < .0f)?(vec3(0.0, 1.0, 1.0)):(vec3(1.0, 0.0, 0.0)));
real_color += abs(pass_TNormal.y) * ((pass_TNormal.y < .0f)?(vec3(1.0, 0.0, 1.0)):(vec3(0.0, 1.0, 0.0)));
real_color += abs(pass_TNormal.z) * ((pass_TNormal.z < .0f)?(vec3(1.0, 1.0, 0.0)):(vec3(0.0, 0.0, 1.0)));
real_color += abs(pass_TNormal.x) * ((pass_TNormal.x < 0.0)?(vec3(0.0, 1.0, 1.0)):(vec3(1.0, 0.0, 0.0)));
real_color += abs(pass_TNormal.y) * ((pass_TNormal.y < 0.0)?(vec3(1.0, 0.0, 1.0)):(vec3(0.0, 1.0, 0.0)));
real_color += abs(pass_TNormal.z) * ((pass_TNormal.z < 0.0)?(vec3(1.0, 1.0, 0.0)):(vec3(0.0, 0.0, 1.0)));
gl_FragColor = vec4(real_color, pass_Color.w); gl_FragColor = vec4(real_color, pass_Color.w);
} }




Loading…
Cancel
Save