diff options
Diffstat (limited to 'src/render/shaders')
| -rw-r--r-- | src/render/shaders/vr_video.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/render/shaders/vr_video.h b/src/render/shaders/vr_video.h index c892601..2dc54bd 100644 --- a/src/render/shaders/vr_video.h +++ b/src/render/shaders/vr_video.h @@ -33,18 +33,18 @@ static char vr_video_shader[] = \ "vec4 hook() {" " float yaw = M_PI*mouse_x;" " float pitch = M_PI*(-0.5+mouse_y);" -" float roll = M_PI*0.0;" -" float t = tan(fov/2.0);" +" float roll = M_PI*0.;" +" float t = tan(fov/2.);" " float c = cos(pitch);" " float s = sin(pitch);" " float r = target_size.y/target_size.x;" " float sR = sin(roll);" " float cR = cos(roll);" -" mat3 m = mat3(2.0*t*cR, 2.0*sR*t*r, -t*(cR+sR*r), -2.0*sR*t*c, 2.0*cR*t*c*r, t*c*(sR-cR*r)-s, -2.0*sR*t*s, 2.0*cR*t*s*r, t*s*(sR-cR*r)+c);" -" vec3 p = vec3(HOOKED_pos, 1.0)*m;" -" float theta = atan(p.x, p.z)+yaw;" -" float phi = atan(p.y, length(p.xz))+M_PI/2.0;" -" float x = fract(theta/(2.0*M_PI));" +" mat3 m = mat3(2.*t*cR,2.*sR*t*r,-t*(cR+sR*r),-2.*sR*t*c,2.*cR*t*c*r,t*c*(sR-cR*r)-s,-2.*sR*t*s,2.*cR*t*s*r,t*s*(sR-cR*r)+c);" +" vec3 p = vec3(HOOKED_pos,1.)*m;" +" float theta = atan(p.x,p.z)+yaw;" +" float phi = atan(p.y,length(p.xz))+M_PI/2.;" +" float x = fract(theta/(2.*M_PI));" " float y = phi/M_PI;" // Range: [M_PI, 2.0*M_PI] = Right eye 180 degrees. float(max(theta, mode-1.0) > 0.0) = Always true except mode = 0.0 and theta < 0.0. -" return HOOKED_tex(vec2(x, y))*clamp(abs((1.0-mode)-(step(M_PI, theta)-step(2.0*M_PI, theta)))*float(max(theta, mode-1.0)>=0.0), 0.0, 1.0);" +" return HOOKED_tex(vec2(x,y))*clamp(abs((1.-mode)-(step(M_PI,theta)-step(2.*M_PI,theta)))*float(max(theta,mode-1.)>=0.),0.,1.);" "}"; |