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