diff --git a/glhr.cpp b/glhr.cpp index 16505214..433f46ca 100644 --- a/glhr.cpp +++ b/glhr.cpp @@ -113,6 +113,7 @@ struct glmatrix { struct colored_vertex { glvertex coords; glvec4 color; + colored_vertex() {} colored_vertex(GLfloat x, GLfloat y, GLfloat r, GLfloat g, GLfloat b) { coords[0] = x; coords[1] = y; diff --git a/sky.cpp b/sky.cpp index 739dd199..0464dd84 100644 --- a/sky.cpp +++ b/sky.cpp @@ -43,7 +43,7 @@ EX void prepare_sky() { queuepoly(T, cgi.shEuclideanSky, 0x0044e4FF); queuepolyat(T * zpush(cgi.SKY+0.5) * xpush(cgi.SKY+0.5), cgi.shSun, 0xFFFF00FF, PPR::SKY); } - else if(!(cgflags & qIDEAL)) { + else { sky = &queuea (PPR::MISSILE); } } @@ -75,6 +75,65 @@ void compute_skyvertices(const vector& sky) { bool inmir = false; forCellEx(c1, c) if(c1->land == laMirrorWall) inmir = true; if(inmir) continue; + + if(cgflags & qIDEAL) { + for(int i=0; itype; i++) { + int j = (i+1) % c->type; + transmatrix T1 = unshift(si.T); + hyperpoint ci = kleinize(get_corner_position(c, i, 3)); + hyperpoint cj = kleinize(get_corner_position(c, j, 3)); + static const int prec = 8; + ci = (ci - C0)/prec; + cj = (cj - C0)/prec; + glhr::colored_vertex vs[prec+1][prec+1], vh[prec+1][prec+1]; + + auto& co = colors[c]; + + for(int x=0; x<=prec; x++) + for(int y=0; y<=prec-x; y++) { + transmatrix h = T1 * rgpushxto0(normalize(C0+ci*min(x, prec - .01)+cj*min(y, prec-.01))); + vs[y][x] = glhr::colored_vertex(h * skypoint, co.first); + vh[y][x] = glhr::colored_vertex(h * hellpoint, co.second); + } + + for(int x=0; xmove(i))) { + for(int i=0; itype; i++) { @@ -87,9 +146,9 @@ void compute_skyvertices(const vector& sky) { transmatrix T1 = unshift(si.T); auto cw = cw0; while(colors.count(cw.at)) { - color_t col = colors[cw.at].second; - this_poly.emplace_back(T1 * skypoint, colors[cw.at].first); - this_poly.emplace_back(T1 * hellpoint, col); + auto& co = colors[cw.at]; + this_poly.emplace_back(T1 * skypoint, co.first); + this_poly.emplace_back(T1 * hellpoint, co.second); T1 = T1 * currentmap->adj(cw.at, cw.spin); cw += wstep; cw++; } @@ -181,9 +240,7 @@ void celldrawer::draw_ceiling() { if(pmodel != mdPerspective || sphere) return; auto add_to_sky = [this] (color_t col, color_t col2) { - if(cgflags & qIDEAL) - draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(col, 0, 0xFF), PPR::WALL); - else if(sky) sky->sky.emplace_back(c, V, col, col2); + if(sky) sky->sky.emplace_back(c, V, col, col2); }; switch(ceiling_category(c)) {