Commits

Cliff Biffle committed f3c2c5a

Removed the old color-texture transform code in preparation for doing it the Right Way(tm).

  • Participants
  • Parent commits 9aeccac
  • Branches shaders

Comments (0)

Files changed (4)

 @property(assign, nonatomic) BOOL anaglyph;
 @property(assign, nonatomic) BOOL textured;
 @property(nonatomic) BOOL recording;
-@property(assign, nonatomic) projective_transform_t colorTransform;
 
 @property (assign) NSData *latestDepthSamples;
 @property (assign) NSData *latestColorSamples;
 - (void) resizeGL;
 - (void) updateProjectionWithOffset: (float) offset;
 - (void) updateModelViewWithOffset: (float) offset;
-- (void) updateColorTransform;
 - (GLuint) loadShaderOfType: (GLenum) type fromFiles: (NSArray *) names;
 
 @property(assign, nonatomic) BOOL updateQueued;
 @synthesize textured;
 @synthesize renderer;
 
-@synthesize colorTransform;
-- (void) setColorTransform: (projective_transform_t)newTransform {
-  colorTransform = newTransform;
-  [self setNeedsDisplay: YES];
-}
-
-- (void) updateColorTransform {
-  // A bit of a hack, but it triggers automatic KVO and the setter above.
-  self.colorTransform = colorTransform;
-}
-
 @synthesize frozen;
 @synthesize anaglyph;
 @synthesize recording;
 - (void) awakeFromNib {
   deviceWhite = [[NSColor colorWithDeviceRed: 1.F green: 1.F blue: 1.F alpha: 1.F] retain];
   
-  self.colorTransform = (projective_transform_t) {
-    .offset = { 14, 40, 0 },
-    .scale = { 0.92F, 0.92F },
-  };
-  
   self.renderer = [[[KVRenderer alloc] init] autorelease];
 }
 
 				[self setNeedsDisplay: YES];
 				break;
         
-      // Camera origin control
-      case 'i':
-        colorTransform.offset.y -= 1;
-        [self updateColorTransform];
-        break;
-        
-      case 'k':
-        colorTransform.offset.y += 1;
-        [self updateColorTransform];
-        break;
-
-      case 'j':
-        colorTransform.offset.x -= 1;
-        [self updateColorTransform];
-        break;
-        
-      case 'l':
-        colorTransform.offset.x += 1;
-        [self updateColorTransform];
-        break;
-        
-      case 'h':
-        colorTransform.offset.z -= 1.F/100.F;
-        [self updateColorTransform];
-        break;
-
-      case 'y':
-        colorTransform.offset.z += 1.F/100.F;
-        [self updateColorTransform];
-        break;
-        
-      // Scale control
-      case 'n':
-        colorTransform.scale.x -= 0.01F;
-        [self updateColorTransform];
-        break;
-        
-      case 'm':
-        colorTransform.scale.x += 0.01F;
-        [self updateColorTransform];
-        break;
-        
-      case ',':
-        colorTransform.scale.y -= 0.01F;
-        [self updateColorTransform];
-        break;
-        
-      case '.':
-        colorTransform.scale.y += 0.01F;
-        [self updateColorTransform];
-        break;
 		}
 	}
 }
   rgb_t pixels[480][640];
 } colors_t;
 
-// Describes how to map color data from one frustum
-// onto depth data from another.
-typedef struct {
-  // Offset of the color frustum's focal point, in
-  // pixels from the depth frustum's focal point.
-  vec3f_t offset;
-  // Ratios of the horizontal and vertical fields of
-  // view of the color camera to the corresponding
-  // parameters of the depth camera.  Corrects for
-  // differences in field-of-view.
-  vec2f_t scale;
-} projective_transform_t;
-
 #endif __types_h__
 	return cross_product(a, b);
 }
 
-// Converts depth image coordinates to color image coordinates
-// using |xform|, given the linearized depth image reading |z|.
-static inline void apply_projective_transform(const projective_transform_t *xform, float z, int *x, int *y) {
-  static const float farScaleZ = 10.F;
-  
-  // Center the coordinates around the origin.
-  vec2f_t centered = { *x - 320, *y - 240 };
-
-  // Shift the origin.
-  vec2f_t displaced = {
-    centered.x + xform->offset.x,// / zRat,
-    centered.y + xform->offset.y,// / zRat,
-  };
-  float shiftedZ = z + xform->offset.z;
-
-  // Correct the field of view
-  vec2f_t scale = {
-    (shiftedZ / farScaleZ) * xform->scale.x,
-    (shiftedZ / farScaleZ) * xform->scale.y,
-  };
-  vec2f_t scaled = {
-    displaced.x * scale.x,
-    displaced.y * scale.y,
-  };
-  
-  *x = ((int) scaled.x) + 320;
-  *y = ((int) scaled.y) + 240;
-}
-
 #endif __utility_h__