resolmve some issues

This commit is contained in:
Mylloon 2023-05-12 11:56:18 +02:00
parent 973faf0cbc
commit b1f69d0539
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
3 changed files with 5 additions and 5 deletions

View file

@ -5,5 +5,5 @@ out vec4 fragColor;
void main(void) { void main(void) {
vec4 c = texture(tex, vsoTexCoord); vec4 c = texture(tex, vsoTexCoord);
fragColor = vec4(c.rgb, length(c.rgb) > 0.0 ? 1.0 : 0.0); fragColor = vec4(c.rgb, length(c.rgb) > 0 ? 1 : 0);
} }

View file

@ -7,9 +7,9 @@ uniform mat4 modview, proj;
out vec2 vsoTexCoord; out vec2 vsoTexCoord;
void main(void) { void main(void) {
gl_Position = proj * modview * vec4(vsiPosition, 1.0); gl_Position = proj * modview * vec4(vsiPosition, 1);
if(inv != 0) { if(inv != 0) {
vsoTexCoord = vec2(vsiTexCoord.s, 1.0 - vsiTexCoord.t); vsoTexCoord = vec2(vsiTexCoord.s, 1 - vsiTexCoord.t);
} else { } else {
vsoTexCoord = vec2(vsiTexCoord.s, vsiTexCoord.t); vsoTexCoord = vec2(vsiTexCoord.s, vsiTexCoord.t);
} }

View file

@ -14,9 +14,9 @@ void main() {
const vec3 vue = vec3(0, 0, -1); const vec3 vue = vec3(0, 0, -1);
const vec4 soleil_color = vec4(0.81f, 0.78f, 0.66f, 1.0f); const vec4 soleil_color = vec4(0.81f, 0.78f, 0.66f, 1.0f);
vec3 torche = normalize(pos_model.xyz - lum_pos.xyz); vec3 torche = normalize(pos_model.xyz - lum_pos.xyz);
float intensite_lumineuse = clamp(dot(vec_normal, -torche), 0, 1); float intensite_lumineuse = clamp(dot(vec_normal, -torche), 0., 1.);
vec3 reflet = (transpose(inverse(view)) * vec4(reflect(torche, vec_normal), 0)).xyz; vec3 reflet = (transpose(inverse(view)) * vec4(reflect(torche, vec_normal), 0)).xyz;
float intensite_specularite = pow(clamp(dot(reflet, -vue), 0, 1), 10); float intensite_specularite = pow(clamp(dot(reflet, -vue), 0., 1.), 10);
fragColor = intensite_specularite * lum_color + 0.1 * soleil_color + 0.9 * intensite_lumineuse * couleur; fragColor = intensite_specularite * lum_color + 0.1 * soleil_color + 0.9 * intensite_lumineuse * couleur;
} }