Skip to content

Commit

Permalink
allow to disable lighting for line imposters
Browse files Browse the repository at this point in the history
  • Loading branch information
LiangliangNan committed Jan 19, 2024
1 parent 037c5ba commit 0ff53cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 15 deletions.
14 changes: 9 additions & 5 deletions resources/shaders/lines/lines_cones_texture.frag
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,13 @@ void main()

gl_FragDepth = depth;

vec3 light_dir = normalize(eLightPos);

vec3 color = texture(textureID, gOutTexcoord).rgb;
vec3 final_color = ComputeLight(normal, light_dir, view_dir, ambient, specular, shininess, color);
outputF = vec4(final_color, 1.0);
vec4 color = texture(textureID, gOutTexcoord);
if (lighting) {
vec3 light_dir = normalize(eLightPos);
vec3 final_color = ComputeLight(normal, light_dir, view_dir, ambient, specular, shininess, color.rgb);
outputF = vec4(final_color, 1.0);
}
else {
outputF = color;
}
}
9 changes: 4 additions & 5 deletions resources/shaders/lines/lines_cylinders_color.frag
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,12 @@ void main()

gl_FragDepth = depth;

if (!lighting) {
outputF = gOutColor;
}

else {
if (lighting) {
vec3 light_dir = normalize(eLightPos);
vec3 final_color = shade(normal, light_dir, view_dir, ambient, specular, shininess, gOutColor.xyz);
outputF = vec4(final_color, gOutColor.a);
}
else {
outputF = gOutColor;
}
}
14 changes: 9 additions & 5 deletions resources/shaders/lines/lines_cylinders_texture.frag
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,13 @@ void main()

gl_FragDepth = depth;

vec3 light_dir = normalize(eLightPos);

vec3 color = texture(textureID, gOutTexcoord).rgb;
vec3 final_color = ComputeLight(normal, light_dir, view_dir, ambient, specular, shininess, color);
outputF = vec4(final_color, 1.0);
vec4 color = texture(textureID, gOutTexcoord);
if (lighting) {
vec3 light_dir = normalize(eLightPos);
vec3 final_color = ComputeLight(normal, light_dir, view_dir, ambient, specular, shininess, color.rgb);
outputF = vec4(final_color, 1.0);
}
else {
outputF = color;
}
}

0 comments on commit 0ff53cb

Please sign in to comment.