mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 15:40:26 +00:00
fixes to projection streamlining
This commit is contained in:
parent
be2ac7654a
commit
c19ffb3597
@ -167,6 +167,7 @@ void setcameraangle(bool b) { }
|
|||||||
bool shaderside_projection;
|
bool shaderside_projection;
|
||||||
|
|
||||||
void start_projection(int ed, bool perspective) {
|
void start_projection(int ed, bool perspective) {
|
||||||
|
glhr::use_projection();
|
||||||
glhr::new_projection();
|
glhr::new_projection();
|
||||||
shaderside_projection = perspective;
|
shaderside_projection = perspective;
|
||||||
|
|
||||||
|
2
hud.cpp
2
hud.cpp
@ -350,6 +350,7 @@ bool nofps = false;
|
|||||||
|
|
||||||
void draw_radar(bool cornermode) {
|
void draw_radar(bool cornermode) {
|
||||||
dynamicval<eGeometry> g(geometry, gEuclid);
|
dynamicval<eGeometry> g(geometry, gEuclid);
|
||||||
|
dynamicval<eModel> pm(pmodel, mdText);
|
||||||
initquickqueue();
|
initquickqueue();
|
||||||
int rad = vid.radarsize;
|
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);
|
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();
|
quickqueue();
|
||||||
|
|
||||||
for(auto& r: radarpoints)
|
for(auto& r: radarpoints)
|
||||||
|
1
hyper.h
1
hyper.h
@ -3923,6 +3923,7 @@ namespace glhr {
|
|||||||
void color2(color_t color, ld scale = 1);
|
void color2(color_t color, ld scale = 1);
|
||||||
void be_nontextured(shader_projection sp = new_shader_projection);
|
void be_nontextured(shader_projection sp = new_shader_projection);
|
||||||
void be_textured(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);
|
void set_modelview(const glmatrix& m);
|
||||||
hyperpoint gltopoint(const glvertex& t);
|
hyperpoint gltopoint(const glvertex& t);
|
||||||
glvertex pointtogl(const hyperpoint& t);
|
glvertex pointtogl(const hyperpoint& t);
|
||||||
|
@ -273,6 +273,7 @@ void applymodel(hyperpoint H, hyperpoint& ret) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case mdUnchanged:
|
case mdUnchanged:
|
||||||
|
case mdText:
|
||||||
ret = H / current_display->radius;
|
ret = H / current_display->radius;
|
||||||
return;
|
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);
|
ghcheck(ret,H_orig);
|
||||||
|
@ -191,9 +191,6 @@ void glflush() {
|
|||||||
glhr::color2(text_color);
|
glhr::color2(text_color);
|
||||||
glhr::set_depthtest(false);
|
glhr::set_depthtest(false);
|
||||||
for(int ed = (current_display->stereo_active() && text_shift)?-1:0; ed<2; ed+=2) {
|
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));
|
glhr::set_modelview(glhr::translate(-ed*text_shift-current_display->xcenter,-current_display->ycenter, current_display->scrdist_text));
|
||||||
current_display->set_mask(ed);
|
current_display->set_mask(ed);
|
||||||
|
|
||||||
@ -1035,7 +1032,7 @@ void dqi_poly::draw() {
|
|||||||
} */
|
} */
|
||||||
|
|
||||||
#if CAP_GL
|
#if CAP_GL
|
||||||
if(vid.usingGL && shaderside_projection) {
|
if(vid.usingGL && (current_display->set_all(global_projection), shaderside_projection)) {
|
||||||
glLineWidth(get_width(this));
|
glLineWidth(get_width(this));
|
||||||
flags &= ~POLY_INVERSE;
|
flags &= ~POLY_INVERSE;
|
||||||
gldraw();
|
gldraw();
|
||||||
@ -1521,7 +1518,7 @@ void draw_main() {
|
|||||||
|
|
||||||
void drawqueue() {
|
void drawqueue() {
|
||||||
callhooks(hook_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
|
// reset_projection() is not sufficient here, because we need to know shaderside_projection
|
||||||
|
|
||||||
#if CAP_GL
|
#if CAP_GL
|
||||||
|
@ -360,6 +360,7 @@ void colorClear(color_t color) {
|
|||||||
|
|
||||||
void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); }
|
void be_nontextured(shader_projection sp) { switch_mode(gmColored, sp); }
|
||||||
void be_textured(shader_projection sp) { switch_mode(gmTextured, 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) {
|
void switch_mode(eMode m, shader_projection sp) {
|
||||||
if(m == mode && current_shader_projection == sp) return;
|
if(m == mode && current_shader_projection == sp) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user