From 587652e540f46395d2310edbec22a5264e5b62c0 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 29 May 2019 01:06:01 +0200 Subject: [PATCH] 2D3D:: Euclidean skies --- 3d-models.cpp | 5 ++++- drawing.cpp | 4 ++-- graph.cpp | 26 ++++++++++++++++++++++++++ hyper.h | 2 +- 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/3d-models.cpp b/3d-models.cpp index 71864c07..e8aa593f 100644 --- a/3d-models.cpp +++ b/3d-models.cpp @@ -975,7 +975,10 @@ void geometry_information::make_3d_models() { make_ball(shDisk, orbsize*.2, 2); make_ball(shHeptaMarker, zhexf*.2, 1); make_ball(shSnowball, zhexf*.1, 0); - make_ball(shSun, 3, 5); + if(euclid) + make_ball(shSun, 0.5, 2); + else + make_ball(shSun, 3, 5); make_ball(shNightStar, 0.75, 2); if(WDIM == 2) { diff --git a/drawing.cpp b/drawing.cpp index 0ef93989..0a3687ba 100644 --- a/drawing.cpp +++ b/drawing.cpp @@ -501,8 +501,8 @@ void dqi_poly::gldraw() { if(flags & POLY_TRIANGLES) { glhr::color2(color, (flags & POLY_INTENSE) ? 2 : 1); glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE); - glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW); - glhr::set_fogbase(prio == PPR::SKY ? 1.0 + 5 / sightranges[geometry] : 1.0); + glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW && prio != PPR::EUCLIDEAN_SKY); + glhr::set_fogbase(prio == PPR::SKY ? 1.0 + (euclid ? 20 : 5 / sightranges[geometry]) : 1.0); glDrawArrays(GL_TRIANGLES, ioffset, cnt); } else { diff --git a/graph.cpp b/graph.cpp index 0b963e37..d0dace05 100644 --- a/graph.cpp +++ b/graph.cpp @@ -4617,6 +4617,27 @@ int get_skybrightness(int mul = 1) { return int(s * 255); } +void draw_euclidean_sky() { + if(!euclid) return; + if(WDIM == 3 || GDIM == 2) return; + transmatrix T = ggmatrix(currentmap->gamestart()); + T = gpushxto0(tC0(T)) * T; + for(int x=-20; x<20; x++) + for(int y=-20; y<20; y++) { + curvepoint(T * zpush(cgi.WALL) * hpxy(x, y)); + curvepoint(T * zpush(cgi.WALL) * hpxy(x, y+1)); + curvepoint(T * zpush(cgi.WALL) * hpxy(x+1, y)); + curvepoint(T * zpush(cgi.WALL) * hpxy(x+1, y+1)); + curvepoint(T * zpush(cgi.WALL) * hpxy(x, y+1)); + curvepoint(T * zpush(cgi.WALL) * hpxy(x+1, y)); + } + queuecurve(0, 0x0000FFFF, PPR::EUCLIDEAN_SKY).flags |= POLY_TRIANGLES; + + auto &sun = queuepolyat(T * zpush(cgi.SKY+0.5) * xpush(cgi.SKY+0.5), cgi.shSun, 0xFFFF00FF, PPR::SKY); + sun.tinf = NULL; + sun.flags |= POLY_INTENSE; + } + void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& wcol) { if(pmodel != mdPerspective || sphere) return; @@ -4624,6 +4645,7 @@ void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& switch(ceiling_category(c)) { /* ceilingless levels */ case 1: { + if(euclid) return; if(fieldpattern::fieldval_uniq(c) % 3 == 0) { auto &star = queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY); star.tinf = NULL; @@ -4648,6 +4670,7 @@ void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& } case 2: { + if(euclid) return; color_t col; if(c->land == laWineyard) { col = 0x4040FF; @@ -4702,6 +4725,7 @@ void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF)); } if(among(c->wall, waClosedGate, waOpenGate)) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], 0x202020FF, PPR::WALL); + if(euclid) return; if(true) { auto &star = queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY); @@ -4726,6 +4750,7 @@ void draw_ceiling(cell *c, const transmatrix& V, int fd, color_t& fcol, color_t& else draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(fcol, fd, 0xFF), PPR::WALL); + if(euclid) return; if(true) { auto &star = queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY); star.tinf = NULL; @@ -7162,6 +7187,7 @@ void drawfullmap() { draw_boundary(1); draw_model_elements(); + draw_euclidean_sky(); #endif /* if(vid.wallmode < 2 && !euclid && !patterns::whichShape) { diff --git a/hyper.h b/hyper.h index 3d4b7ffd..7e48c5d7 100644 --- a/hyper.h +++ b/hyper.h @@ -2107,7 +2107,7 @@ void fallingMonsterAnimation(cell *c, eMonster m, int id = multi::cpid); // ranks: enum class PPR { - ZERO, OUTCIRCLE, MOVESTAR, + ZERO, EUCLIDEAN_SKY, OUTCIRCLE, MOVESTAR, MINUSINF, BELOWBOTTOMm, BELOWBOTTOM,