Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. [VERT]
  2.  
  3. attribute vec4 a_position;
  4.  
  5. varying vec3 texCoord;
  6.  
  7. uniform mat4 u_worldTrans;
  8. uniform mat4 u_projTrans;
  9. ...
  10.  
  11. void main()
  12. {
  13. gl_Position = u_projTrans * u_worldTrans * a_position;
  14. texCoord = vec3(a_position);
  15. }
  16.  
  17.  
  18. [FRAG]
  19. varying vec3 texCoord;
  20. uniform samplerCube u_cubemapTex;
  21.  
  22. void main()
  23. {
  24. gl_FragColor = textureCube(u_cubemapTex, texCoord);
  25. }
  26.  
  27. [VERT]
  28. attribute vec3 a_normal;
  29.  
  30. varying vec3 v_reflection;
  31.  
  32. uniform mat4 u_matViewInverseTranspose;
  33. uniform vec3 u_cameraPos;
  34. ...
  35.  
  36. void main()
  37. {
  38. mat3 normalMatrix = mat3(u_matViewInverseTranspose);
  39. vec3 n = normalize(normalMatrix * a_normal);
  40.  
  41. //calculate reflection
  42. vec3 vView = a_position.xyz - u_cameraPos.xyz;
  43. v_reflection = reflect(vView, n);
  44.  
  45. ...
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement