minor changes

This commit is contained in:
Thyme1 2022-01-01 12:35:51 +01:00
parent f03ed1fa4b
commit 33a09475d2
2 changed files with 8 additions and 7 deletions

View File

@ -1,5 +1,5 @@
#version 330 core
out vec4 gl_FragColor;
uniform sampler2D textureSampler;
in vec3 fragPos;
@ -10,7 +10,8 @@ uniform samplerCube skybox;
void main()
{
float ratio = 1.00 / 1.52;
vec3 I = normalize(fragPos - cameraPos);
vec3 R = reflect(I, normalize(interpNormal));
gl_FragColor = vec4(texture(skybox, R).rgb, 1.0);
vec3 R = refract(I, normalize(interpNormal),ratio);
gl_FragColor = vec4(texture(textureSampler, R).rgb, 1.0);
}

View File

@ -10,7 +10,7 @@ uniform mat4 modelViewProjectionMatrix;
void main()
{
interpNormal = mat3(transpose(inverse(modelMatrix))) * vertexNormal;
fragPos = vec3(modelMatrix * vec4(vertexPosition, 1.0));
gl_Position = modelViewProjectionMatrix * vec4(vertexPosition, 1.0);
interpNormal = (modelMatrix * vec4(vertexNormal, 0.0)).xyz;
fragPos = (modelMatrix*vec4(vertexPosition,1)).xyz;
}