mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-20 03:54:47 +00:00
fixed the rendering of Hypersian Rug
This commit is contained in:
parent
895081934d
commit
0ed74b12c4
@ -286,18 +286,16 @@ void display_data::set_mask(int ed) {
|
||||
}
|
||||
|
||||
void display_data::set_viewport(int ed) {
|
||||
ld xmin = vid.xres * current_display->xmin;
|
||||
ld xmax = vid.xres * current_display->xmax;
|
||||
ld ymin = vid.yres * current_display->ymin;
|
||||
ld ymax = vid.yres * current_display->ymax;
|
||||
|
||||
ld xsize = xmax - xmin, ysize = ymax - ymin;
|
||||
ld xtop = current_display->xtop;
|
||||
ld ytop = current_display->ytop;
|
||||
ld xsize = current_display->xsize;
|
||||
ld ysize = current_display->ysize;
|
||||
|
||||
if(ed == 0 || vid.stereo_mode != sLR) ;
|
||||
else if(ed == 1) xsize /= 2;
|
||||
else if(ed == -1) xsize /= 2, xmin += xsize;
|
||||
else if(ed == -1) xsize /= 2, xtop += xsize;
|
||||
|
||||
glViewport(xmin, ymin, xsize, ysize);
|
||||
glViewport(xtop, ytop, xsize, ysize);
|
||||
}
|
||||
|
||||
bool model_needs_depth() {
|
||||
|
26
rug.cpp
26
rug.cpp
@ -337,17 +337,20 @@ void calcLengths() {
|
||||
edge.len = hdist(p->h, edge.target->h) * modelscale;
|
||||
}
|
||||
|
||||
void setVidParam() {
|
||||
vid.xres = vid.yres = TEXTURESIZE;
|
||||
current_display->scrsize = HTEXTURESIZE;
|
||||
current_display->radius = current_display->scrsize * vid.scale; current_display->xcenter = HTEXTURESIZE; current_display->ycenter = HTEXTURESIZE;
|
||||
// vid.alpha = 1;
|
||||
void calcparam_rug() {
|
||||
auto cd = current_display;
|
||||
|
||||
cd->xtop = cd->ytop = 0;
|
||||
cd->xsize = cd->ysize = TEXTURESIZE;
|
||||
cd->xcenter = cd->ycenter = cd->scrsize = HTEXTURESIZE;
|
||||
|
||||
cd->radius = cd->scrsize * vid.scale;
|
||||
}
|
||||
|
||||
void buildTorusRug() {
|
||||
using namespace torusconfig;
|
||||
|
||||
setVidParam();
|
||||
calcparam_rug();
|
||||
|
||||
struct toruspoint {
|
||||
int x,y;
|
||||
@ -1228,10 +1231,8 @@ renderbuffer *glbuf;
|
||||
void prepareTexture() {
|
||||
resetbuffer rb;
|
||||
|
||||
videopar svid = vid;
|
||||
|
||||
setVidParam();
|
||||
dynamicval<eStereo> d(vid.stereo_mode, sOFF);
|
||||
calcparam_rug();
|
||||
|
||||
glbuf->enable();
|
||||
current_display->set_viewport(0);
|
||||
@ -1252,7 +1253,7 @@ void prepareTexture() {
|
||||
queueline(V * xspinpush0(i*M_PI/32, finger_range), V * xspinpush0((i+1)*M_PI/32, finger_range), 0xFFFFFFFF, vid.linequality);
|
||||
}
|
||||
drawqueue();
|
||||
vid = svid;
|
||||
calcparam();
|
||||
rb.reset();
|
||||
}
|
||||
|
||||
@ -1684,10 +1685,9 @@ hyperpoint gethyper(ld x, ld y) {
|
||||
|
||||
double px = rx1 * TEXTURESIZE, py = (1-ry1) * TEXTURESIZE;
|
||||
|
||||
videopar svid = vid;
|
||||
setVidParam();
|
||||
calcparam_rug();
|
||||
hyperpoint h = hr::gethyper(px, py);
|
||||
vid = svid;
|
||||
calcparam();
|
||||
|
||||
return h;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user