Commits

Cliff Biffle committed 6387dd1

KVDepthMaps are now notified of color data received from the camera. They don't do anything with it yet.

  • Participants
  • Parent commits 39a1408

Comments (0)

Files changed (9)

 @end
 
 @protocol KFKinectColorDelegate
-- (void)colorFieldUpdated: (const uint8_t *)bytes from: (KFKinect *)kinect;
+- (void)colorFieldUpdated: (const colors_t *)bytes from: (KFKinect *)kinect;
 @end
 }
 
 - (void)rgbCallback: (freenect_pixel *)buffer {
-	[colorDelegate colorFieldUpdated: (const uint8_t *)buffer from: self];
+	[colorDelegate colorFieldUpdated: (const colors_t *)buffer from: self];
 }
 
 @end

File KVAveragingDepthMap.m

   }
 }
 
+- (void) updateColor: (const colors_t *)pixels {
+  // Nothing to do yet.
+}
+
 - (void) drawInCurrentOpenGLContextWithRenderer: (id <KVRenderer>) renderer {
   [renderer drawInCurrentOpenGLContext: &zs];
 }

File KVDepthMap.h

 // samples.
 - (void) updateDepth: (const depth_t *)rawDepthSamples;
 
+// Updates the internal state with a new set of color
+// samples.
+- (void) updateColor: (const colors_t *)pixels;
+
 // Provides a linearized floating-point depth map to the
 // given renderer -- possibly multiple times.
 // Implementations may freely reconfigure the renderer.

File KVDepthView.h

   GLint viewWidth, viewHeight;
 } camera_t;
 
-@interface KVDepthView : NSOpenGLView <KFKinectDepthDelegate> {
+@interface KVDepthView : NSOpenGLView <KFKinectDepthDelegate, KFKinectColorDelegate> {
   camera_t camera;
   
   BOOL usingTrackball;
 @property(nonatomic) BOOL recording;
 
 - (void) depthFieldUpdated: (const depth_t *)buffer from: (KFKinect *)kinect;
+- (void) colorFieldUpdated: (const colors_t *)buffer from: (KFKinect *)kinect;
 
 - (IBAction) selectPointCloudRenderer: sender;
 - (IBAction) selectFilledQuadRenderer: sender;

File KVDepthView.m

   }
 }
 
+- (void) colorFieldUpdated: (const colors_t *)buffer from: (KFKinect *)kinect {
+  // Nothing to do yet.
+}
+
 #pragma mark --- Actions ---
 
 - (IBAction) selectPointCloudRenderer: sender {

File KVSinglePlaneDepthMap.m

   }
 }
 
+- (void) updateColor: (const colors_t *)pixels {
+  // Nothing to do yet.
+}
+
 - (void) drawInCurrentOpenGLContextWithRenderer: (id <KVRenderer>) renderer {
   [renderer drawInCurrentOpenGLContext: &zs];
 }

File KinectViewerAppDelegate.m

     [NSThread detachNewThreadSelector:@selector(replayThread:) toTarget:self withObject:replayFile];
   } else {
     kinect = [[KFKinect alloc] initWithDepthDelegate: depthView
-                                       colorDelegate: nil];
+                                       colorDelegate: depthView];
     [kinect open];
   }
 }
   float z[480][640];
 } linear_depth_t;
 
+typedef struct {
+  uint8_t r, g, b;
+} rgb_t;
+
+typedef struct {
+  rgb_t pixels[480][640];
+} colors_t;
+
 #endif __types_h__