Commits

Cliff Biffle committed b50bfff

Reworked camera and frustum setup so that the default projection is basically the Kinect's optical projection. This makes better use of display area.

Comments (0)

Files changed (1)

   camera = (camera_t) {
     .fov = 57,
     .pivot = { 0, 0, 0 },
-    .pos = { 0, 0, -3 },
+    .pos = { 0, 0, -0.001f },
     .target = { 0, 0, 0 },
     .up = { 0, 1, 0 },
   };
   }
 }
 
-#define MAXIMUM_DEPTH (16.0F)
+#define MAXIMUM_DEPTH (8.0F)
 
 - (void) updateProjection {
   [[self openGLContext] makeCurrentContext];
   glLoadIdentity();
   
   GLdouble near = -camera.pos.z - MAXIMUM_DEPTH;  
-  GLdouble far = -camera.pos.z + MAXIMUM_DEPTH * 16;
+  GLdouble far = -camera.pos.z + MAXIMUM_DEPTH;
   
   // I do not fully understand this.
   if (near < 0.0001) near = 0.0001;
   
   GLdouble aspectRatio = camera.viewWidth / (GLdouble) camera.viewHeight;
   
-  gluPerspective(camera.fov / aspectRatio, aspectRatio, near, far);
+  gluPerspective(camera.fov / 4.f * 3.f, aspectRatio, near, far);
 }
 
 - (void) updateModelView {