1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-25 09:30:35 +00:00

backandfront projection option

This commit is contained in:
Zeno Rogue 2021-09-18 01:39:09 +02:00
parent a7ddaae7d4
commit 96c143da8e
4 changed files with 18 additions and 0 deletions

View File

@ -2164,6 +2164,10 @@ EX void show3D() {
XLAT("Rotate the camera. Can be used to obtain a first person perspective, " XLAT("Rotate the camera. Can be used to obtain a first person perspective, "
"or third person perspective when combined with Y shift.") "or third person perspective when combined with Y shift.")
); );
dialog::extra_options = [] {
dialog::addBoolItem(XLAT("render behind the camera"), vpconf.back_and_front, 'R');
dialog::add_action([] { vpconf.back_and_front = !vpconf.back_and_front; });
};
}); });
} }
if(GDIM == 2) { if(GDIM == 2) {

View File

@ -2277,6 +2277,16 @@ EX void set_vr_sphere() {
EX void draw_main() { EX void draw_main() {
DEBBI(DF_GRAPH, ("draw_main")); DEBBI(DF_GRAPH, ("draw_main"));
if(pconf.back_and_front == 1 && vid.consider_shader_projection) {
dynamicval<int> pa(pconf.back_and_front);
pconf.back_and_front = 0;
draw_main();
pconf.back_and_front = 2;
reset_projection();
draw_main();
return;
}
set_vr_sphere(); set_vr_sphere();
if(sphere && GDIM == 3 && pmodel == mdPerspective && !stretch::in() && !ray::in_use) { if(sphere && GDIM == 3 && pmodel == mdPerspective && !stretch::in() && !ray::in_use) {

View File

@ -1040,6 +1040,8 @@ EX namespace models {
param_f(p.xposition, sp+"xposition", 0); param_f(p.xposition, sp+"xposition", 0);
param_f(p.yposition, sp+"yposition", 0); param_f(p.yposition, sp+"yposition", 0);
param_i(p.back_and_front, sp+"backandfront", 0);
addsaver(p.alpha, sp+"projection", 1); addsaver(p.alpha, sp+"projection", 1);
param_custom(p.alpha, sp+"projection", menuitem_projection_distance, 'p') param_custom(p.alpha, sp+"projection", menuitem_projection_distance, 'p')
->help_text = "projection distance|Gans Klein Poincare orthographic stereographic"; ->help_text = "projection distance|Gans Klein Poincare orthographic stereographic";

View File

@ -652,6 +652,8 @@ void display_data::set_projection(int ed, ld shift) {
GLfloat sc = current_display->radius / (cd->ysize/2.); GLfloat sc = current_display->radius / (cd->ysize/2.);
glhr::projection_multiply(glhr::frustum(cd->xsize / cd->ysize, 1)); glhr::projection_multiply(glhr::frustum(cd->xsize / cd->ysize, 1));
glhr::projection_multiply(glhr::scale(sc, -sc, -1)); glhr::projection_multiply(glhr::scale(sc, -sc, -1));
if(pconf.back_and_front)
glhr::projection_multiply(glhr::scale(-1,-1,-1));
u_alpha = true; u_alpha = true;
} }