Commits

Cliff Biffle  committed f091adc

Removed the unused linearizationTable -- the shader doesn't need it. Might be worth building a 1D linearization texture later though.

  • Participants
  • Parent commits f3258ff
  • Branches shaders

Comments (0)

Files changed (2)

File KVRenderer.h

 // scratch at each frame and describing only the nearest visible
 // surfaces.
 @interface KVRenderer : NSObject {
-  // Memoized linearization function for 12-bit depth samples.
-  float linearizationTable[2048];
-
   // The actual scene model.  Alarmingly, gcc generates suboptimal
   // code if we use [480][640].
   vec3f_t rays[480 * 640];

File KVRenderer.m

 NSString * const KVDottedPolygonMode = @"KVDottedPolygonMode";
 
 @interface KVRenderer ()
-- (void) buildLinearizationTable;
 - (void) fillStaticComponents;
 
 @property(assign, nonatomic) double rayCastingTotal;
 - init {
   if ((self = [super init])) {
     [self fillStaticComponents];
-    [self buildLinearizationTable];
   }
   return self;
 }
   glEnd();
 }
 
-// The Kinect produces 11-bit depth samples.  Z-resolution decreases
-// with distance, following a curve that looks suspiciously like the
-// one used for perspective projection.  The ROS folks at CCNY derived
-// the equation below, for converting Kinect depth samples to meters.
-// This method memoizes the function over the entire 2048-element
-// domain.  This implies replacing a couple of floating-point constant
-// loads, an addition, and a division with an indirection to very hot
-// memory.  On my machine this eliminates 60% of time spent calculating
-// linear depths.
-- (void) buildLinearizationTable {
-  for (uint16_t depth = 0; depth < 2048; depth++) {
-    linearizationTable[depth] = -325.616F / ((GLfloat) depth + -1084.61F);
-  }
-  
-  // Simplification: when the Kinect reports "no data" for a point
-  // (typically because the IR projector is occluded) the result is
-  // a "very close" reading of nearly zero meters.  All my renderers
-  // filter out such readings, so we coerce it to exactly 0.F here
-  // to simplify that.
-  linearizationTable[0] = 0.F;
-  linearizationTable[2047] = 0.F;
-}
-
 // We pre-fill the X and Y components with distance from the center of
 // the image.  These values never make it to the rasterizer: they are
 // merely input to the vertex shader that performs perspective correction.