1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-27 14:37:16 +00:00

3d:: clipping without OpenGL

This commit is contained in:
Zeno Rogue 2019-03-21 19:11:28 +01:00
parent f8fe631eca
commit 8ea5a618ad
2 changed files with 22 additions and 8 deletions

View File

@ -248,13 +248,20 @@ void display_data::set_projection(int ed, bool apply_models) {
auto cd = current_display;
if(!shaderside_projection) {
glhr::projection_multiply(glhr::ortho(cd->xsize/2, -cd->ysize/2, abs(current_display->scrdist) + 30000));
if(ed) {
glhr::glmatrix m = glhr::id;
m[2][0] -= ed;
glhr::projection_multiply(m);
if(DIM == 3 && apply_models) {
glhr::projection_multiply(glhr::ortho(cd->xsize/2, -cd->ysize/2, 1));
glhr::id_modelview();
current_display->scrdist_text = 0;
}
else {
glhr::projection_multiply(glhr::ortho(cd->xsize/2, -cd->ysize/2, abs(current_display->scrdist) + 30000));
if(ed) {
glhr::glmatrix m = glhr::id;
m[2][0] -= ed;
glhr::projection_multiply(m);
}
glhr::id_modelview();
}
glhr::id_modelview();
}
else {

View File

@ -366,8 +366,15 @@ void addpoint(const hyperpoint& H) {
}
hyperpoint Hscr;
applymodel(H, Hscr);
for(int i=0; i<3; i++) Hscr[i] *= z;
Hscr[1] *= vid.stretch;
if(DIM == 2) {
for(int i=0; i<3; i++) Hscr[i] *= z;
Hscr[1] *= vid.stretch;
}
else {
Hscr[0] *= z;
Hscr[1] *= z * vid.stretch;
Hscr[2] = 1 - 2 * (-Hscr[2] - conformal::clip_min) / (conformal::clip_max - conformal::clip_min);
}
add1(Hscr);
}
}