no crash in draw_s2xe if empty shape to draw, also moved npoly to draw_s2xe
This commit is contained in:
parent
161db58988
commit
afa6d722dd
22
drawing.cpp
22
drawing.cpp
|
@ -912,7 +912,15 @@ struct point_data {
|
||||||
int bad;
|
int bad;
|
||||||
};
|
};
|
||||||
|
|
||||||
void draw_s2xe(dqi_poly *p, dqi_poly *npoly) {
|
void draw_s2xe(dqi_poly *p) {
|
||||||
|
if(!p->cnt) return;
|
||||||
|
dqi_poly npoly = *p;
|
||||||
|
npoly.offset = 0;
|
||||||
|
npoly.tab = &glcoords;
|
||||||
|
npoly.V = Id;
|
||||||
|
set_width(1);
|
||||||
|
glcoords.clear();
|
||||||
|
|
||||||
int maxgen = sightranges[geometry] / (2 * M_PI) + 1;
|
int maxgen = sightranges[geometry] / (2 * M_PI) + 1;
|
||||||
|
|
||||||
auto crossdot = [&] (const hyperpoint h1, const hyperpoint h2) { return make_pair(h1[0] * h2[1] - h1[1] * h2[0], h1[0] * h2[0] + h1[1] * h2[1]); };
|
auto crossdot = [&] (const hyperpoint h1, const hyperpoint h2) { return make_pair(h1[0] * h2[1] - h1[1] * h2[0], h1[0] * h2[0] + h1[1] * h2[1]); };
|
||||||
|
@ -972,7 +980,7 @@ void draw_s2xe(dqi_poly *p, dqi_poly *npoly) {
|
||||||
glcoords[i] = glhr::pointtogl(h);
|
glcoords[i] = glhr::pointtogl(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
npoly->gldraw();
|
npoly.gldraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -1015,7 +1023,7 @@ void draw_s2xe(dqi_poly *p, dqi_poly *npoly) {
|
||||||
h[2] = cur.z;
|
h[2] = cur.z;
|
||||||
glcoords[i] = glhr::pointtogl(h);
|
glcoords[i] = glhr::pointtogl(h);
|
||||||
}
|
}
|
||||||
npoly->gldraw();
|
npoly.gldraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1024,13 +1032,7 @@ void dqi_poly::draw() {
|
||||||
if(flags & POLY_DEBUG) debug_this();
|
if(flags & POLY_DEBUG) debug_this();
|
||||||
|
|
||||||
if(prod && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), shaderside_projection) && product::product_sphere()) {
|
if(prod && vid.usingGL && pmodel == mdPerspective && (current_display->set_all(global_projection), shaderside_projection) && product::product_sphere()) {
|
||||||
auto npoly = *this;
|
draw_s2xe(this);
|
||||||
npoly.offset = 0;
|
|
||||||
npoly.tab = &glcoords;
|
|
||||||
npoly.V = Id;
|
|
||||||
set_width(1);
|
|
||||||
glcoords.clear();
|
|
||||||
draw_s2xe(this, &npoly);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue