Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Shader.vsh
- // Basic iOS Game
- //
- // Created by Tyler Camp on 2/8/11.
- // Copyright __MyCompanyName__ 2011. All rights reserved.
- //
- #define sqr(x) ((x)*(x))
- attribute vec4 position;
- attribute vec4 color;
- varying vec4 colorVarying;
- uniform float translate;
- uniform float rotate;
- void main()
- {
- gl_Position = position;
- // Rotative
- float fRelativeAngle;
- float fDistance;
- fRelativeAngle = atan(gl_Position.y, gl_Position.x);
- //if (fRelativeAngle < 0.0) fRelativeAngle += 360.0;
- fDistance = sqrt(sqr(gl_Position.x) + sqr(gl_Position.y));
- gl_Position.x += cos (fRelativeAngle+rotate)*fDistance;
- gl_Position.y += sin (fRelativeAngle+rotate)*fDistance;
- // Translative
- gl_Position.y += sin(translate) / 2.0;
- colorVarying = color;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement