gameoverhack/ofxOpenNI — pull request #41 by luteberget (2013-09-05 17:37:19+00:00)
Title: Implement interfaces ofxBaseVideo and ofxBase3DVideo

I suggest that the ofxOpenNI class should inherit from the virtual classes ofBaseVideo and ofxBase3DVideo. This will let other addons and apps easily switch between, for example, ofxKinect and ofxOpenNI, since they both provide the same basic data. For example, on some platforms ofxKinect is much easier to setup, while on other platforms ofxOpenNI might be your choice. If these interfaces are implemented, it is easy to switch between camera backends.

Implementation consists of:
- ofBaseVideo, since the depth cams can supply regular color video. This interface adds
- getPixels() and getPixelsRef(), which gives data that is already available through getImagePixels()
- close() and isFrameNew(), which only need to be forwarded to stop() and isNewFrame().
- ofxBase3DVideo, as defined in ofxKinect. This interface adds:
- The function getDepthPixels() now return unsigned char* instead of ofPixels&. Use getDepthPixelsRef() to get the ofPixel reference. This will break any apps which already use getDepthPixels, but is should be easy to update them to use getDepthPixelsRef instead.
- getDepthPixelsTextureReference(), which was already implemented.
- getDistancePixels(), which is a 2D array of floats. This is used to transfer the depth/distance (in mm) independently of the data type (short) which is used by the backend.