2019-10-25 10:44:41 +00:00
|
|
|
#include "hyper.h"
|
|
|
|
|
|
|
|
namespace hr {
|
|
|
|
|
2020-08-01 14:47:21 +00:00
|
|
|
EX bool context_fog = true;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
EX ld camera_level;
|
2020-07-03 12:48:36 +00:00
|
|
|
#if MAXMDIM >= 4 && CAP_GL
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
EX int get_skybrightness(int mul IS(1)) {
|
|
|
|
ld s = 1 - mul * (camera_level - cgi.WALL) / -2;
|
|
|
|
if(s > 1) return 255;
|
|
|
|
if(s < 0) return 0;
|
|
|
|
return int(s * 255);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct sky_item {
|
|
|
|
cell *c;
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T;
|
2019-10-25 10:44:41 +00:00
|
|
|
color_t color;
|
2020-08-01 11:59:53 +00:00
|
|
|
color_t skycolor;
|
|
|
|
sky_item(cell *_c, const struct shiftmatrix _T, color_t _color, color_t _skycolor) : c(_c), T(_T), color(_color), skycolor(_skycolor) {}
|
2019-10-25 10:44:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct dqi_sky : drawqueueitem {
|
|
|
|
vector<sky_item> sky;
|
|
|
|
void draw();
|
|
|
|
virtual color_t outline_group() { return 3; }
|
|
|
|
// singleton
|
|
|
|
dqi_sky() { hr::sky = this; }
|
|
|
|
~dqi_sky() { hr::sky = NULL; }
|
|
|
|
};
|
|
|
|
|
|
|
|
EX struct dqi_sky *sky;
|
|
|
|
|
|
|
|
EX void prepare_sky() {
|
|
|
|
sky = NULL;
|
|
|
|
if(euclid) {
|
|
|
|
if(WDIM == 3 || GDIM == 2) return;
|
2020-06-03 13:11:20 +00:00
|
|
|
if(no_wall_rendering) return;
|
2020-07-27 16:49:04 +00:00
|
|
|
shiftmatrix T = ggmatrix(currentmap->gamestart());
|
|
|
|
T.T = gpushxto0(tC0(T.T)) * T.T;
|
2019-10-25 10:44:41 +00:00
|
|
|
queuepoly(T, cgi.shEuclideanSky, 0x0044e4FF);
|
|
|
|
queuepolyat(T * zpush(cgi.SKY+0.5) * xpush(cgi.SKY+0.5), cgi.shSun, 0xFFFF00FF, PPR::SKY);
|
|
|
|
}
|
2020-05-29 08:29:13 +00:00
|
|
|
else if(!(cgflags & qIDEAL)) {
|
2020-08-01 11:59:53 +00:00
|
|
|
sky = &queuea<dqi_sky> (PPR::MISSILE);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void dqi_sky::draw() {
|
|
|
|
|
|
|
|
if(!vid.usingGL || sky.empty()) return;
|
|
|
|
vector<glhr::colored_vertex> skyvertices;
|
|
|
|
|
|
|
|
int sk = get_skybrightness();
|
|
|
|
|
Remove USE_UNORDERED_MAP because it has bit-rotted.
Trying to compile with `-DUSE_UNORDERED_MAP` produces lots of compiler errors
like these, because of missing `std::hash` specializations.
Also, `#define unordered_map map` is just evil!
```
./nonisotropic.cpp:875:36: note: in instantiation of template class 'std::__1::unordered_map<hr::nilv::mvec, hr::heptagon *,
std::__1::hash<hr::nilv::mvec>, std::__1::equal_to<hr::nilv::mvec>, std::__1::allocator<std::__1::pair<const hr::nilv::mvec, hr::heptagon
*> > >' requested here
unordered_map<mvec, heptagon*> at;
^
./nonisotropic.cpp:239:58: note: in instantiation of template class 'std::__1::unordered_map<std::__1::pair<hr::heptagon *, hr::heptagon *>,
hr::heptagon *, std::__1::hash<std::__1::pair<hr::heptagon *, hr::heptagon *> >, std::__1::equal_to<std::__1::pair<hr::heptagon *,
hr::heptagon *> >, std::__1::allocator<std::__1::pair<const std::__1::pair<hr::heptagon *, hr::heptagon *>, hr::heptagon *> > >'
requested here
unordered_map<pair<heptagon*, heptagon*>, heptagon*> at;
^
./nonisotropic.cpp:457:49: error: no matching member function for call to 'iadj'
while(h1->distance < h2->distance) back = iadj(h2, down) * back, h2 = h2->cmove(down);
^~~~
cell.cpp:42:15: note: candidate function not viable: no known conversion from 'hr::sn::hrmap_solnih' to 'hr::hrmap' for object argument
transmatrix iadj(heptagon *h, int d) {
^
cell.cpp:41:22: note: candidate function not viable: no known conversion from 'hr::sn::hrmap_solnih' to 'hr::hrmap' for object argument
struct transmatrix iadj(cell *c, int i) { cell *c1 = c->cmove(i); return adj(c1, c->c.spin(i)); }
^
```
2020-09-25 03:15:19 +00:00
|
|
|
map<cell*, pair<color_t, color_t>> colors;
|
2020-08-01 11:59:53 +00:00
|
|
|
for(sky_item& si: sky) colors[si.c] =
|
|
|
|
make_pair(darkena(gradient(0, si.color, 0, sk, 255), 0, 0xFF),
|
|
|
|
darkena(si.skycolor, 0, 0xFF)
|
|
|
|
);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
hyperpoint skypoint = cpush0(2, cgi.SKY);
|
2020-08-01 11:59:53 +00:00
|
|
|
hyperpoint hellpoint = cpush0(2, -cgi.SKY);
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
vector<glhr::colored_vertex> this_poly;
|
|
|
|
|
|
|
|
// I am not sure why, but extra projection martix introduced in stereo
|
|
|
|
// causes some vertices to not be drawn. Thus we apply separately
|
|
|
|
transmatrix Tsh = Id;
|
|
|
|
if(global_projection)
|
|
|
|
Tsh = xpush(vid.ipd * global_projection/2);
|
|
|
|
|
|
|
|
for(sky_item& si: sky) {
|
|
|
|
auto c = si.c;
|
|
|
|
for(int i=0; i<c->type; i++) {
|
|
|
|
|
2020-08-01 11:59:53 +00:00
|
|
|
if(1) {
|
|
|
|
cellwalker cw0(c, i);
|
|
|
|
cellwalker cw2 = cw0;
|
|
|
|
cw2--; cw2 += wstep;
|
|
|
|
if(!colors.count(cw2.at)) {
|
|
|
|
this_poly.clear();
|
|
|
|
transmatrix T1 = unshift(si.T);
|
|
|
|
T1 = Tsh * T1;
|
|
|
|
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);
|
|
|
|
T1 = T1 * currentmap->adj(cw.at, cw.spin);
|
|
|
|
cw += wstep; cw++;
|
|
|
|
}
|
|
|
|
|
|
|
|
int k = isize(this_poly);
|
|
|
|
for(int j=2; j<k; j+=2) {
|
|
|
|
skyvertices.push_back(this_poly[j-2]);
|
|
|
|
skyvertices.push_back(this_poly[j-1]);
|
|
|
|
skyvertices.push_back(this_poly[j]);
|
|
|
|
skyvertices.push_back(this_poly[j-1]);
|
|
|
|
skyvertices.push_back(this_poly[j]);
|
|
|
|
skyvertices.push_back(this_poly[j+1]);
|
|
|
|
}
|
|
|
|
goto next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
if(1) {
|
|
|
|
cellwalker cw0(c, i);
|
|
|
|
cellwalker cw = cw0;
|
|
|
|
do {
|
|
|
|
cw += wstep; cw++;
|
2020-08-01 11:59:53 +00:00
|
|
|
if(cw.at < c || !colors.count(cw.at)) goto next;
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
while(cw != cw0);
|
|
|
|
|
|
|
|
this_poly.clear();
|
|
|
|
|
2020-07-27 16:49:04 +00:00
|
|
|
transmatrix T1 = unshift(si.T);
|
|
|
|
T1 = Tsh * T1;
|
2019-10-25 10:44:41 +00:00
|
|
|
do {
|
2020-08-01 11:59:53 +00:00
|
|
|
this_poly.emplace_back(T1 * skypoint, colors[cw.at].first);
|
2019-11-14 15:51:50 +00:00
|
|
|
T1 = T1 * currentmap->adj(cw.at, cw.spin);
|
2019-10-25 10:44:41 +00:00
|
|
|
cw += wstep; cw++;
|
|
|
|
}
|
|
|
|
while(cw != cw0);
|
|
|
|
|
|
|
|
int k = isize(this_poly);
|
|
|
|
for(int j=2; j<k; j++) {
|
|
|
|
skyvertices.push_back(this_poly[0]);
|
|
|
|
skyvertices.push_back(this_poly[j-1]);
|
|
|
|
skyvertices.push_back(this_poly[j]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
next: ;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(auto& v: skyvertices) for(int i=0; i<3; i++) v.color[i] *= 2;
|
|
|
|
|
|
|
|
for(int ed = current_display->stereo_active() ? -1 : 0; ed<2; ed+=2) {
|
|
|
|
if(global_projection && global_projection != ed) continue;
|
|
|
|
current_display->next_shader_flags = GF_VARCOLOR;
|
2020-07-27 16:49:04 +00:00
|
|
|
current_display->set_all(ed, 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(global_projection)
|
|
|
|
glhr::projection_multiply(glhr::tmtogl(xpush(-vid.ipd * global_projection/2)));
|
|
|
|
glapplymatrix(Id);
|
|
|
|
glhr::prepare(skyvertices);
|
|
|
|
glhr::set_fogbase(1.0 + 5 / sightranges[geometry]);
|
|
|
|
glhr::set_depthtest(model_needs_depth() && prio < PPR::SUPERLINE);
|
|
|
|
glhr::set_depthwrite(model_needs_depth() && prio != PPR::TRANSPARENT_SHADOW && prio != PPR::EUCLIDEAN_SKY);
|
|
|
|
glDrawArrays(GL_TRIANGLES, 0, isize(skyvertices));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
color_t skycolor(cell *c) {
|
|
|
|
int cd = (euclid || stdhyperbolic) ? getCdata(c, 1) : 0;
|
|
|
|
int z = (cd * 5) & 127;
|
|
|
|
if(z >= 64) z = 127 - z;
|
2020-08-01 11:59:53 +00:00
|
|
|
return gradient(0x4040FF, 0xFFFFFF, 0, z, 63);
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void celldrawer::draw_ceiling() {
|
|
|
|
|
|
|
|
if(pmodel != mdPerspective || sphere) return;
|
|
|
|
|
2020-08-01 11:59:53 +00:00
|
|
|
auto add_to_sky = [this] (color_t col, color_t col2) {
|
2020-05-29 08:29:13 +00:00
|
|
|
if(cgflags & qIDEAL)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(col, 0, 0xFF), PPR::WALL);
|
2020-08-01 11:59:53 +00:00
|
|
|
else if(sky) sky->sky.emplace_back(c, V, col, col2);
|
2020-05-29 08:29:13 +00:00
|
|
|
};
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
switch(ceiling_category(c)) {
|
|
|
|
/* ceilingless levels */
|
|
|
|
case 1: {
|
|
|
|
if(euclid) return;
|
|
|
|
if(fieldpattern::fieldval_uniq(c) % 3 == 0) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
|
|
|
}
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(0x00000F, 0x00000F);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(c->land == laAsteroids) {
|
|
|
|
if(fieldpattern::fieldval_uniq(c) % 9 < 3) {
|
|
|
|
queuepolyat(V * zpush(-1-cgi.SKY), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
|
|
|
}
|
|
|
|
int sk = get_skybrightness(-1);
|
|
|
|
auto sky = draw_shapevec(c, V * MirrorZ, cgi.shFullFloor.levels[SIDE_SKY], 0x000000FF + 0x100 * (sk/17), PPR::SKY);
|
|
|
|
if(sky) sky->tinf = NULL, sky->flags |= POLY_INTENSE;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 2: {
|
|
|
|
if(euclid) return;
|
|
|
|
color_t col;
|
2020-08-01 11:59:53 +00:00
|
|
|
color_t skycol;
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
switch(c->land) {
|
|
|
|
case laWineyard:
|
|
|
|
col = 0x4040FF;
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = 0x8080FF;
|
2019-10-25 10:44:41 +00:00
|
|
|
if(emeraldval(c) / 4 == 11) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shSun, 0xFFFF00FF, PPR::SKY);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-08-01 14:47:37 +00:00
|
|
|
case laDesert:
|
|
|
|
col = 0x2020C0;
|
|
|
|
skycol = 0x8080FF;
|
|
|
|
if(emeraldval(c) / 4 == 11) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shSun, 0xFFFF00FF, PPR::SKY);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2020-05-15 23:06:47 +00:00
|
|
|
case laFrog:
|
|
|
|
col = 0x4040FF;
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = 0x8080FF;
|
2020-05-15 23:06:47 +00:00
|
|
|
if(zebra40(c) / 4 == 1) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shSun, 0xFFFF00FF, PPR::SKY);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2019-10-25 10:44:41 +00:00
|
|
|
case laPower:
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = col = c->landparam ? 0xFF2010 : 0x000020;
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
2020-08-01 14:47:37 +00:00
|
|
|
/* case laDesert:
|
2019-10-25 10:44:41 +00:00
|
|
|
col = 0x4040FF;
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = (0xCDA98F & 0xFEFEFE) / 2;
|
2020-08-01 14:47:37 +00:00
|
|
|
break; */
|
2019-10-25 10:44:41 +00:00
|
|
|
|
|
|
|
case laAlchemist:
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = col = fcol;
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case laVariant: {
|
2020-10-15 14:33:52 +00:00
|
|
|
#if CAP_COMPLEX2
|
2019-10-25 10:44:41 +00:00
|
|
|
int b = getBits(c);
|
|
|
|
col = 0x404040;
|
|
|
|
for(int a=0; a<21; a++)
|
|
|
|
if((b >> a) & 1)
|
2019-12-08 18:17:28 +00:00
|
|
|
col += variant::features[a].color_change;
|
2019-10-25 10:44:41 +00:00
|
|
|
col = col & 0x00FF00;
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = col;
|
2020-10-15 14:33:52 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case laDragon:
|
|
|
|
col = c->wall == waChasm ? 0xFFFFFF : 0x4040FF;
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = 0;
|
2019-10-25 10:44:41 +00:00
|
|
|
break;
|
|
|
|
|
2020-08-01 11:59:53 +00:00
|
|
|
case laHell: {
|
|
|
|
int a = 0;
|
|
|
|
forCellEx(c1, c) if(among(c1->wall, waSulphur, waSulphurC)) a++;
|
|
|
|
ld z = a * 1. / c->type;
|
|
|
|
if(z < .5)
|
|
|
|
col = gradient(0x400000, 0xFF0000, 0, z, .5);
|
|
|
|
else
|
|
|
|
col = gradient(0xFF0000, 0xFFFF00, .5, z, 1);
|
|
|
|
skycol = col;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default: {
|
2019-10-25 10:44:41 +00:00
|
|
|
col = skycolor(c);
|
2020-08-01 11:59:53 +00:00
|
|
|
skycol = 0xA0A0FF;
|
|
|
|
}
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(col, skycol);
|
2019-10-25 10:44:41 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 3: {
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(0, 0);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(camera_level <= cgi.WALL) return;
|
|
|
|
if(c->land == laMercuryRiver) fcol = linf[laTerracotta].color, fd = 1;
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(fcol, fd, 0xFF), PPR::WALL);
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
if(ceiling_category(c2) != 3) {
|
|
|
|
color_t wcol2 = gradient(0, wcol, 0, .8, 1);
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
placeSidewall(c, i, SIDE_SKY, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 4: {
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(0x00000F, 0x00000F);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(camera_level <= cgi.HIGH2) return;
|
|
|
|
auto ispal = [&] (cell *c0) { return c0->land == laPalace && among(c0->wall, waPalace, waClosedGate, waOpenGate); };
|
|
|
|
color_t wcol2 = 0xFFD500;
|
|
|
|
if(ispal(c)) {
|
|
|
|
forCellIdEx(c2, i, c) if(!ispal(c2))
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
bool window = false;
|
|
|
|
forCellIdEx(c2, i, c) if(c2->wall == waPalace && ispal(c->cmodmove(i+1)) && ispal(c->cmodmove(i-1))) window = true;
|
|
|
|
if(qfi.fshape && !window) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(fcol, fd, 0xFF), PPR::WALL);
|
|
|
|
if(window)
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
}
|
|
|
|
if(among(c->wall, waClosedGate, waOpenGate) && qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], 0x202020FF, PPR::WALL);
|
|
|
|
if(euclid) return;
|
|
|
|
|
|
|
|
if(true) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 6: {
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(skycolor(c), 0x4040C0);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(camera_level <= cgi.HIGH2) return;
|
|
|
|
color_t wcol2 = winf[waRuinWall].color;
|
|
|
|
if(c->landparam == 1)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam != 1)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam != 2)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam == 2)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
2020-08-01 11:59:53 +00:00
|
|
|
/* if(c->landparam == 0)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(wcol2, fd, 0xFF), PPR::WALL); */
|
2019-10-25 10:44:41 +00:00
|
|
|
if(c->landparam == 1)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 7: {
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(0x00000F, 0x00000F);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(fieldpattern::fieldval_uniq(c) % 5 < 2) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+1), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
|
|
|
}
|
|
|
|
if(camera_level <= cgi.HIGH2) return;
|
|
|
|
color_t wcol2 = winf[waColumn].color;
|
|
|
|
if(c->landparam == 1)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam != 1)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam != 2)
|
|
|
|
forCellIdEx(c2, i, c) if(c2->landparam == 2)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH2, V, darkena(wcol2, fd, 0xFF));
|
|
|
|
if(c->landparam == 0)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_HIGH], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
if(c->landparam == 1)
|
|
|
|
if(qfi.fshape) draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(wcol2, fd, 0xFF), PPR::WALL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 5: {
|
2020-08-01 11:59:53 +00:00
|
|
|
add_to_sky(0x00000F, 0x00000F);
|
2019-10-25 10:44:41 +00:00
|
|
|
if(camera_level <= cgi.WALL) return;
|
|
|
|
|
|
|
|
if(pseudohept(c)) {
|
|
|
|
forCellIdEx(c2, i, c)
|
|
|
|
placeSidewall(c, i, SIDE_HIGH, V, darkena(fcol, fd, 0xFF));
|
|
|
|
}
|
|
|
|
else if(qfi.fshape)
|
|
|
|
draw_shapevec(c, V, qfi.fshape->levels[SIDE_WALL], darkena(fcol, fd, 0xFF), PPR::WALL);
|
|
|
|
|
|
|
|
if(euclid) return;
|
|
|
|
if(true) {
|
|
|
|
queuepolyat(V * zpush(cgi.SKY+0.5), cgi.shNightStar, 0xFFFFFFFF, PPR::SKY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-01 11:59:53 +00:00
|
|
|
|
|
|
|
EX struct renderbuffer *airbuf;
|
|
|
|
|
|
|
|
EX void make_air() {
|
|
|
|
if(!sky) return;
|
|
|
|
const int AIR_TEXTURE = 512;
|
|
|
|
if(!airbuf) {
|
|
|
|
airbuf = new renderbuffer(AIR_TEXTURE, AIR_TEXTURE, true);
|
|
|
|
if(!airbuf->valid) {
|
|
|
|
delete airbuf;
|
|
|
|
airbuf = nullptr;
|
|
|
|
println(hlog, "unable to make airbuf");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(1) {
|
|
|
|
//shot::take("airtest.png", drawqueue);
|
|
|
|
dynamicval<videopar> v(vid, vid);
|
|
|
|
dynamicval<bool> vi(inHighQual, true);
|
|
|
|
|
|
|
|
vid.xres = AIR_TEXTURE;
|
|
|
|
vid.yres = AIR_TEXTURE;
|
|
|
|
calcparam();
|
|
|
|
models::configure();
|
|
|
|
|
|
|
|
resetbuffer rb;
|
|
|
|
airbuf->enable();
|
|
|
|
current_display->set_viewport(0);
|
|
|
|
|
|
|
|
airbuf->clear(0xFFFF00FF);
|
|
|
|
|
|
|
|
pconf.alpha = 1;
|
|
|
|
pconf.scale = 1;
|
|
|
|
pconf.camera_angle = 0;
|
|
|
|
pconf.stretch = 1;
|
|
|
|
pmodel = mdDisk;
|
|
|
|
|
|
|
|
vid.always3 = false;
|
|
|
|
geom3::apply_always3();
|
|
|
|
check_cgi();
|
|
|
|
cgi.require_shapes();
|
|
|
|
|
|
|
|
eGeometry orig = geometry;
|
|
|
|
|
|
|
|
glDisable(GL_LINE_SMOOTH);
|
|
|
|
|
|
|
|
for(auto& g: sky->sky) {
|
|
|
|
transmatrix S;
|
|
|
|
if(1) {
|
|
|
|
geometry = gSpace534;
|
|
|
|
S = g.T.T;
|
|
|
|
S = radar_transform * S;
|
|
|
|
geometry = orig;
|
|
|
|
swapmatrix(S);
|
|
|
|
}
|
|
|
|
|
|
|
|
auto& h = cgi.shFullFloor.b[shvid(g.c)];
|
|
|
|
|
|
|
|
dqi_poly p;
|
|
|
|
p.V = shiftless(S);
|
|
|
|
p.offset = h.s;
|
|
|
|
p.cnt = h.e - h.s;
|
|
|
|
p.tab = &cgi.ourshape;
|
|
|
|
p.color = (g.skycolor << 8) | 0xFF;
|
|
|
|
p.outline = 0;
|
|
|
|
|
|
|
|
p.linewidth = 1;
|
|
|
|
p.flags = POLY_FORCEWIDE;
|
|
|
|
p.tinf = nullptr;
|
|
|
|
|
|
|
|
p.draw();
|
|
|
|
}
|
|
|
|
|
|
|
|
if(vid.antialias & AA_LINES)
|
|
|
|
glEnable(GL_LINE_SMOOTH);
|
|
|
|
|
2020-10-05 18:48:56 +00:00
|
|
|
#if CAP_SDL
|
2020-08-01 11:59:53 +00:00
|
|
|
if(anyshiftclick) IMAGESAVE(airbuf->render(), "air.png");
|
2020-10-05 18:48:56 +00:00
|
|
|
#endif
|
2020-08-01 11:59:53 +00:00
|
|
|
rb.reset();
|
|
|
|
}
|
|
|
|
|
|
|
|
GLERR("after draw");
|
|
|
|
geom3::apply_always3();
|
|
|
|
check_cgi();
|
|
|
|
calcparam();
|
|
|
|
GLERR("after make_air");
|
|
|
|
current_display->set_viewport(0);
|
|
|
|
current_display->set_all(0,0);
|
|
|
|
}
|
|
|
|
|
2019-11-03 13:19:11 +00:00
|
|
|
#endif
|
2019-10-25 10:44:41 +00:00
|
|
|
}
|