Commits

Cliff Biffle committed 834e963

Removed the last vestiges of CPU-side normal computation.

  • Participants
  • Parent commits b10ad2c
  • Branches shaders

Comments (0)

Files changed (2)

File KVRenderer.h

   // code if we use [480][640].
   vec3f_t rays[480 * 640];
   
-  // Normal vectors for each vertex.
-  vec3f_t normals[480 * 640];
-  
   // The raw RGB samples of the last color image.  These do not
   // map one-to-one onto rays because the cameras are offset.
   rgb_t colorImage[480][640];

File 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);
 }