1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-14 01:16:50 +00:00

fixed broken models with orientation change

This commit is contained in:
Zeno Rogue 2020-09-16 14:03:46 +02:00
parent 9a8d386422
commit c6ed4ea736
2 changed files with 8 additions and 0 deletions

View File

@ -1515,6 +1515,8 @@ bool broken_projection(dqi_poly& p0) {
all.push_back(p0.V.T * glhr::gltopoint((*p0.tab)[p0.offset+i])); all.push_back(p0.V.T * glhr::gltopoint((*p0.tab)[p0.offset+i]));
int fail = 0; int fail = 0;
int last_fail; int last_fail;
for(auto& h: all) models::apply_orientation(h[0], h[1]);
auto break_in = [&] (hyperpoint a, hyperpoint b) { auto break_in = [&] (hyperpoint a, hyperpoint b) {
return a[0] * b[0] <= 0 && (a[0] * b[zcoord] - b[0] * a[zcoord]) * (a[0] - b[0]) < 0; return a[0] * b[0] <= 0 && (a[0] * b[zcoord] - b[0] * a[zcoord]) * (a[0] - b[0]) < 0;
@ -1528,6 +1530,11 @@ bool broken_projection(dqi_poly& p0) {
p.tab = &v; p.tab = &v;
p.offset = 0; p.offset = 0;
p.V.T = Id; p.V.T = Id;
/* we don't rotate h's back, just change p.V */
for(int i=0; i<3; i++)
models::apply_orientation(p.V.T[i][0], p.V.T[i][1]);
if(fail) { if(fail) {
if(p0.tinf) return true; if(p0.tinf) return true;
dynamicval<bool> ib(in_broken, true); dynamicval<bool> ib(in_broken, true);

View File

@ -2040,6 +2040,7 @@ EX void draw_boundary(int w) {
h[broken_coord] = -sin_auto(a*degree) * rem; h[broken_coord] = -sin_auto(a*degree) * rem;
h[0] = sin_auto(a*degree) * eps * s; h[0] = sin_auto(a*degree) * eps * s;
h[unbroken_coord] = cos_auto(a*degree); h[unbroken_coord] = cos_auto(a*degree);
models::apply_orientation(h[1], h[0]);
curvepoint(h); curvepoint(h);
} }
queuecurve(shiftless(Id), periodcolor, 0, PPR::CIRCLE).flags |= POLY_FORCEWIDE; queuecurve(shiftless(Id), periodcolor, 0, PPR::CIRCLE).flags |= POLY_FORCEWIDE;