Skip to content

Commit

Permalink
ignored texture and lighting in vertex shader while picking
Browse files Browse the repository at this point in the history
  • Loading branch information
honzi committed Jan 29, 2025
1 parent 37758b8 commit 741d4bb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions js/webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1523,16 +1523,16 @@ void main(void){
vec_position = mat_cameraMatrix * vec4(vec_vertexPosition, 1.0);
gl_Position = mat_perspectiveMatrix * vec_position;
gl_PointSize = pointSize / length(vec_position.xyz);
vec_textureCoord = vec_texturePosition;
vec3 lighting = vec_ambientColor;
if(directional){
vec4 transformedNormal = mat_perspectiveMatrix * vec4(vec_vertexNormal, 1.0);
lighting += vec_directionalColor * max(dot(transformedNormal.xyz, normalize(vec_directionalVector)), -0.5);
}
vec_lighting = vec4(lighting, alpha);
if(picking){
vec_fragmentColor = vec_pickColor;
}else{
vec_textureCoord = vec_texturePosition;
vec3 lighting = vec_ambientColor;
if(directional){
vec4 transformedNormal = mat_perspectiveMatrix * vec4(vec_vertexNormal, 1.0);
lighting += vec_directionalColor * max(dot(transformedNormal.xyz, normalize(vec_directionalVector)), -0.5);
}
vec_lighting = vec4(lighting, alpha);
vec_fragmentColor = vec_vertexColor;
}
}`,
Expand Down

0 comments on commit 741d4bb

Please sign in to comment.