1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-29 19:40:35 +00:00

fixes to projection streamlining

This commit is contained in:
Zeno Rogue 2019-04-29 03:37:27 +02:00
parent be2ac7654a
commit c19ffb3597
6 changed files with 8 additions and 7 deletions

View File

@ -167,6 +167,7 @@ void setcameraangle(bool b) { }
bool shaderside_projection;
void start_projection(int ed, bool perspective) {
glhr::use_projection();
glhr::new_projection();
shaderside_projection = perspective;

View File

@ -350,6 +350,7 @@ bool nofps = false;
void draw_radar(bool cornermode) {
dynamicval<eGeometry> g(geometry, gEuclid);
dynamicval<eModel> pm(pmodel, mdText);
initquickqueue();
int rad = vid.radarsize;
@ -372,7 +373,6 @@ void draw_radar(bool cornermode) {
queueline(atscreenpos(cx+rad * r.h[0], cy - rad * r.h[2]/3 + rad * r.h[1]*2/3, 0)*C0, atscreenpos(cx+rad*r.h[0], cy - rad*r.h[2]/3, 0)*C0, r.line, -1);
}
dynamicval<eModel> pm(pmodel, mdText);
quickqueue();
for(auto& r: radarpoints)

View File

@ -3923,6 +3923,7 @@ namespace glhr {
void color2(color_t color, ld scale = 1);
void be_nontextured(shader_projection sp = new_shader_projection);
void be_textured(shader_projection sp = new_shader_projection);
void use_projection(shader_projection sp = new_shader_projection);
void set_modelview(const glmatrix& m);
hyperpoint gltopoint(const glvertex& t);
glvertex pointtogl(const hyperpoint& t);

View File

@ -273,6 +273,7 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
}
case mdUnchanged:
case mdText:
ret = H / current_display->radius;
return;
@ -654,7 +655,7 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
}
}
case mdGUARD: case mdRug: case mdText: break;
case mdGUARD: case mdRug: break;
}
ghcheck(ret,H_orig);

View File

@ -191,9 +191,6 @@ void glflush() {
glhr::color2(text_color);
glhr::set_depthtest(false);
for(int ed = (current_display->stereo_active() && text_shift)?-1:0; ed<2; ed+=2) {
if(vid.scale < 0)
glhr::set_modelview(glhr::translate(-ed*text_shift-current_display->xcenter,-current_display->ycenter, current_display->scrdist_text) * glhr::scale(-1,-1,-1));
else
glhr::set_modelview(glhr::translate(-ed*text_shift-current_display->xcenter,-current_display->ycenter, current_display->scrdist_text));
current_display->set_mask(ed);
@ -1035,7 +1032,7 @@ void dqi_poly::draw() {
} */
#if CAP_GL
if(vid.usingGL && shaderside_projection) {
if(vid.usingGL && (current_display->set_all(global_projection), shaderside_projection)) {
glLineWidth(get_width(this));
flags &= ~POLY_INVERSE;
gldraw();
@ -1521,7 +1518,7 @@ void draw_main() {
void drawqueue() {
callhooks(hook_drawqueue);
reset_projection(); current_display->set_all(0);
reset_projection();
// reset_projection() is not sufficient here, because we need to know shaderside_projection
#if CAP_GL

View File

@ -360,6 +360,7 @@ void colorClear(color_t color) {
void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); }
void be_textured(shader_projection sp) { switch_mode(gmTextured, sp); }
void use_projection(shader_projection sp) { switch_mode(mode, sp); }
void switch_mode(eMode m, shader_projection sp) {
if(m == mode && current_shader_projection == sp) return;