Source

kinect-viewer / KVRenderer.m

Diff from to

KVRenderer.m

   const uint16_t *sample = [data bytes];
   memcpy(&depthImage, sample, sizeof depthImage);
   
-  // gcc 4.2.1 is not clever enough to turn raster two-dimensional
-  // subscripting (e.g. ray[y][x]) into a single incremented induction
-  // variable -- we wind up doing integer multiplications on every
-  // use!  So, we do it by hand: thus |vidx|.
-  int vidx = 0;
-  
-  // Cast them rays
-  for (int y = 0; y < 480 - 1; y++) {
-    for (int x = 0; x < 640 - 1; x++, vidx++) {
-      vec3f_t here = {
-        rays[vidx].x,
-        rays[vidx].y,
-        sample[vidx],
-      };
-      vec3f_t right = {
-        rays[vidx + 1].x,
-        rays[vidx + 1].y,
-        sample[vidx + 1],
-      };
-      vec3f_t down = {
-        rays[vidx + 640].x,
-        rays[vidx + 640].y,
-        sample[vidx + 640],
-      };
-      normals[vidx] = compute_normal(here, down, right);
-    }
-  }
-  
   NSTimeInterval end = [NSDate timeIntervalSinceReferenceDate];
   rayCastingCount++;
   rayCastingTotal += end - start;
   glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, &rays);
 
-  glEnableClientState(GL_NORMAL_ARRAY);
-  glNormalPointer(GL_FLOAT, 0, &normals);
-  
   glDrawArrays(GL_POINTS, 0, 640 * 480);
   
-  glDisableClientState(GL_NORMAL_ARRAY);
   glDisableClientState(GL_VERTEX_ARRAY);
 }