"uniform sampler2D texture;\n"
"uniform vec4 distortion;\n"
"uniform vec4 chromatic;\n"
"uniform sampler2D texture;\n"
"uniform vec4 distortion;\n"
"uniform vec4 chromatic;\n"
"{\n"
" float r_sq = dot(texcoord, texcoord);\n"
" float f = dot(distortion, vec4(1.0, r_sq, r_sq*r_sq, r_sq*r_sq*r_sq));\n"
"{\n"
" float r_sq = dot(texcoord, texcoord);\n"
" float f = dot(distortion, vec4(1.0, r_sq, r_sq*r_sq, r_sq*r_sq*r_sq));\n"
- " vec2 red_dtc = (texcoord*f*(chromatic[0]+chromatic[1]*r_sq)-eye_center)/(scale.xy*scale.z)+0.5;\n"
- " vec2 blue_dtc = (texcoord*f*(chromatic[2]+chromatic[3]*r_sq)-eye_center)/(scale.xy*scale.z)+0.5;\n"
+ " vec2 red_dtc = (texcoord*f*(chromatic[0]+chromatic[1]*r_sq)-eye_center)/(scale.xy*scale.z)+lens_center;\n"
+ " vec2 blue_dtc = (texcoord*f*(chromatic[2]+chromatic[3]*r_sq)-eye_center)/(scale.xy*scale.z)+lens_center;\n"
" gl_FragColor = vec4(texture2D(texture, red_dtc).r, texture2D(texture, dtc).g, texture2D(texture, blue_dtc).b, 1.0);\n"
" }\n"
"}\n";
" gl_FragColor = vec4(texture2D(texture, red_dtc).r, texture2D(texture, dtc).g, texture2D(texture, blue_dtc).b, 1.0);\n"
" }\n"
"}\n";
/* Determine the necessary scaling factor to avoid quality degradation in
the center of the screen. */
/* Determine the necessary scaling factor to avoid quality degradation in
the center of the screen. */
float vert_oversize = distort(1.25f*fill_factor)/(1.25f*fill_factor);
oversize = min(horiz_oversize, vert_oversize);
float vert_oversize = distort(1.25f*fill_factor)/(1.25f*fill_factor);
oversize = min(horiz_oversize, vert_oversize);
right_shdata.uniform("scale", 2.0f, 2.5f, oversize);
fov = Geometry::atan(oversize*0.625f/view_distance)*2.0f;
right_shdata.uniform("scale", 2.0f, 2.5f, oversize);
fov = Geometry::atan(oversize*0.625f/view_distance)*2.0f;