Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.78 KB | None | 0 0
  1. //
  2. //  Shader.vsh
  3. //  Basic iOS Game
  4. //
  5. //  Created by Tyler Camp on 2/8/11.
  6. //  Copyright __MyCompanyName__ 2011. All rights reserved.
  7. //
  8.  
  9. #define sqr(x) ((x)*(x))
  10.  
  11. attribute vec4 position;
  12. attribute vec4 color;
  13.  
  14. varying vec4 colorVarying;
  15.  
  16. uniform float translate;
  17. uniform float rotate;
  18.  
  19. void main()
  20. {
  21.     gl_Position = position;
  22.  
  23.     //  Rotative
  24.     float fRelativeAngle;
  25.     float fDistance;
  26.     fRelativeAngle = atan(gl_Position.y, gl_Position.x);
  27.     //if (fRelativeAngle < 0.0) fRelativeAngle += 360.0;
  28.     fDistance = sqrt(sqr(gl_Position.x) + sqr(gl_Position.y));
  29.  
  30.     gl_Position.x += cos (fRelativeAngle+rotate)*fDistance;
  31.     gl_Position.y += sin (fRelativeAngle+rotate)*fDistance;
  32.  
  33.     //  Translative
  34.     gl_Position.y += sin(translate) / 2.0;
  35.  
  36.     colorVarying = color;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement