Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.71 KB | None | 0 0
  1. uniform mat4 uMVPMatrix;
  2. attribute vec4 aVertex;
  3. attribute vec2 aTextureCoord;
  4. uniform vec3 uPosition;
  5. varying vec2 vTextureCoord;
  6.        
  7. vec4 unit;
  8. vec4 distortedPosition;
  9. float unitLength;
  10. float z;
  11.    
  12. void main()
  13. {
  14.     unit.x = aVertex.x + uPosition.x;
  15.     unit.y = aVertex.y + uPosition.y;
  16.     unit.z = 2.5;
  17.    
  18.     unitLength = sqrt((unit.x * unit.x) + (unit.y * unit.y) + (unit.z * unit.z));
  19.    
  20.     unit.x /= unitLength;
  21.     unit.y /= unitLength;
  22.     unit.z /= unitLength;
  23.  
  24.     z = aVertex.z + uPosition.z;
  25.    
  26.     distortedPosition.x = unit.x * (z + 4.0);
  27.     distortedPosition.y = unit.y * (z + 4.0);
  28.     distortedPosition.z = unit.z * (z + 3.0);
  29.    
  30.     gl_Position = uMVPMatrix * distortedPosition;
  31.     vTextureCoord = aTextureCoord;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement