File tree Expand file tree Collapse file tree 3 files changed +11
-5
lines changed
examples/shaders/resources/shaders Expand file tree Collapse file tree 3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ void main()
4040 vec3 viewD = normalize (viewPos - fragPosition);
4141 vec3 specular = vec3 (0.0 );
4242
43+ vec4 tint = colDiffuse * fragColor;
44+
4345 // NOTE: Implement here your fragment shader code
4446
4547 for (int i = 0 ; i < MAX_LIGHTS; i++ )
@@ -67,7 +69,7 @@ void main()
6769 }
6870 }
6971
70- vec4 finalColor = (texelColor* ((colDiffuse + vec4 (specular, 1.0 ))* vec4 (lightDot, 1.0 )));
72+ vec4 finalColor = (texelColor* ((tint + vec4 (specular, 1.0 ))* vec4 (lightDot, 1.0 )));
7173 finalColor += texelColor* (ambient/ 10.0 );
7274
7375 // Gamma correction
Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ void main()
3838 vec3 viewD = normalize (viewPos - fragPosition);
3939 vec3 specular = vec3 (0.0 );
4040
41+ vec4 tint = colDiffuse * fragColor;
42+
4143 // NOTE: Implement here your fragment shader code
4244
4345 for (int i = 0 ; i < MAX_LIGHTS; i++ )
@@ -65,7 +67,7 @@ void main()
6567 }
6668 }
6769
68- vec4 finalColor = (texelColor* ((colDiffuse + vec4 (specular, 1.0 ))* vec4 (lightDot, 1.0 )));
70+ vec4 finalColor = (texelColor* ((tint + vec4 (specular, 1.0 ))* vec4 (lightDot, 1.0 )));
6971 finalColor += texelColor* (ambient/ 10.0 );
7072
7173 // Gamma correction
Original file line number Diff line number Diff line change 33// Input vertex attributes (from vertex shader)
44in vec3 fragPosition;
55in vec2 fragTexCoord;
6- // in vec4 fragColor;
6+ in vec4 fragColor;
77in vec3 fragNormal;
88
99// Input uniform values
@@ -41,6 +41,8 @@ void main()
4141 vec3 viewD = normalize (viewPos - fragPosition);
4242 vec3 specular = vec3 (0.0 );
4343
44+ vec4 tint = colDiffuse * fragColor;
45+
4446 // NOTE: Implement here your fragment shader code
4547
4648 for (int i = 0 ; i < MAX_LIGHTS; i++ )
@@ -68,8 +70,8 @@ void main()
6870 }
6971 }
7072
71- finalColor = (texelColor* ((colDiffuse + vec4 (specular, 1.0 ))* vec4 (lightDot, 1.0 )));
72- finalColor += texelColor* (ambient/ 10.0 )* colDiffuse ;
73+ finalColor = (texelColor* ((tint + vec4 (specular, 1.0 ))* vec4 (lightDot, 1.0 )));
74+ finalColor += texelColor* (ambient/ 10.0 )* tint ;
7375
7476 // Gamma correction
7577 finalColor = pow (finalColor, vec4 (1.0 / 2.2 ));
You can’t perform that action at this time.
0 commit comments