1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-30 07:29:54 +00:00

fixed two-eye rendering in stereo modes which should not cause that

This commit is contained in:
Zeno Rogue 2024-01-07 09:07:54 +01:00
parent 17b84bb4fb
commit 7ad955dcff
4 changed files with 14 additions and 14 deletions

View File

@ -58,7 +58,7 @@ struct display_data {
transmatrix radar_transform_post; transmatrix radar_transform_post;
ld eyewidth(); ld eyewidth();
bool stereo_active(); bool separate_eyes();
bool in_anaglyph(); bool in_anaglyph();
void set_viewport(int ed); void set_viewport(int ed);
@ -108,7 +108,7 @@ EX int get_sightrange_ambush() {
} }
bool display_data::in_anaglyph() { return vid.stereo_mode == sAnaglyph; } bool display_data::in_anaglyph() { return vid.stereo_mode == sAnaglyph; }
bool display_data::stereo_active() { return vid.stereo_mode != sOFF; } bool display_data::separate_eyes() { return among(vid.stereo_mode, sAnaglyph, sLR); }
ld display_data::eyewidth() { ld display_data::eyewidth() {
switch(vid.stereo_mode) { switch(vid.stereo_mode) {

View File

@ -229,7 +229,7 @@ EX void glflush() {
else else
#endif #endif
for(int ed = (current_display->stereo_active() && text_shift)?-1:0; ed<2; ed+=2) { for(int ed = (current_display->separate_eyes() && text_shift)?-1:0; ed<2; ed+=2) {
glhr::set_modelview(glhr::translate(-ed*text_shift-current_display->xcenter,-current_display->ycenter, 0)); glhr::set_modelview(glhr::translate(-ed*text_shift-current_display->xcenter,-current_display->ycenter, 0));
current_display->set_mask(ed); current_display->set_mask(ed);
drawer(); drawer();
@ -237,7 +237,7 @@ EX void glflush() {
GLERR("print"); GLERR("print");
} }
if(current_display->stereo_active() && text_shift && !svg::in) current_display->set_mask(0); if(current_display->separate_eyes() && text_shift && !svg::in) current_display->set_mask(0);
texts_merged = 0; texts_merged = 0;
text_vertices.clear(); text_vertices.clear();
@ -474,7 +474,7 @@ void addpoint(const shiftpoint& H) {
void coords_to_poly() { void coords_to_poly() {
polyi = isize(glcoords); polyi = isize(glcoords);
for(int i=0; i<polyi; i++) { for(int i=0; i<polyi; i++) {
if(!current_display->stereo_active()) glcoords[i][2] = 0; if(!current_display->separate_eyes()) glcoords[i][2] = 0;
polyx[i] = current_display->xcenter + glcoords[i][0] - glcoords[i][2]; polyx[i] = current_display->xcenter + glcoords[i][0] - glcoords[i][2];
polyxr[i] = current_display->xcenter + glcoords[i][0] + glcoords[i][2]; polyxr[i] = current_display->xcenter + glcoords[i][0] + glcoords[i][2];
@ -663,7 +663,7 @@ void dqi_poly::gldraw() {
int ioffset = offset; int ioffset = offset;
#if MINIMIZE_GL_CALLS #if MINIMIZE_GL_CALLS
if(current_display->stereo_active() == 0 && !tinf && (color == 0 || ((flags & (POLY_VCONVEX | POLY_CCONVEX)) && !(flags & (POLY_INVERSE | POLY_FORCE_INVERTED))))) { if(current_display->separate_eyes() == 0 && !tinf && (color == 0 || ((flags & (POLY_VCONVEX | POLY_CCONVEX)) && !(flags & (POLY_INVERSE | POLY_FORCE_INVERTED))))) {
if(lprio != prio || texts_merged || m_shift != V.shift) { if(lprio != prio || texts_merged || m_shift != V.shift) {
glflush(); glflush();
lprio = prio; lprio = prio;
@ -717,7 +717,7 @@ void dqi_poly::gldraw() {
next_slr: next_slr:
for(int ed = current_display->stereo_active() ? -1 : 0; ed<2; ed+=2) { for(int ed = current_display->separate_eyes() ? -1 : 0; ed<2; ed+=2) {
if(global_projection && global_projection != ed) continue; if(global_projection && global_projection != ed) continue;
if(min_slr < max_slr) { if(min_slr < max_slr) {
@ -2136,10 +2136,10 @@ void dqi_poly::draw() {
else else
filledPolygonColorI(srend, polyx, polyy, polyi, color); filledPolygonColorI(srend, polyx, polyy, polyi, color);
if(current_display->stereo_active()) filledPolygonColorI(auxrend, polyxr, polyy, polyi, color); if(current_display->separate_eyes()) filledPolygonColorI(auxrend, polyxr, polyy, polyi, color);
((vid.antialias & AA_NOGL) ?aapolylineColor:polylineColor)(srend, polyx, polyy, polyi, outline); ((vid.antialias & AA_NOGL) ?aapolylineColor:polylineColor)(srend, polyx, polyy, polyi, outline);
if(current_display->stereo_active()) aapolylineColor(auxrend, polyxr, polyy, polyi, outline); if(current_display->separate_eyes()) aapolylineColor(auxrend, polyxr, polyy, polyi, outline);
if(vid.xres >= 2000 || fatborder) { if(vid.xres >= 2000 || fatborder) {
int xmi = 3000, xma = -3000; int xmi = 3000, xma = -3000;
@ -2623,7 +2623,7 @@ EX void drawqueue() {
} }
#if CAP_SDL #if CAP_SDL
if(current_display->stereo_active() && !vid.usingGL) { if(current_display->separate_eyes() && !vid.usingGL) {
if(aux && (aux->w != s->w || aux->h != s->h)) { if(aux && (aux->w != s->w || aux->h != s->h)) {
SDL_FreeSurface(aux); SDL_FreeSurface(aux);
@ -2651,7 +2651,7 @@ EX void drawqueue() {
reset_projection(); reset_projection();
#if CAP_GL #if CAP_GL
if(model_needs_depth() && current_display->stereo_active()) { if(model_needs_depth() && current_display->separate_eyes()) {
global_projection = -1; global_projection = -1;
draw_main(); draw_main();
#if CAP_GL #if CAP_GL

View File

@ -167,7 +167,7 @@ bool use_z_coordinate() {
#if CAP_VR #if CAP_VR
if(vrhr::rendering()) return true; if(vrhr::rendering()) return true;
#endif #endif
return current_display->stereo_active(); return current_display->separate_eyes();
} }
void apply_depth(hyperpoint &f, ld z) { void apply_depth(hyperpoint &f, ld z) {
@ -2783,7 +2783,7 @@ EX void draw_boundary(int w) {
switch(pmodel) { switch(pmodel) {
case mdTwoPoint: { case mdTwoPoint: {
if(twopoint_do_flips || current_display->stereo_active() || !sphere) return; if(twopoint_do_flips || current_display->separate_eyes() || !sphere) return;
queuereset(mdPixel, p); queuereset(mdPixel, p);
for(int b=-1; b<=1; b+=2) for(int b=-1; b<=1; b+=2)

View File

@ -315,7 +315,7 @@ void dqi_sky::draw() {
be_euclidean_infinity(s); be_euclidean_infinity(s);
for(int ed = current_display->stereo_active() ? -1 : 0; ed<2; ed+=2) { for(int ed = current_display->separate_eyes() ? -1 : 0; ed<2; ed+=2) {
if(global_projection && global_projection != ed) continue; if(global_projection && global_projection != ed) continue;
current_display->next_shader_flags = GF_VARCOLOR; current_display->next_shader_flags = GF_VARCOLOR;
current_display->set_all(ed, 0); current_display->set_all(ed, 0);