Source

kinect-viewer / KVRenderer.h

/*
 * Copyright 2010 Cliff L. Biffle.  All Rights Reserved.
 * Use of this source code is governed by the Apache License 2.0,
 * which can be found in the LICENSE file.
 */

#import <Cocoa/Cocoa.h>

#import "types.h"

// Projects depth and color data into 3D space, starting from
// scratch at each frame and describing only the nearest visible
// surfaces.
@interface KVRenderer : NSObject {
  // The actual scene model.  Alarmingly, gcc generates suboptimal
  // 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];
  
  // The raw samples of the last depth image.
  uint16_t depthImage[480][640];
}

// Called within an active GL context to allocate any resources.
- (void) initGL;

// Most recent frame of depth samples, in the format generated by
// KVDataSource.  Note that the setter will either make an internal
// copy of this or simply use it to update an internal model.
- (void) setDepthSamples: (NSData *) depthSamples;

// Most recent frame of depth samples, in the format generated by
// KVDataSource.  Note that the setter will either make an internal
// copy of this or simply use it to update an internal model.
- (void) setColorSamples: (NSData *) colorSamples;

- (void) drawInCurrentOpenGLContextWithOptions: (NSDictionary *) options;

@end