1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-24 06:03:23 +00:00

3D:: fixed how elliptic geometry works

This commit is contained in:
Zeno Rogue 2019-05-15 10:22:13 +02:00
parent 6e92cba9fe
commit 3e7b29a188
3 changed files with 10 additions and 9 deletions

View File

@ -236,10 +236,11 @@ void display_data::set_projection(int ed) {
shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true;
if(DIM == 3 && sphere && apply_models && pmodel == mdPerspective) {
shaderside_projection = true; pers3 = true;
if(spherephase == 0) glhr::new_shader_projection = glhr::shader_projection::standardS30;
if(spherephase == 1) glhr::new_shader_projection = glhr::shader_projection::standardS31;
if(spherephase == 2) glhr::new_shader_projection = glhr::shader_projection::standardS32;
if(spherephase == 3) glhr::new_shader_projection = glhr::shader_projection::standardS33;
int sp = spherephase & 3;
if(sp == 0) glhr::new_shader_projection = glhr::shader_projection::standardS30;
if(sp == 1) glhr::new_shader_projection = glhr::shader_projection::standardS31;
if(sp == 2) glhr::new_shader_projection = glhr::shader_projection::standardS32;
if(sp == 3) glhr::new_shader_projection = glhr::shader_projection::standardS33;
}
}
if(pmodel == mdFlatten) shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::flatten;

View File

@ -19,7 +19,7 @@ int detaillevel = 0;
bool first_cell_to_draw = true;
bool hide_player() {
return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && pmodel == mdPerspective && first_cell_to_draw && (WDIM == 3 || geom3::camera == 0) && !inmirrorcount
return DIM == 3 && playermoved && vid.yshift == 0 && vid.sspeed > -5 && pmodel == mdPerspective && (first_cell_to_draw || elliptic) && (WDIM == 3 || geom3::camera == 0) && !inmirrorcount
&& !(racing::on && !racing::standard_centering && !racing::player_relative);
}

View File

@ -554,7 +554,7 @@ void glapplymatrix(const transmatrix& V) {
GLfloat mat[16];
int id = 0;
if(pmodel == mdPerspective && DIM == 3) {
if(elliptic && spherephase < 2) {
if(spherephase & 4) {
for(int y=0; y<4; y++) {
for(int x=0; x<4; x++) mat[id++] = -V[x][y];
}
@ -1509,9 +1509,9 @@ extern bool lshiftclick, lctrlclick;
void draw_main() {
if(sphere && DIM == 3 && pmodel == mdPerspective) {
for(int p: {0, 1, 2, 3}) {
for(int p: {1, 0, 2, 3}) {
if(elliptic && p < 2) continue;
if(p == 1 || p == 3) {
if(p == 0 || p == 3) {
#ifdef GL_ES
glClearDepthf(1.0f);
#else
@ -1533,7 +1533,7 @@ void draw_main() {
reset_projection();
for(auto& ptd: ptds) ptd->draw();
if(elliptic) {
spherephase = p - 2;
spherephase = p | 4;
reset_projection();
for(auto& ptd: ptds) ptd->draw();
}