mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-23 07:27:07 +00:00
force_sphere_outline, fixed sphere outline in SVG
This commit is contained in:
parent
9a1093fc6c
commit
97aa318f79
16
graph.cpp
16
graph.cpp
@ -5413,6 +5413,8 @@ int ringcolor = darkena(0xFF, 0, 0xFF);
|
||||
|
||||
function<void()> wrap_drawfullmap = drawfullmap;
|
||||
|
||||
bool force_sphere_outline = false;
|
||||
|
||||
void drawfullmap() {
|
||||
|
||||
DEBB(DF_GRAPH, (debugfile,"draw full map\n"));
|
||||
@ -5421,20 +5423,24 @@ void drawfullmap() {
|
||||
|
||||
if(!stereo::active() && !euclid && (pmodel == mdDisk || pmodel == mdBall || (sphere && mdEqui()))) {
|
||||
double rad = vid.radius;
|
||||
bool isbnd = true;
|
||||
if(sphere) {
|
||||
if(mdEqui())
|
||||
;
|
||||
else if(!vid.grid && !elliptic)
|
||||
else if(!vid.grid && !elliptic && !force_sphere_outline)
|
||||
rad = 0;
|
||||
else if(vid.alpha <= 0)
|
||||
;
|
||||
else if(vid.alpha <= 1 && (vid.grid || elliptic)) // mark the equator
|
||||
rad = rad * 1 / vid.alpha;
|
||||
else if(vid.grid) // mark the edge
|
||||
rad = rad * 1 / vid.alpha, isbnd = false;
|
||||
else if(vid.grid || force_sphere_outline) // mark the edge
|
||||
rad /= sqrt(vid.alpha*vid.alpha - 1);
|
||||
}
|
||||
if(!haveaura()) queuecircle(vid.xcenter, vid.ycenter, rad, ringcolor,
|
||||
vid.usingGL ? PPR_CIRCLE : PPR_OUTCIRCLE);
|
||||
if(rad && !haveaura()) {
|
||||
queuecircle(vid.xcenter, vid.ycenter, rad, ringcolor,
|
||||
vid.usingGL ? PPR_CIRCLE : PPR_OUTCIRCLE);
|
||||
if(isbnd) lastptd().u.cir.boundary = true;
|
||||
}
|
||||
if(pmodel == mdBall) ballgeometry();
|
||||
}
|
||||
|
||||
|
1
hyper.h
1
hyper.h
@ -2063,6 +2063,7 @@ struct qchr {
|
||||
|
||||
struct qcir {
|
||||
int x, y, size;
|
||||
bool boundary;
|
||||
};
|
||||
|
||||
enum eKind { pkPoly, pkLine, pkString, pkCircle, pkShape, pkResetModel, pkSpecial };
|
||||
|
28
polygons.cpp
28
polygons.cpp
@ -806,10 +806,24 @@ void drawqueue() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STLSORT
|
||||
#define GET_PTD(i) polytodraw& ptd (ptds[i]);
|
||||
#else
|
||||
#define GET_PTD(i) polytodraw& ptd (*ptds2[i]);
|
||||
#endif
|
||||
|
||||
spherespecial = 0;
|
||||
spherephase = 0;
|
||||
// on the sphere, parts on the back are drawn first
|
||||
if(sphere && pmodel == 0) {
|
||||
|
||||
// in SVG, draw boundary circle first
|
||||
if(svg::in) for(int i=0; i<siz; i++) {
|
||||
GET_PTD(i);
|
||||
if(ptd.kind == pkCircle && ptd.u.cir.boundary)
|
||||
drawqueueitem(ptd);
|
||||
}
|
||||
|
||||
spherespecial = sphereflipped() ? 1 : -1;
|
||||
#ifndef STLSORT
|
||||
for(int p: {PPR_REDWALLs, PPR_REDWALLs2, PPR_REDWALLs3, PPR_WALL3s,
|
||||
@ -817,11 +831,7 @@ void drawqueue() {
|
||||
reverse(&ptds2[qp0[p]], &ptds2[qp[p]]);
|
||||
#endif
|
||||
for(int i=siz-1; i>=0; i--) {
|
||||
#ifdef STLSORT
|
||||
polytodraw& ptd (ptds[i]);
|
||||
#else
|
||||
polytodraw& ptd (*ptds2[i]);
|
||||
#endif
|
||||
GET_PTD(i);
|
||||
if(ptd.kind == pkPoly || ptd.kind == pkLine) {
|
||||
unsigned c = ptd.col;
|
||||
int alpha = ptd.col & 255;
|
||||
@ -841,11 +851,8 @@ void drawqueue() {
|
||||
spherephase = 1;
|
||||
}
|
||||
for(int i=0; i<siz; i++) {
|
||||
#ifdef STLSORT
|
||||
polytodraw& ptd (ptds[i]);
|
||||
#else
|
||||
polytodraw& ptd (*ptds2[i]);
|
||||
#endif
|
||||
GET_PTD(i);
|
||||
if(spherespecial && svg::in && ptd.kind == pkCircle && ptd.u.cir.boundary) continue;
|
||||
drawqueueitem(ptd);
|
||||
}
|
||||
|
||||
@ -2406,6 +2413,7 @@ void queuecircle(int x, int y, int size, int color, int prio = PPR_CIRCLE) {
|
||||
ptd.u.cir.x = x;
|
||||
ptd.u.cir.y = y;
|
||||
ptd.u.cir.size = size;
|
||||
ptd.u.cir.boundary = false;
|
||||
ptd.col = color;
|
||||
ptd.prio = prio << PSHIFT;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user