Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- varying vec3 vColor;
- varying vec2 uv;
- uniform sampler2D tex;
- uniform vec2 resolution;
- vec4 HmdWarpParam = vec4(1.4, 0.22, 0.24, 80);
- void main(void)
- {
- float x;
- float y;
- float rSq;
- vec2 theta = vec2(x,y);
- theta.x = gl_FragCoord.x / resolution.x * 1.7;
- theta.y = gl_FragCoord.y / resolution.y;
- if(gl_FragCoord.x > resolution.x / 2.0)
- theta.x -= 0.7;
- theta.x -= 0.5;
- theta.y -= 0.5;
- rSq = theta.x*theta.x + theta.y*theta.y;
- vec2 rvector;
- rvector = theta * (HmdWarpParam.x + HmdWarpParam.y*rSq + HmdWarpParam.z * rSq * rSq + HmdWarpParam.w * rSq * rSq * rSq);
- x = rvector.x;
- y = rvector.y;
- rvector.x+=0.5;
- rvector.y+=0.5;
- rvector.y = 1.0-rvector.y;
- if(rvector.x >= 0.0 && rvector.y >= 0.0 && rvector.x <= 1.0 && rvector.y <= 1.0) {
- gl_FragColor = texture2D(tex, rvector);
- }
- else {
- // red
- gl_FragColor = vec4(0.0,0.0,0.0,1.0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment