1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-24 05:17:17 +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; shaderside_projection = true, glhr::new_shader_projection = glhr::shader_projection::standardR3, pers3 = true;
if(DIM == 3 && sphere && apply_models && pmodel == mdPerspective) { if(DIM == 3 && sphere && apply_models && pmodel == mdPerspective) {
shaderside_projection = true; pers3 = true; shaderside_projection = true; pers3 = true;
if(spherephase == 0) glhr::new_shader_projection = glhr::shader_projection::standardS30; int sp = spherephase & 3;
if(spherephase == 1) glhr::new_shader_projection = glhr::shader_projection::standardS31; if(sp == 0) glhr::new_shader_projection = glhr::shader_projection::standardS30;
if(spherephase == 2) glhr::new_shader_projection = glhr::shader_projection::standardS32; if(sp == 1) glhr::new_shader_projection = glhr::shader_projection::standardS31;
if(spherephase == 3) glhr::new_shader_projection = glhr::shader_projection::standardS33; 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; 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 first_cell_to_draw = true;
bool hide_player() { 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); && !(racing::on && !racing::standard_centering && !racing::player_relative);
} }

View File

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