"varying vec2 texcoord_r;\n"
"varying vec2 texcoord_g;\n"
"varying vec2 texcoord_b;\n"
+ "varying float vignette;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(gl_Vertex.xy, 0.5, 1.0);\n"
" texcoord_r = gl_MultiTexCoord0.xy;\n"
" texcoord_g = gl_MultiTexCoord1.xy;\n"
" texcoord_b = gl_MultiTexCoord2.xy;\n"
+ " vignette = gl_MultiTexCoord3.x;\n"
"}\n";
const char fs_source[] =
"varying vec2 texcoord_r;\n"
"varying vec2 texcoord_g;\n"
"varying vec2 texcoord_b;\n"
+ "varying float vignette;\n"
"void main()\n"
"{\n"
" float r = texture2D(texture, texcoord_r).r;\n"
" float g = texture2D(texture, texcoord_g).g;\n"
" float b = texture2D(texture, texcoord_b).b;\n"
- " gl_FragColor = vec4(r, g, b, 1.0);\n"
+ " gl_FragColor = vec4(vec3(r, g, b)*vignette, 1.0);\n"
"}\n";
void create_distortion_mesh(Msp::GL::Mesh &mesh, ovrHmd hmd, ovrEyeType eye, const ovrFovPort &fov)
{
ovrDistortionMesh ovr_mesh;
- ovrHmd_CreateDistortionMesh(hmd, eye, fov, ovrDistortionCap_Chromatic, &ovr_mesh);
+ ovrHmd_CreateDistortionMesh(hmd, eye, fov, ovrDistortionCap_Chromatic|ovrDistortionCap_Vignette, &ovr_mesh);
ovrSizei tex_size = ovrHmd_GetFovTextureSize(hmd, eye, fov, 1.0);
ovrRecti view_rect;
bld.multitexcoord(0, v.TanEyeAnglesR.x*scale.x+offset.x, 1.0f-(v.TanEyeAnglesR.y*scale.y+offset.y));
bld.multitexcoord(1, v.TanEyeAnglesG.x*scale.x+offset.x, 1.0f-(v.TanEyeAnglesG.y*scale.y+offset.y));
bld.multitexcoord(2, v.TanEyeAnglesB.x*scale.x+offset.x, 1.0f-(v.TanEyeAnglesB.y*scale.y+offset.y));
+ bld.multitexcoord(3, v.VignetteFactor);
bld.vertex(v.ScreenPosNDC.x, v.ScreenPosNDC.y);
}
OculusRiftCombiner::OculusRiftCombiner(const OculusRiftDevice &d):
device(d),
- left_mesh((GL::VERTEX2, GL::TEXCOORD2,0, GL::TEXCOORD2,1, GL::TEXCOORD2,2)),
- right_mesh((GL::VERTEX2, GL::TEXCOORD2,0, GL::TEXCOORD2,1, GL::TEXCOORD2,2)),
+ left_mesh((GL::VERTEX2, GL::TEXCOORD2,0, GL::TEXCOORD2,1, GL::TEXCOORD2,2, GL::TEXCOORD1,3)),
+ right_mesh((GL::VERTEX2, GL::TEXCOORD2,0, GL::TEXCOORD2,1, GL::TEXCOORD2,2, GL::TEXCOORD1,3)),
shprog(vs_source, fs_source)
{
const OculusRiftDevice::Private &dev_priv = device.get_private();