mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-06 01:04:07 +00:00
ringcolor improvements
This commit is contained in:
parent
d1d2a300c4
commit
f1b6cc0f48
@ -1493,11 +1493,14 @@ int read_config_args() {
|
|||||||
PHASEFROM(2); shift(); backcolor = arghex();
|
PHASEFROM(2); shift(); backcolor = arghex();
|
||||||
}
|
}
|
||||||
else if(argis("-fillmodel")) {
|
else if(argis("-fillmodel")) {
|
||||||
PHASEFROM(2); shift(); fillmodel = arghex();
|
PHASEFROM(2); shift(); modelcolor = arghex();
|
||||||
}
|
}
|
||||||
else if(argis("-ring")) {
|
else if(argis("-ring")) {
|
||||||
PHASEFROM(2); shift(); ringcolor = arghex();
|
PHASEFROM(2); shift(); ringcolor = arghex();
|
||||||
}
|
}
|
||||||
|
else if(argis("-period")) {
|
||||||
|
PHASEFROM(2); shift(); periodcolor = arghex();
|
||||||
|
}
|
||||||
else if(argis("-borders")) {
|
else if(argis("-borders")) {
|
||||||
PHASEFROM(2); shift(); bordcolor = arghex();
|
PHASEFROM(2); shift(); bordcolor = arghex();
|
||||||
}
|
}
|
||||||
|
@ -5498,8 +5498,6 @@ void calcparam() {
|
|||||||
callhooks(hooks_calcparam);
|
callhooks(hooks_calcparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ringcolor = darkena(0xFF, 0, 0xFF);
|
|
||||||
|
|
||||||
function<void()> wrap_drawfullmap = drawfullmap;
|
function<void()> wrap_drawfullmap = drawfullmap;
|
||||||
|
|
||||||
bool force_sphere_outline = false;
|
bool force_sphere_outline = false;
|
||||||
@ -5526,11 +5524,6 @@ void drawfullmap() {
|
|||||||
|
|
||||||
draw_model_elements();
|
draw_model_elements();
|
||||||
|
|
||||||
if(fillmodel) {
|
|
||||||
for(int i=0; i<360; i++) curvepoint(xspinpush0(i * 2 * M_PI / 360, 10));
|
|
||||||
auto m = queuecurve(ringcolor, fillmodel, PPR::OUTCIRCLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if(vid.wallmode < 2 && !euclid && !patterns::whichShape) {
|
/* if(vid.wallmode < 2 && !euclid && !patterns::whichShape) {
|
||||||
int ls = isize(lines);
|
int ls = isize(lines);
|
||||||
if(ISMOBILE) ls /= 10;
|
if(ISMOBILE) ls /= 10;
|
||||||
|
3
hyper.h
3
hyper.h
@ -2300,7 +2300,7 @@ string generateHelpForItem(eItem it);
|
|||||||
bool graphglyph();
|
bool graphglyph();
|
||||||
extern bool hiliteclick;
|
extern bool hiliteclick;
|
||||||
extern int antialiaslines;
|
extern int antialiaslines;
|
||||||
extern int ringcolor;
|
extern color_t ringcolor, periodcolor, modelcolor;
|
||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
@ -3336,6 +3336,7 @@ extern int sagephase;
|
|||||||
extern int lastsize;
|
extern int lastsize;
|
||||||
extern int noiseuntil;
|
extern int noiseuntil;
|
||||||
hyperpoint xpush0(ld x);
|
hyperpoint xpush0(ld x);
|
||||||
|
hyperpoint ypush0(ld x);
|
||||||
transmatrix xspinpush(ld alpha, ld x);
|
transmatrix xspinpush(ld alpha, ld x);
|
||||||
hyperpoint xspinpush0(ld alpha, ld x);
|
hyperpoint xspinpush0(ld alpha, ld x);
|
||||||
|
|
||||||
|
@ -293,6 +293,14 @@ inline hyperpoint xpush0(ld x) {
|
|||||||
return h;
|
return h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline hyperpoint ypush0(ld x) {
|
||||||
|
hyperpoint h;
|
||||||
|
if(euclid) return hpxy(x, 0);
|
||||||
|
else if(sphere) h[0] = 0, h[1] = sin(x), h[2] = cos(x);
|
||||||
|
else h[0] = 0, h[1] = sinh(x), h[2] = cosh(x);
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
|
||||||
inline hyperpoint xspinpush0(ld alpha, ld x) {
|
inline hyperpoint xspinpush0(ld alpha, ld x) {
|
||||||
// return spin(alpha)*xpush0(x);
|
// return spin(alpha)*xpush0(x);
|
||||||
ld s;
|
ld s;
|
||||||
|
201
hypgraph.cpp
201
hypgraph.cpp
@ -1142,62 +1142,100 @@ void circle_around_center(ld radius, color_t linecol, color_t fillcol, PPR prio)
|
|||||||
c.flags |= POLY_FORCE_INVERTED;
|
c.flags |= POLY_FORCE_INVERTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
color_t periodcolor = 0x00FF0080;
|
||||||
|
color_t ringcolor = darkena(0xFF, 0, 0xFF);
|
||||||
|
color_t modelcolor = 0;
|
||||||
|
|
||||||
void draw_model_elements() {
|
void draw_model_elements() {
|
||||||
|
|
||||||
if(elliptic || (vid.grid && sphere))
|
switch(pmodel) {
|
||||||
circle_around_center(M_PI/2, ringcolor, 0, PPR::CIRCLE);
|
|
||||||
|
|
||||||
if(pmodel == mdTwoPoint) {
|
case mdTwoPoint: {
|
||||||
ld a = -conformal::model_orientation * degree;
|
ld a = -conformal::model_orientation * degree;
|
||||||
queuechr(xspinpush0(a, +vid.twopoint_param), vid.xres / 100, 'X', ringcolor >> 8);
|
queuechr(xspinpush0(a, +vid.twopoint_param), vid.xres / 100, 'X', ringcolor >> 8);
|
||||||
queuechr(xspinpush0(a, -vid.twopoint_param), vid.xres / 100, 'X', ringcolor >> 8);
|
queuechr(xspinpush0(a, -vid.twopoint_param), vid.xres / 100, 'X', ringcolor >> 8);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if(pmodel == mdBall) {
|
|
||||||
queuecircle(vid.xcenter, vid.ycenter, vid.radius, ringcolor, PPR::OUTCIRCLE, fillmodel);
|
case mdBall: {
|
||||||
ballgeometry();
|
queuecircle(vid.xcenter, vid.ycenter, vid.radius, ringcolor, PPR::OUTCIRCLE, modelcolor);
|
||||||
}
|
ballgeometry();
|
||||||
|
return;
|
||||||
if(pmodel == mdHyperboloid && hyperbolic) {
|
}
|
||||||
|
|
||||||
|
case mdHyperboloid: {
|
||||||
|
if(hyperbolic) {
|
||||||
#if CAP_QUEUE
|
#if CAP_QUEUE
|
||||||
curvepoint(hpxyz(0,0,1));
|
curvepoint(hpxyz(0,0,1));
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
curvepoint(hpxyz(0,0,-vid.alpha));
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
|
|
||||||
|
ld& tz = conformal::top_z;
|
||||||
|
ld z = acosh(tz);
|
||||||
|
|
||||||
ld& tz = conformal::top_z;
|
hyperpoint a = xpush0(z);
|
||||||
ld z = acosh(tz);
|
ld cb = conformal::cos_ball;
|
||||||
|
ld sb = conformal::sin_ball;
|
||||||
hyperpoint a = xpush0(z);
|
|
||||||
ld cb = conformal::cos_ball;
|
a[1] = sb * a[2] / -cb;
|
||||||
ld sb = conformal::sin_ball;
|
a[0] = sqrt(-1 + a[2] * a[2] - a[1] * a[1]);
|
||||||
|
|
||||||
a[1] = sb * a[2] / -cb;
|
curvepoint(hpxyz(0,0,-vid.alpha));
|
||||||
a[0] = sqrt(-1 + a[2] * a[2] - a[1] * a[1]);
|
curvepoint(a);
|
||||||
|
curvepoint(hpxyz(0,0,0));
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
a[0] = -a[0];
|
||||||
curvepoint(a);
|
curvepoint(a);
|
||||||
curvepoint(hpxyz(0,0,0));
|
curvepoint(hpxyz(0,0,-vid.alpha));
|
||||||
a[0] = -a[0];
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
curvepoint(a);
|
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
curvepoint(hpxyz(-1,0,0));
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
curvepoint(hpxyz(1,0,0));
|
||||||
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
curvepoint(hpxyz(-1,0,0));
|
|
||||||
curvepoint(hpxyz(1,0,0));
|
a[1] = sb * tz / -cb;
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
a[0] = sqrt(tz * tz - a[1] * a[1]);
|
||||||
|
a[2] = tz - vid.alpha;
|
||||||
a[1] = sb * tz / -cb;
|
|
||||||
a[0] = sqrt(tz * tz - a[1] * a[1]);
|
curvepoint(a);
|
||||||
a[2] = tz - vid.alpha;
|
curvepoint(hpxyz(0,0,-vid.alpha));
|
||||||
|
a[0] = -a[0];
|
||||||
curvepoint(a);
|
curvepoint(a);
|
||||||
curvepoint(hpxyz(0,0,-vid.alpha));
|
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
||||||
a[0] = -a[0];
|
|
||||||
curvepoint(a);
|
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default: break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void queuestraight(hyperpoint X, int style, color_t lc, color_t fc, PPR p) {
|
||||||
|
|
||||||
|
using namespace hyperpoint_vec;
|
||||||
|
hyperpoint H;
|
||||||
|
applymodel(X, H);
|
||||||
|
H *= vid.radius;
|
||||||
|
ld mul = hypot(vid.xres, vid.yres) / hypot2(H);
|
||||||
|
ld m = style == 1 ? -mul : -1;
|
||||||
|
|
||||||
|
queuereset(mdUnchanged, p);
|
||||||
|
curvepoint(H + spin(M_PI/2) * H * mul);
|
||||||
|
curvepoint(H - spin(M_PI/2) * H * mul);
|
||||||
|
curvepoint(m * H - spin(M_PI/2) * H * mul);
|
||||||
|
curvepoint(m * H + spin(M_PI/2) * H * mul);
|
||||||
|
curvepoint(H + spin(M_PI/2) * H * mul);
|
||||||
|
|
||||||
|
queuecurve(lc, fc, p).flags |= POLY_ALWAYS_IN;
|
||||||
|
queuereset(pmodel, p);
|
||||||
|
/*
|
||||||
|
for(int i=0; i<1; i++) {
|
||||||
|
hyperpoint h = spin(i * 45 * degree) * X;
|
||||||
|
hyperpoint res;
|
||||||
|
applymodel(h, res);
|
||||||
|
if(hypot2(res) < 1000 && !std::isnan(res[0]) && !std::isnan(res[1]))
|
||||||
|
queuechr(h, 16, 'X', 0xFF0000 + i * 0x20);
|
||||||
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_boundary(int w) {
|
void draw_boundary(int w) {
|
||||||
@ -1205,28 +1243,19 @@ void draw_boundary(int w) {
|
|||||||
if(w == 1) return;
|
if(w == 1) return;
|
||||||
|
|
||||||
color_t lc = ringcolor;
|
color_t lc = ringcolor;
|
||||||
color_t fc = fillmodel;
|
color_t fc = modelcolor;
|
||||||
PPR p = PPR::OUTCIRCLE;
|
PPR p = PPR::OUTCIRCLE;
|
||||||
|
|
||||||
if(haveaura()) lc = 0;
|
if(haveaura()) lc = 0;
|
||||||
if(lc == 0 && fc == 0) return;
|
if(lc == 0 && fc == 0) return;
|
||||||
|
|
||||||
|
ld fakeinf = sphere ? M_PI-1e-5 : hyperbolic ? 10 : exp(10);
|
||||||
|
|
||||||
|
if(elliptic && !among(pmodel, mdBand, mdBandEquidistant, mdBandEquiarea, mdSinusoidal))
|
||||||
|
circle_around_center(M_PI/2, periodcolor, 0, PPR::CIRCLE);
|
||||||
|
|
||||||
switch(pmodel) {
|
switch(pmodel) {
|
||||||
|
|
||||||
case mdSinusoidal: {
|
|
||||||
if(stereo::active() || !sphere) return;
|
|
||||||
queuereset(vid.usingGL ? mdDisk : mdUnchanged, PPR::CIRCLE);
|
|
||||||
|
|
||||||
for(ld a=-45; a<45+1e-6; a+=pow(.5, vid.linequality)) {
|
|
||||||
curvepoint(hpxyz(cos(a * M_PI / 90) * vid.radius, a * vid.radius / 90, 0));
|
|
||||||
}
|
|
||||||
for(ld a=45; a>=-45-1e-6; a-=pow(.5, vid.linequality)) {
|
|
||||||
curvepoint(hpxyz(-cos(a * M_PI / 90) * vid.radius, a * vid.radius / 90, 0));
|
|
||||||
}
|
|
||||||
queuecurve(lc, fc, p);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
case mdTwoPoint: {
|
case mdTwoPoint: {
|
||||||
if(twopoint_do_flips || stereo::active() || !sphere) return;
|
if(twopoint_do_flips || stereo::active() || !sphere) return;
|
||||||
queuereset(vid.usingGL ? mdDisk : mdUnchanged, p);
|
queuereset(vid.usingGL ? mdDisk : mdUnchanged, p);
|
||||||
@ -1252,25 +1281,37 @@ void draw_boundary(int w) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
case mdBand: case mdBandEquidistant: case mdBandEquiarea: {
|
case mdBand: case mdBandEquidistant: case mdBandEquiarea: case mdSinusoidal: {
|
||||||
ld rad = 0;
|
bool bndband = ((pmodel == mdBand) ? hyperbolic : sphere);
|
||||||
if(pmodel == mdBand && hyperbolic) rad = vid.radius;
|
transmatrix T = spin(-conformal::model_orientation * degree);
|
||||||
if(pmodel == mdBandEquidistant && sphere) rad = vid.radius / 2;
|
ld right = M_PI/2 - 1e-5;
|
||||||
if(pmodel == mdBandEquiarea && sphere) rad = vid.radius / M_PI;
|
if(bndband)
|
||||||
|
queuestraight(T * ypush0(hyperbolic ? 10 : right), 2, lc, fc, p);
|
||||||
if(rad) {
|
ld xperiod = elliptic ? fakeinf/2 : fakeinf;
|
||||||
queuereset(vid.usingGL ? mdDisk : mdUnchanged, PPR::CIRCLE);
|
if(sphere && !bndband) {
|
||||||
curvepoint(hpxyz(-vid.xcenter, -rad, 0));
|
queuestraight(T * xpush0(xperiod), 2, periodcolor, 0, PPR::CIRCLE);
|
||||||
curvepoint(hpxyz(vid.xres-vid.xcenter, -rad, 0));
|
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
|
||||||
curvepoint(hpxyz(-vid.xcenter, rad, 0));
|
|
||||||
curvepoint(hpxyz(vid.xres-vid.xcenter, rad, 0));
|
|
||||||
queuecurve(ringcolor, 0, PPR::CIRCLE);
|
|
||||||
queuereset(pmodel, PPR::CIRCLE);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
if(sphere && bndband) {
|
||||||
|
ld adegree = degree-1e-6;
|
||||||
|
for(ld a=-90; a<90+1e-6; a+=pow(.5, vid.linequality)) {
|
||||||
|
curvepoint(T * xpush(xperiod) * ypush0(a * adegree));
|
||||||
|
}
|
||||||
|
for(ld a=-90; a<90+1e-6; a+=pow(.5, vid.linequality)) {
|
||||||
|
curvepoint(T * xpush(-xperiod) * ypush0(-a * adegree));
|
||||||
|
}
|
||||||
|
curvepoint(T * xpush(xperiod) * ypush0(-90 * adegree));
|
||||||
|
queuecurve(periodcolor, 0, PPR::CIRCLE);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case mdHalfplane:
|
||||||
|
if(hyperbolic) {
|
||||||
|
queuestraight(xspinpush0(-conformal::model_orientation * degree - M_PI/2, fakeinf), 1, lc, fc, p);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1294,8 +1335,8 @@ void draw_boundary(int w) {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(sphere) return;
|
if(sphere && !among(pmodel, mdEquidistant, mdEquiarea)) return;
|
||||||
circle_around_center(hyperbolic ? 20 : exp(10), lc, fc, p);
|
circle_around_center(fakeinf, lc, fc, p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if(pmodel == mdPolygonal || pmodel == mdPolynomial)
|
if(pmodel == mdPolygonal || pmodel == mdPolynomial)
|
||||||
|
@ -69,6 +69,9 @@ static const int POLY_PRECISE_WIDE = (1<<19);
|
|||||||
// force inverted
|
// force inverted
|
||||||
static const int POLY_FORCE_INVERTED = (1<<20);
|
static const int POLY_FORCE_INVERTED = (1<<20);
|
||||||
|
|
||||||
|
// always draw this
|
||||||
|
static const int POLY_ALWAYS_IN = (1<<21);
|
||||||
|
|
||||||
vector<hyperpoint> hpc;
|
vector<hyperpoint> hpc;
|
||||||
|
|
||||||
int prehpc;
|
int prehpc;
|
||||||
@ -481,9 +484,9 @@ void glapplymatrix(const transmatrix& V) {
|
|||||||
|
|
||||||
void dqi_poly::gldraw() {
|
void dqi_poly::gldraw() {
|
||||||
auto& v = *tab;
|
auto& v = *tab;
|
||||||
|
|
||||||
#if MINIMIZE_GL_CALLS
|
#if MINIMIZE_GL_CALLS
|
||||||
if(stereo::active() == 0 && !tinf && (color == 0 || ((flags & (POLY_VCONVEX | POLY_CCONVEX)) && !(flags & POLY_INVERSE)))) {
|
if(stereo::active() == 0 && !tinf && (color == 0 || ((flags & (POLY_VCONVEX | POLY_CCONVEX)) && !(flags & (POLY_INVERSE || POLY_FORCE_INVERTED))))) {
|
||||||
if(color != triangle_color || outline != line_color || texts_merged) {
|
if(color != triangle_color || outline != line_color || texts_merged) {
|
||||||
glflush();
|
glflush();
|
||||||
triangle_color = color;
|
triangle_color = color;
|
||||||
@ -965,7 +968,7 @@ void dqi_poly::draw() {
|
|||||||
last_infront = false;
|
last_infront = false;
|
||||||
|
|
||||||
addpoly(V, *tab, offset, cnt);
|
addpoly(V, *tab, offset, cnt);
|
||||||
if(!(sphere && vid.alpha < .9)) if(pmodel != mdJoukowsky) for(int i=1; i<isize(glcoords); i++) {
|
if(!(sphere && vid.alpha < .9)) if(pmodel != mdJoukowsky) if(!(flags & POLY_ALWAYS_IN)) for(int i=1; i<isize(glcoords); i++) {
|
||||||
ld dx = glcoords[i][0] - glcoords[i-1][0];
|
ld dx = glcoords[i][0] - glcoords[i-1][0];
|
||||||
ld dy = glcoords[i][1] - glcoords[i-1][1];
|
ld dy = glcoords[i][1] - glcoords[i-1][1];
|
||||||
if(dx > vid.xres * 2 || dy > vid.yres * 2) return;
|
if(dx > vid.xres * 2 || dy > vid.yres * 2) return;
|
||||||
|
@ -222,8 +222,6 @@ void IMAGESAVE(SDL_Surface *s, const char *fname) {
|
|||||||
|
|
||||||
hookset<void(renderbuffer*)> *hooks_hqshot;
|
hookset<void(renderbuffer*)> *hooks_hqshot;
|
||||||
|
|
||||||
color_t fillmodel;
|
|
||||||
|
|
||||||
void saveHighQualityShot(const char *fname, const char *caption, int fade) {
|
void saveHighQualityShot(const char *fname, const char *caption, int fade) {
|
||||||
|
|
||||||
resetbuffer rb;
|
resetbuffer rb;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user