Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes to camera.

  • Loading branch information...
commit 51dbccf1e2fc7145fb591b000823957d8ea39d2f 1 parent d7c7e07
@TZer0 TZer0 authored
Showing with 7 additions and 7 deletions.
  1. +1 −1  openglqt/render.h
  2. +6 −6 util/camera.h
View
2  openglqt/render.h
@@ -203,7 +203,7 @@ public slots:
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- glFrustum(-1, 1, -1*cam->ratio, 1*cam->ratio, 0.5, 2.1+cam->zoom);
+ glFrustum(-1, 1, -1*cam->ratio, 1*cam->ratio, 1, 2.1+cam->zoom);
glTranslatef(cam->pos.x,cam->pos.y,-1-cam->zoom);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
View
12 util/camera.h
@@ -64,18 +64,18 @@ class Camera {
}
double xToSimX(int x) {
- return ((xPixToDouble(x))*(zoom+1)*2-pos.x);
+ return ((xPixToDouble(x))*(zoom+1)-pos.x);
}
double yToSimY(int y) {
- return ((yPixToDouble(y))*(zoom+1)*ratio*2-pos.y);
+ return ((yPixToDouble(y))*(zoom+1)*ratio-pos.y);
}
double xToSimXBack(int x) {
- return ((xPixToDouble(x))*(zoom+2)*2-pos.x);
+ return ((xPixToDouble(x))*(zoom+2)-pos.x);
}
double yToSimYBack(int y) {
- return ((yPixToDouble(y))*(zoom+2)*ratio*2-pos.y);
+ return ((yPixToDouble(y))*(zoom+2)*ratio-pos.y);
}
double xPixToDouble(int x) {
@@ -91,10 +91,10 @@ class Camera {
return (y+1)/yres-pos.y;
}
int ySimLim(int i) {
- return yToSimY(i*yres);
+ return yToSimY(i*yres*1.4);
}
int xSimLim(int i) {
- return xToSimX(i*yres);
+ return xToSimX(i*yres*1.4);
}
};
#endif
Please sign in to comment.
Something went wrong with that request. Please try again.