summaryrefslogtreecommitdiff
path: root/src/testApp.h
blob: 5ccf77571f7346b80f38b48d46eadc02e71449e3 (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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
projection calibration interface
tjr dec 2011

1- ideal KB interface to move around & calibrate camera
2- automatically save settings, key to reset

logically
 -rotate cam frame of reference
 -move cam xyz WRT frame of reference
 -don't do lookat

speed interface detects each key on-off & applies key acceleration
have to track how many frames each key has been pressed for

1- this is a case for a class
2- can key presses overlap?
3- class deals with keys in pairs as you can't move something simultaneously in 2 dirs
*/

#pragma once

#define CALIBRATE 1
#define DISPLAY 2
#define GRAB 3
#define NOTHING 4


#include "ofMain.h"
#include "ofEvents.h"
#include "ofxXmlSettings.h"
#include "ofx3DModelLoader.h"

#include "mapUtils.h"
#include "viewpoint.h"

#define OF_ADDON_USING_OFXAVAHI

//#include "ofxAvahiCoreBrowser.h"
#include "ofxAvahiClient.h"

#include "ofxOsc.h"
#include "ofxNetwork.h"

class testApp : public ofBaseApp{

	public:
        ~testApp();
		void setup();
		void update();
		void draw();

		void loadSettings(string filename);
		void saveSettings(string filename);
		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);

		void doTransition();
		float transTime;
		bool transition;

		void prevMovie();
		void nextMovie();

		string model_name;
		float model_x;
		float model_y;
		float model_z;

		ofx3DModelLoader model;
		ofVideoPlayer calibrator_label;
		ofVideoPlayer texture;
		string* clips;
		int numClips;
		int whichClip;
		int switchClip;

		viewpoint* views;
		int activeView; //receives keypresses
		int numViews;

		int mode;

		ofxXmlSettings XML;

		bool light;

		float mixAmount;

		ofVideoGrabber 		vidGrabber;
		unsigned char * 	videoInverted;
		ofTexture			videoTexture;
		int 				camWidth;
		int 				camHeight;
		bool grabberAvailable;

		void setupArduino(const int & version);
		void updateArduino();
		ofArduino	ard;
		bool		bSetupArduino;			// flag variable for setting up arduino once
		int 		bSwitchArduino;

		//----------------avahi stuff

		ofxAvahiClientService avahiService;

		ofxTCPClient	tcpClient;
		ofxOscReceiver	oscReceiver;

		void SendInterface(std::string targetIP, std::string interfaceString);

		bool hasWaitingMessages(){
		    return oscReceiver.hasWaitingMessages();
		}
		void getNextMessage(ofxOscMessage* m){
		    oscReceiver.getNextMessage(m);
		}
		void ProcessMessages();

};