Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #version 400
  2. in vec4 vPosition;
  3. out vec4 clipSpace;
  4. uniform mat4 model;
  5. uniform mat4 view;
  6. uniform mat4 projection;
  7.  
  8. void main ()
  9. {
  10. clipSpace = projection * view * model * vec4(vPosition.x, 0.0, vPosition.z, 1.0);
  11. gl_Position = clipSpace;
  12. }
  13.  
  14. #version 400
  15. in vec4 clipSpace;
  16. out vec4 frag_colour;
  17. uniform sampler2D reflectionTexture;
  18.  
  19. void main ()
  20. {
  21. vec2 ndc = (clipSpace.xy / clipSpace.z) / 2.0 + 0.5;
  22. vec2 reflectTexCoords = vec2(ndc.x, -ndc.y);
  23. vec4 reflectColour = texture(reflectionTexture, reflectTexCoords);
  24.  
  25. frag_colour = reflectColour;
  26. }
  27.  
  28. float distance = 2 * (m_camera->GetPosition().y - m_water->GetHeight());
  29. m_camera->m_cameraPosition.y -= distance;
  30. m_camera->m_cameraPitch = -m_camera->m_cameraPitch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement