mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-10 15:59:53 +00:00
2d3d:: textures on sidewalls
This commit is contained in:
parent
d89fb49e13
commit
da49e6c8de
50
config.cpp
50
config.cpp
@ -1179,6 +1179,31 @@ void config_camera_rotation() {
|
||||
);
|
||||
}
|
||||
|
||||
void add_edit_wall_quality(char c) {
|
||||
dialog::addSelItem(XLAT("wall quality"), its(vid.texture_step), c);
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(vid.texture_step, 1, 16, 1, 1, XLAT("wall quality"),
|
||||
XLAT(
|
||||
"Controls the number of triangles used for wall surfaces. "
|
||||
"Higher numbers reduce the performance. "
|
||||
"This has a strong effect when the walls are curved indeed "
|
||||
"(honeycombs based on horospheres, and projections other than native perspective), "
|
||||
"but otherwise, usually it can be set to 1 without significant adverse effects other "
|
||||
"than slightly incorrect texturing."
|
||||
)
|
||||
);
|
||||
dialog::bound_low(1);
|
||||
dialog::bound_up(128);
|
||||
dialog::reaction = [] {
|
||||
if(floor_textures) {
|
||||
delete floor_textures;
|
||||
floor_textures = NULL;
|
||||
}
|
||||
need_reset_geometry = true;
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
void show3D() {
|
||||
cmode = sm::SIDE | sm::MAYDARK;
|
||||
gamescreen(0);
|
||||
@ -1245,30 +1270,7 @@ void show3D() {
|
||||
dialog::editNumber(vid.radarsize, 0, 360, 15, 90, "", "set to 0 to disable");
|
||||
});
|
||||
}
|
||||
if(DIM == 3) {
|
||||
dialog::addSelItem(XLAT("wall quality"), its(vid.texture_step), 'W');
|
||||
dialog::add_action([] {
|
||||
dialog::editNumber(vid.texture_step, 1, 16, 1, 1, XLAT("wall quality"),
|
||||
XLAT(
|
||||
"Controls the number of triangles used for wall surfaces. "
|
||||
"Higher numbers reduce the performance. "
|
||||
"This has a strong effect when the walls are curved indeed "
|
||||
"(honeycombs based on horospheres, and projections other than native perspective), "
|
||||
"but otherwise, usually it can be set to 1 without significant adverse effects other "
|
||||
"than slightly incorrect texturing."
|
||||
)
|
||||
);
|
||||
dialog::bound_low(1);
|
||||
dialog::bound_up(128);
|
||||
dialog::reaction = [] {
|
||||
if(floor_textures) {
|
||||
delete floor_textures;
|
||||
floor_textures = NULL;
|
||||
}
|
||||
need_reset_geometry = true;
|
||||
};
|
||||
});
|
||||
}
|
||||
if(DIM == 3) add_edit_wall_quality('W');
|
||||
#endif
|
||||
|
||||
dialog::addBreak(50);
|
||||
|
@ -464,6 +464,7 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
}
|
||||
}
|
||||
|
||||
#if MAXMDIM >= 4
|
||||
if(WDIM == 2 && GDIM == 3) {
|
||||
finishshape();
|
||||
for(auto pfsh: all_plain_floorshapes) {
|
||||
@ -499,6 +500,12 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int l=0; l<SIDEPARS; l++) {
|
||||
for(auto& li: fsh.side[l]) li.tinf = &fsh.tinf3;
|
||||
for(int e=0; e<MAX_EDGE; e++)
|
||||
for(auto& li: fsh.gpside[l][e]) li.tinf = &fsh.tinf3;
|
||||
}
|
||||
}
|
||||
|
||||
for(auto pfsh: all_escher_floorshapes) {
|
||||
@ -506,17 +513,18 @@ void generate_floorshapes_for(int id, cell *c, int siid, int sidir) {
|
||||
|
||||
for(int l=0; l<SIDEPARS; l++) {
|
||||
fsh.levels[l] = shFullFloor.levels[l];
|
||||
for(auto& li: fsh.levels[l]) li.tinf = &fsh.tinf3;
|
||||
fsh.side[l] = shFullFloor.side[l];
|
||||
for(int e=0; e<MAX_EDGE; e++)
|
||||
for(auto& li: fsh.side[l]) li.tinf = &fsh.tinf3;
|
||||
for(int e=0; e<MAX_EDGE; e++) {
|
||||
fsh.gpside[l][e] = shFullFloor.gpside[l][e];
|
||||
for(auto& li: fsh.gpside[l][e]) li.tinf = &fsh.tinf3;
|
||||
}
|
||||
}
|
||||
|
||||
for(auto& l: fsh.levels)
|
||||
for(auto& li: l)
|
||||
li.tinf = &fsh.tinf3;
|
||||
}
|
||||
finishshape();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void generate_floorshapes() {
|
||||
|
@ -631,6 +631,8 @@ void showEuclideanMenu() {
|
||||
#endif
|
||||
};
|
||||
});
|
||||
extern void add_edit_wall_quality(char);
|
||||
add_edit_wall_quality('W');
|
||||
}
|
||||
else if(WDIM == 3) dialog::addBreak(100);
|
||||
else {
|
||||
|
31
polygons.cpp
31
polygons.cpp
@ -138,12 +138,33 @@ hyperpoint zshift(hyperpoint x, ld z) {
|
||||
}
|
||||
|
||||
void chasmifyPoly(double fac, double fac2, int k) {
|
||||
for(int i=isize(hpc)-1; i >= last->s; i--) {
|
||||
hpc.push_back(zshift(hpc[i], fac));
|
||||
hpc[i] = zshift(hpc[i], fac2);
|
||||
if(GDIM == 2) {
|
||||
for(int i=isize(hpc)-1; i >= last->s; i--) {
|
||||
hpc.push_back(mscale(hpc[i], fac));
|
||||
hpc[i] = mscale(hpc[i], fac2);
|
||||
}
|
||||
hpc.push_back(hpc[last->s]);
|
||||
last->flags |= POLY_ISSIDE;
|
||||
}
|
||||
else {
|
||||
vector<hyperpoint> points;
|
||||
for(int s = last->s; s<isize(hpc); s++) points.push_back(hpc[s]);
|
||||
hpc.resize(last->s);
|
||||
last->flags |= POLY_TRIANGLES;
|
||||
last->texture_offset = 0;
|
||||
last->s = isize(hpc);
|
||||
using namespace hyperpoint_vec;
|
||||
auto at = [&] (ld x, ld y) {
|
||||
x *= (isize(points) - 1);
|
||||
int zf = int(x);
|
||||
x -= zf;
|
||||
hpcpush(zshift(points[zf] + (points[zf+1] - points[zf]) * x, fac + (fac2-fac) * y));
|
||||
};
|
||||
texture_order([&] (ld x, ld y) { at((1-x+y)/2, (1-x-y)/2); });
|
||||
texture_order([&] (ld x, ld y) { at((1-x-y)/2, (1+x-y)/2); });
|
||||
texture_order([&] (ld x, ld y) { at((1+x-y)/2, (1+x+y)/2); });
|
||||
texture_order([&] (ld x, ld y) { at((1+x+y)/2, (1-x+y)/2); });
|
||||
}
|
||||
hpc.push_back(hpc[last->s]);
|
||||
last->flags |= POLY_ISSIDE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user