X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=demo_prior;a=blobdiff_plain;f=sdr%2Fwhitted.v.glsl;fp=sdr%2Fwhitted.v.glsl;h=1c55752c70fb4720a258639295f89c0a1ac93a72;hp=ad2878e03679c352e1fb12a492a4863d2c8f5be6;hb=ec776ad8bf37d25b9308e2c770d66247135b46ea;hpb=a89e74326444df1da625ad9614919bb7ad2352cb diff --git a/sdr/whitted.v.glsl b/sdr/whitted.v.glsl index ad2878e..1c55752 100644 --- a/sdr/whitted.v.glsl +++ b/sdr/whitted.v.glsl @@ -1,13 +1,17 @@ #define FOV 0.873 /* about 50 deg */ +uniform float aspect; + varying vec3 v_rorg, v_rdir; void main() { gl_Position = gl_Vertex; - float dist = 1.0 / tan(FOV / 2.0); - vec3 dir = vec3(gl_MultiTexCoord0.xy * 2.0 - 1.0, dist); + vec2 s = vec2(aspect, 1.0); + + float dist = -1.0 / tan(FOV / 2.0); + vec3 dir = vec3((gl_MultiTexCoord0.xy * 2.0 - 1.0) * s, dist); v_rdir = gl_NormalMatrix * dir; v_rorg = (gl_ModelViewMatrix * vec4(0.0, 0.0, 0.0, 1.0)).xyz; }