summaryrefslogtreecommitdiff
path: root/TRRSS_01_rec/src/testApp.h
blob: 225abc8613eadd0f8aea60a877e5c53c8e5d149b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#pragma once

//for tomorrow: drawing interface & screengrab

//thursday:
//2 camera calibration
//recording - whats the best format - in memeory + save at end?
//movie + pixels?

#include "ofMain.h"
#include "ofxOpenNI.h"

#include "ofxFensterManager.h"
#include "ofxGui.h"

#include "ofxMayaCam.h"

//#define NEWAPI

class guiWindow;

class testApp : public ofxFensterListener{

	public:
		void setup();
		void update();
		void draw();
		void exit();

		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);
		void dragEvent(ofDragInfo dragInfo);
		void gotMessage(ofMessage msg);

		string	generateFileName();
		void	setupRecording(string _filename = "");
		void	setupPlayback(string _filename);

		ofxOpenNIRecorder	oniRecorder;

		bool				isLive, isRecording;

#ifdef NEWAPI
		ofxOpenNI openNIDevice;
		void userEvent(ofxOpenNIUserEvent & event);

#else


		ofxOpenNIContext	recordContext,playContext;
		ofxDepthGenerator	recordDepth,playDepth;
		ofxImageGenerator	recordImage,playImage;
		ofxUserGenerator	recordUser,playUser;

		ofxImageGenerator *whichImage;
		ofxUserGenerator *whichUser;
#endif


		guiWindow *guiWin;
	
		ofxMayaCam cam;

};

class guiWindow: public ofxFensterListener{
    public:
    ofxPanel gui;
    ofxFloatSlider dMin;
    ofxParameter<float> distMin;
    ofxFloatSlider dMax;
    ofxParameter<float> distMax;
    ofxIntSlider dStep;
    ofxParameter<int> drawStep;
    ofxToggle dPoints;
    ofxParameter<bool> drawPoints;
    ofxFloatSlider pSize;
    ofxParameter<float> pointSize;
    ofxToggle iOut;
    ofxParameter<bool> insideOut;
    

	void setup(){
            gui.setup("","panel.xml",0,0);
            distMin=400;
            gui.add(dMin.setup("min distance",distMin,0,5000,255));
            distMax=2000;
            gui.add(dMax.setup("max distance",distMax,0,5000,255));
            drawStep=2;
            gui.add(dStep.setup("draw step",drawStep,1,32,255));
			drawPoints=false;
			gui.add(dPoints.setup("draw points",drawPoints));
			pointSize=2.0;
            gui.add(pSize.setup("point size",pointSize,0.0,20.0,255));
            insideOut=false;
            gui.add(iOut.setup("inside out",insideOut));
	}
	void draw() { gui.draw(); }


};