Offset HUD screen rects for out-of-screen stereo parallax on HUD overlays.
Used 1x VR_eye_offset to track image shift adjustments via OGL frustum planes instead of 2x VR_eye_offset used in Descent 1.5 image shift adjustments. Without any HUD rect offset, HUD overlays would appear to match the zero-parallax view plane instead of appearing in an out-of-screen parallax view plane.
This commit is contained in:
parent
6bc0e822d2
commit
23bbe7dde8
|
@ -217,7 +217,6 @@ void init_stereo()
|
||||||
VR_eye_width = (F1_0 * 7) / 10; // Descent 1.5 defaults
|
VR_eye_width = (F1_0 * 7) / 10; // Descent 1.5 defaults
|
||||||
VR_eye_offset = (VR_half_width) ? -6 : -12;
|
VR_eye_offset = (VR_half_width) ? -6 : -12;
|
||||||
PlayerCfg.CockpitMode[1] = CM_FULL_SCREEN;
|
PlayerCfg.CockpitMode[1] = CM_FULL_SCREEN;
|
||||||
reset_cockpit();
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
VR_stereo = VR_half_width = VR_half_height = false;
|
VR_stereo = VR_half_width = VR_half_height = false;
|
||||||
|
@ -331,25 +330,29 @@ void game_init_render_sub_buffers( int x, int y, int w, int h )
|
||||||
gr_clear_canvas(*grd_curcanv, 0);
|
gr_clear_canvas(*grd_curcanv, 0);
|
||||||
gr_init_sub_canvas(Screen_3d_window, grd_curscreen->sc_canvas, x, y, w, h);
|
gr_init_sub_canvas(Screen_3d_window, grd_curscreen->sc_canvas, x, y, w, h);
|
||||||
|
|
||||||
|
if (VR_stereo) {
|
||||||
|
// offset HUD screen rects to force out-of-screen parallax on HUD overlays
|
||||||
|
int dx = (VR_eye_offset < 0) ? -VR_eye_offset : 0;
|
||||||
switch (VR_stereo) {
|
switch (VR_stereo) {
|
||||||
case STEREO_NONE:
|
case STEREO_NONE:
|
||||||
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x, y, w, h);
|
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x+dx, y, w-dx, h);
|
||||||
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x, y, w, h);
|
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x, y, w-dx, h);
|
||||||
break;
|
break;
|
||||||
case STEREO_ABOVE_BELOW:
|
case STEREO_ABOVE_BELOW:
|
||||||
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x, y, w, h);
|
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x+dx, y, w-dx, h);
|
||||||
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x, y+h, w, h);
|
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x, y+h, w-dx, h);
|
||||||
break;
|
break;
|
||||||
case STEREO_SIDE_BY_SIDE:
|
case STEREO_SIDE_BY_SIDE:
|
||||||
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x, y, w, h);
|
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x+dx, y, w-dx, h);
|
||||||
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x+w, y, w, h);
|
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x+w, y, w-dx, h);
|
||||||
break;
|
break;
|
||||||
case STEREO_SIDE_BY_SIDE2:
|
case STEREO_SIDE_BY_SIDE2:
|
||||||
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x, y+h/2, w, h);
|
gr_init_sub_canvas(VR_hud_left, grd_curscreen->sc_canvas, x+dx, y+h/2, w-dx, h);
|
||||||
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x+w, y+h/2, w, h);
|
gr_init_sub_canvas(VR_hud_right, grd_curscreen->sc_canvas, x+w, y+h/2, w-dx, h);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -912,28 +912,34 @@ static window_event_result HandleSystemKey(int key)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef DXX_USE_OGL
|
#if DXX_USE_OGL
|
||||||
case KEY_SHIFTED + KEY_F5:
|
case KEY_SHIFTED + KEY_F5:
|
||||||
VR_eye_offset -= 1;
|
VR_eye_offset -= 1;
|
||||||
|
reset_cockpit();
|
||||||
break;
|
break;
|
||||||
case KEY_SHIFTED + KEY_F6:
|
case KEY_SHIFTED + KEY_F6:
|
||||||
VR_eye_offset += 1;
|
VR_eye_offset += 1;
|
||||||
|
reset_cockpit();
|
||||||
break;
|
break;
|
||||||
case KEY_SHIFTED + KEY_ALTED + KEY_F5:
|
case KEY_SHIFTED + KEY_ALTED + KEY_F5:
|
||||||
VR_eye_width -= (F1_0/10); //*= 10/11;
|
VR_eye_width -= (F1_0/10); //*= 10/11;
|
||||||
|
reset_cockpit();
|
||||||
break;
|
break;
|
||||||
case KEY_SHIFTED + KEY_ALTED + KEY_F6:
|
case KEY_SHIFTED + KEY_ALTED + KEY_F6:
|
||||||
VR_eye_width += (F1_0/10); //*= 11/10;
|
VR_eye_width += (F1_0/10); //*= 11/10;
|
||||||
|
reset_cockpit();
|
||||||
break;
|
break;
|
||||||
case KEY_SHIFTED + KEY_F7:
|
case KEY_SHIFTED + KEY_F7:
|
||||||
case KEY_SHIFTED + KEY_ALTED + KEY_F7:
|
case KEY_SHIFTED + KEY_ALTED + KEY_F7:
|
||||||
VR_eye_width = F1_0;
|
VR_eye_width = F1_0;
|
||||||
VR_eye_offset = 0;
|
VR_eye_offset = 0;
|
||||||
|
reset_cockpit();
|
||||||
break;
|
break;
|
||||||
case KEY_SHIFTED + KEY_F8:
|
case KEY_SHIFTED + KEY_F8:
|
||||||
case KEY_SHIFTED + KEY_ALTED + KEY_F8:
|
case KEY_SHIFTED + KEY_ALTED + KEY_F8:
|
||||||
++VR_stereo %= STEREO_MAX_FORMAT;
|
++VR_stereo %= STEREO_MAX_FORMAT;
|
||||||
init_stereo();
|
init_stereo();
|
||||||
|
reset_cockpit();
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -778,7 +778,7 @@ int BigWindowSwitch=0;
|
||||||
//render a frame for the game
|
//render a frame for the game
|
||||||
void game_render_frame_mono(const control_info &Controls)
|
void game_render_frame_mono(const control_info &Controls)
|
||||||
{
|
{
|
||||||
int no_draw_hud = 0; //VR_stereo;
|
int no_draw_hud = 0;
|
||||||
|
|
||||||
gr_set_current_canvas(Screen_3d_window);
|
gr_set_current_canvas(Screen_3d_window);
|
||||||
#if defined(DXX_BUILD_DESCENT_II)
|
#if defined(DXX_BUILD_DESCENT_II)
|
||||||
|
@ -869,11 +869,8 @@ void game_render_frame_mono(const control_info &Controls)
|
||||||
gr_set_current_canvas(Screen_3d_window);
|
gr_set_current_canvas(Screen_3d_window);
|
||||||
if (!no_draw_hud) {
|
if (!no_draw_hud) {
|
||||||
if (VR_stereo) {
|
if (VR_stereo) {
|
||||||
// gr_set_current_canvas(VR_hud_left);
|
|
||||||
game_draw_hud_stuff(VR_hud_left, Controls);
|
game_draw_hud_stuff(VR_hud_left, Controls);
|
||||||
// gr_set_current_canvas(VR_hud_right);
|
|
||||||
game_draw_hud_stuff(VR_hud_right, Controls);
|
game_draw_hud_stuff(VR_hud_right, Controls);
|
||||||
// gr_set_default_canvas();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
game_draw_hud_stuff(*grd_curcanv, Controls);
|
game_draw_hud_stuff(*grd_curcanv, Controls);
|
||||||
|
|
Loading…
Reference in a new issue