Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform mat4 uMVPMatrix;
- attribute vec4 aVertex;
- attribute vec2 aTextureCoord;
- uniform vec3 uPosition;
- varying vec2 vTextureCoord;
- vec4 unit;
- vec4 distortedPosition;
- float unitLength;
- float z;
- void main()
- {
- unit.x = aVertex.x + uPosition.x;
- unit.y = aVertex.y + uPosition.y;
- unit.z = 2.5;
- unitLength = sqrt((unit.x * unit.x) + (unit.y * unit.y) + (unit.z * unit.z));
- unit.x /= unitLength;
- unit.y /= unitLength;
- unit.z /= unitLength;
- z = aVertex.z + uPosition.z;
- distortedPosition.x = unit.x * (z + 4.0);
- distortedPosition.y = unit.y * (z + 4.0);
- distortedPosition.z = unit.z * (z + 3.0);
- gl_Position = uMVPMatrix * distortedPosition;
- vTextureCoord = aTextureCoord;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement