change bubble to refract

This commit is contained in:
Thyme1 2022-01-02 17:29:41 +01:00
parent 62f81b5d34
commit 73e2bbff4a
2 changed files with 11 additions and 7 deletions

View File

@ -12,15 +12,19 @@ void main()
{
float ratio = 1.33 / 1.00;
vec3 I = normalize(fragPos - cameraPos);
vec3 R = refract(I, normalize(interpNormal), ratio);
vec3 r = reflect(normalize(-fragPos), normalize(interpNormal));
vec3 Refract = refract(I, normalize(interpNormal), ratio);
vec3 R = reflect(I, normalize(interpNormal));
vec3 flip = reflect(normalize(-fragPos), normalize(interpNormal));
vec4 reflectionColor = texture( tex_map, r );
vec4 refractionColor = texture( tex_map, R );
vec4 flipColor = texture( tex_map, flip );
vec4 refractionColor = texture( tex_map, Refract );
vec4 reflectionColor = texture( tex_map, R );
gl_FragColor = vec4(mix( reflectionColor,refractionColor,0 ).rgba);
//vec4 color = vec4(mix(flipColor,reflectionColor,0).rgb,1.0);
gl_FragColor = vec4(mix( flipColor,refractionColor,0).rgb,1.0);
}

View File

@ -379,7 +379,7 @@ void renderScene()
glm::mat4 bubbleInitialTransformation = glm::translate(glm::vec3(0, -0.5, -0.4)) * glm::rotate(glm::radians(180.0f), glm::vec3(0, 1, 0)) * glm::scale(glm::vec3(0.5f));
//drawObjectTexture(bubbleContext, bubbleInitialTransformation, cubemapTexture, cubeProgram);
drawObjectTexture(bubbleContext, bubbleInitialTransformation, cubemapTexture, cubeProgram);
glm::vec3 change1 = glm::vec3(0, 3, 0);