mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-06-26 15:12:48 +00:00
s2xe:: removed old junk
This commit is contained in:
parent
55c41463dd
commit
341934d1c5
103
drawing.cpp
103
drawing.cpp
@ -1096,83 +1096,46 @@ void draw_s2xe0(dqi_poly *p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
glcoords.resize(p->cnt);
|
glcoords.resize(p->cnt);
|
||||||
if(p->flags & POLY_TRIANGLES) {
|
for(auto c: pd) if(c.bad == 2) return;
|
||||||
for(int i=0; i<p->cnt; i+=3) {
|
bool no_gens = false;
|
||||||
int nbad = 0;
|
for(int i=0; i<p->cnt; i++) {
|
||||||
for(int j=i; j<i+3; j++) {
|
auto &c1 = pd[i];
|
||||||
if(pd[j].bad >= 1) nbad = max(nbad, 0);
|
auto &c0 = pd[i==0?p->cnt-1 : i-1];
|
||||||
if(pd[j].bad >= 2) nbad = 2;
|
if(c1.distance > M_PI/2 && c0.distance > M_PI/2 && crossdot(c0.direction, c1.direction).second < 0) return;
|
||||||
}
|
if(c1.bad == 2) return;
|
||||||
|
if(c1.bad == 1) no_gens = true;
|
||||||
|
}
|
||||||
|
|
||||||
int g = (pd[i].distance > M_PI/2 || pd[i+1].distance >= M_PI/2 || pd[i+2].distance >= M_PI/2) ? 2 : 1;
|
if(!no_gens) {
|
||||||
|
|
||||||
auto c1 = crossdot(pd[i+0].direction, pd[i+1].direction);
|
vector<ld> angles(p->cnt);
|
||||||
auto c2 = crossdot(pd[i+1].direction, pd[i+2].direction);
|
for(int i=0; i<p->cnt; i++) {
|
||||||
auto c3 = crossdot(pd[i+2].direction, pd[i+0].direction);
|
angles[i] = atan2(pd[i].direction[1], pd[i].direction[0]);
|
||||||
if(c1.second < 0 || c2.second < 0 || c3.second < 0) nbad = max(nbad, g);
|
|
||||||
if(c1.first > 0 && c2.first > 0 && c3.first > 0) nbad = max(nbad, g);
|
|
||||||
if(c1.first < 0 && c2.first < 0 && c3.first < 0) nbad = max(nbad, g);
|
|
||||||
pd[i].bad = pd[i+1].bad = pd[i+2].bad = nbad;
|
|
||||||
}
|
}
|
||||||
|
sort(angles.begin(), angles.end());
|
||||||
for(int gen=-maxgen; gen<=maxgen; gen++) {
|
angles.push_back(angles[0] + 2 * M_PI);
|
||||||
for(int i=0; i<p->cnt; i++) {
|
bool ok = false;
|
||||||
auto& cur = pd[i];
|
for(int i=1; i<isize(angles); i++)
|
||||||
if(cur.bad >= (gen ? 1 : 2)) glcoords[i] = junk;
|
if(angles[i] >= angles[i-1] + M_PI) ok = true;
|
||||||
else {
|
if(!ok) {
|
||||||
hyperpoint h;
|
for(auto &c: pd) if(c.distance > M_PI/2) return;
|
||||||
ld d = cur.distance + 2 * M_PI * gen;
|
no_gens = true;
|
||||||
h[0] = cur.direction[0] * d;
|
|
||||||
h[1] = cur.direction[1] * d;
|
|
||||||
h[2] = cur.z;
|
|
||||||
glcoords[i] = glhr::pointtogl(h);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
npoly.gldraw();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
for(auto c: pd) if(c.bad == 2) return;
|
int g = no_gens ? 0 : maxgen;
|
||||||
bool no_gens = false;
|
|
||||||
|
for(int gen=-g; gen<=g; gen++) {
|
||||||
for(int i=0; i<p->cnt; i++) {
|
for(int i=0; i<p->cnt; i++) {
|
||||||
auto &c1 = pd[i];
|
auto& cur = pd[i];
|
||||||
auto &c0 = pd[i==0?p->cnt-1 : i-1];
|
ld d = cur.distance + 2 * M_PI * gen;
|
||||||
if(c1.distance > M_PI/2 && c0.distance > M_PI/2 && crossdot(c0.direction, c1.direction).second < 0) return;
|
hyperpoint h;
|
||||||
if(c1.bad == 2) return;
|
h[0] = cur.direction[0] * d;
|
||||||
if(c1.bad == 1) no_gens = true;
|
h[1] = cur.direction[1] * d;
|
||||||
}
|
h[2] = cur.z;
|
||||||
|
glcoords[i] = glhr::pointtogl(h);
|
||||||
if(!no_gens) {
|
|
||||||
|
|
||||||
vector<ld> angles(p->cnt);
|
|
||||||
for(int i=0; i<p->cnt; i++) {
|
|
||||||
angles[i] = atan2(pd[i].direction[1], pd[i].direction[0]);
|
|
||||||
}
|
|
||||||
sort(angles.begin(), angles.end());
|
|
||||||
angles.push_back(angles[0] + 2 * M_PI);
|
|
||||||
bool ok = false;
|
|
||||||
for(int i=1; i<isize(angles); i++)
|
|
||||||
if(angles[i] >= angles[i-1] + M_PI) ok = true;
|
|
||||||
if(!ok) {
|
|
||||||
for(auto &c: pd) if(c.distance > M_PI/2) return;
|
|
||||||
no_gens = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int g = no_gens ? 0 : maxgen;
|
|
||||||
|
|
||||||
for(int gen=-g; gen<=g; gen++) {
|
|
||||||
for(int i=0; i<p->cnt; i++) {
|
|
||||||
auto& cur = pd[i];
|
|
||||||
ld d = cur.distance + 2 * M_PI * gen;
|
|
||||||
hyperpoint h;
|
|
||||||
h[0] = cur.direction[0] * d;
|
|
||||||
h[1] = cur.direction[1] * d;
|
|
||||||
h[2] = cur.z;
|
|
||||||
glcoords[i] = glhr::pointtogl(h);
|
|
||||||
}
|
|
||||||
npoly.gldraw();
|
|
||||||
}
|
}
|
||||||
|
npoly.gldraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EX }
|
EX }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user