view src/testApp.h @ 4:c843a959013f tip

Now using OSC bundles; some reorganisation and const-ification of code.
author samer
date Tue, 28 Feb 2012 11:36:30 +0000
parents b5281b3d55ce
children
line wrap: on
line source
#ifndef _TEST_APP
#define _TEST_APP


#include <ofxOsc.h>
#include <XnCppWrapper.h>
#include "ofAppGlutWindow.h"

#define MAX_USERS 16

using namespace xn;

class UserStats;
class testApp : public ofBaseApp{
private:
	ofAppGlutWindow window;
	ofxOscSender   sender;
	Context        context;
	
	DepthGenerator depthGenerator;
	UserGenerator  userGenerator;
	SceneAnalyzer  sceneAnalyzer;
	SceneMetaData  sceneMetaData;
	XnDepthPixel   max_depth;
	XnUInt64	   	timestamp;
	XnPlane3D      floor_pie;
	ofImage        userImage;
	ofTrueTypeFont font;
	unsigned char  *imagePixels;

	int   draw_image;
	bool  draw_time;
	bool  got_floor;
	XnVector3D floor_offset;
	
	class UserData {
	public:
		bool present;
		int  plot_coors[7];
	};
	
	UserData users[MAX_USERS];
	
	static void update_user(const UserStats& stats, UserData *user, XnVector3D *proj);
	ofxOscMessage track(int id, const UserData &user, const XnVector3D &proj, int area) const;
	
public:
	testApp(const char *host, int port, int fps);
	~testApp() { context.Shutdown(); };
	
	void setup();
	void update();
	void draw();
	
	void keyPressed  (int key);
	void keyReleased(int key);
	void mouseMoved(int x, int y );
	void mouseDragged(int x, int y, int button);
	void mousePressed(int x, int y, int button);
	void mouseReleased(int x, int y, int button);
	void windowResized(int w, int h);
};

#endif