| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- /*
- * PolycodeKinect.h
- * PolycodeKinectTest
- *
- * Created by Ivan Safrin on 12/2/10.
- * Copyright 2010 Local Projects. All rights reserved.
- *
- */
- #pragma once
- #include "Polycode.h"
- #include "libfreenect.h"
- using namespace Polycode;
- void depth_cb(freenect_device *dev, void *v_depth, uint32_t timestamp);
- void rgb_cb(freenect_device *dev, void *rgb, uint32_t timestamp);
- #define MAX_KINECT_POINTS 8000
- class PolycodeRunner : public Threaded {
- public:
- PolycodeRunner();
- ~PolycodeRunner();
-
- void runThread();
- void updateThread() {}
-
- void rgbCallback(freenect_device *dev, void *rgb, uint32_t timestamp);
- void depthCallback(freenect_device *dev, void *v_depth, uint32_t timestamp);
-
- // static void depth_cb(freenect_device *dev, void *v_depth, uint32_t timestamp);
- // static void rgb_cb(freenect_device *dev, void *rgb, uint32_t timestamp);
-
- int initKinect();
-
- void tiltUp();
- void tiltDown();
- void Level();
-
- CoreMutex *drawMutex;
-
- uint8_t *depth_mid, *depth_front;
- uint8_t *rgb_back, *rgb_mid, *rgb_front;
-
- freenect_context *f_ctx;
- freenect_device *f_dev;
- int depthMap[FREENECT_FRAME_PIX];
-
- protected:
-
- uint16_t t_gamma[2048];
-
-
- int freenect_angle;
- freenect_video_format current_format;
- freenect_video_format requested_format;
-
-
- };
- class PolycodeKinect : EventHandler {
- public:
- PolycodeKinect(bool calculatePoints, int depthStart, int depthEnd, int pixelSkip);
- ~PolycodeKinect();
-
- Texture *getRGBTexture();
- Texture *getCloseDepthTexture();
-
- void tiltUp();
- void tiltDown();
- void Level();
-
- void handleEvent(Event *event);
-
- Vector3 points[MAX_KINECT_POINTS];
- Color colors[MAX_KINECT_POINTS];
- protected:
-
- int depthStart;
- int depthEnd;
- int pixelSkip;
-
- Timer *updateTimer;
- bool calculatePoints;
- bool calculateColors;
-
- uint8_t *rgbPtr;
- Texture *rgbTexture;
- Texture *closeDepthTexture;
- PolycodeRunner *runner;
-
- };
|