mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-27 06:27:17 +00:00
'cylidrical' stereo mode
This commit is contained in:
parent
cb8a3f5424
commit
0c34e9fd34
@ -1385,7 +1385,8 @@ EX void initConfig() {
|
||||
{"ODS", "for rendering 360° VR videos (implemented only in raycaster and some other parts)"},
|
||||
{"Panini", "Projection believed to be used by Italian painters. Allows very high FOV angles while rendering more straight lines as straight than the stereographic projection."},
|
||||
{"stereographic", "Stereographic projection allows very high FOV angles."},
|
||||
{"equirectangular", "for rendering 360° videos (implemented only in raycaster)"}
|
||||
{"equirectangular", "for rendering 360° videos (implemented only in raycaster)"},
|
||||
{"cylindrical", "full vertical (not implemented in raycaster)"}
|
||||
}, "stereo/high-FOV mode", 'm')
|
||||
->set_reaction(reset_all_shaders);
|
||||
|
||||
|
@ -4119,7 +4119,7 @@ EX ld threshold, xyz_threshold;
|
||||
EX bool clip_checked = false;
|
||||
|
||||
EX bool other_stereo_mode() {
|
||||
return among(vid.stereo_mode, sODS, sPanini, sStereographic, sEquirectangular);
|
||||
return vid.stereo_mode != sOFF;
|
||||
}
|
||||
|
||||
void make_clipping_planes() {
|
||||
|
2
hyper.h
2
hyper.h
@ -250,7 +250,7 @@ struct charstyle {
|
||||
bool lefthanded;
|
||||
};
|
||||
|
||||
enum eStereo { sOFF, sAnaglyph, sLR, sODS, sPanini, sStereographic, sEquirectangular };
|
||||
enum eStereo { sOFF, sAnaglyph, sLR, sODS, sPanini, sStereographic, sEquirectangular, sCylindrical };
|
||||
|
||||
enum eModel : int;
|
||||
|
||||
|
11
shaders.cpp
11
shaders.cpp
@ -82,6 +82,12 @@ EX string panini_shader() {
|
||||
"t.w = 1.;\n";
|
||||
}
|
||||
|
||||
EX string cylindrical_shader() {
|
||||
return
|
||||
"t /= t.w;\n"
|
||||
"t.y = atan2(t.y, length(t.xz)) * length(t.xz) * 2. / PI;\n";
|
||||
}
|
||||
|
||||
EX string stereo_shader() {
|
||||
return
|
||||
"t.w += 1.; t *= 2. / t.w; t.w -= 1.;\n"
|
||||
@ -521,6 +527,11 @@ shared_ptr<glhr::GLprogram> write_shader(flagtype shader_flags) {
|
||||
vmain += panini_shader();
|
||||
shader_flags |= SF_ORIENT;
|
||||
}
|
||||
else if((shader_flags & SF_PERS3) && vid.stereo_mode == sCylindrical && !vrhr::rendering_eye()) {
|
||||
vmain += "t = uPP * t;", vsh += "uniform mediump mat4 uPP;";
|
||||
vmain += cylindrical_shader();
|
||||
shader_flags |= SF_ORIENT;
|
||||
}
|
||||
else if((shader_flags & SF_PERS3) && vid.stereo_mode == sStereographic && !vrhr::rendering_eye()) {
|
||||
vmain += "t = uPP * t;", vsh += "uniform mediump mat4 uPP;";
|
||||
vmain += stereo_shader();
|
||||
|
Loading…
Reference in New Issue
Block a user