NostalgiaRoom docs
nostalgia.media.mit.edu
 All Classes Files Functions Variables Macros Groups Pages
testApp.h
Go to the documentation of this file.
1 
3 #pragma once
4 
5 #include "ofMain.h"
6 #include "ofxXmlSettings.h"
7 #include <algorithm>
8 #include "ofMain.h"
9 #include "ofxOsc.h"
10 
12 //# define USEWII
13 
15 //# define ADJUSTTIMEGAP
16 
19 #define PORT 9000
20 
21 // If the below parameter is defined,the timegap between two images will be adjusted .If the acceleration of the wii-mote is large,the user is swinging faster and the timegap is made small.If the user slows down,it means he would like to look at the image for more time,so the timegap is made large.
22 
23 
24 #define EfficientReorder
25 
26 //#define DEBUGMODE
27 
28 /* \brief Insert Path to your Images folder */
29 
30 #define PathToImageFolder "/Applications/MAMP/htdocs/NostalgiaRoom/" // if you have downloaded the images to your MAMP folder
31 // #define PathToImageFolder "/Users/abcxyz/of_v0073_osx_release/apps/myApps/Nostalgia_Spiral/bin/data/Images/" // if you have downloaded the images to your openframeworks folder
32 
33 
34 struct ImageData
35 {
36  float imageScore;
39 
40 #ifdef EfficientReorder
41  ofImage theloadedimage;
42 #else
43  bool isTagged;
44 #endif
45 
46  bool operator()(const ImageData&l,const ImageData &m) {
47  return (l.imageScore<m.imageScore);
48  }
49 
50 };
51 
52 class testApp : public ofBaseApp{
53 
54 public:
55 
61  void setup();
62  void update();
63  void draw();
64 
65  void keyPressed(int key);
66  void keyReleased(int key);
67  void mouseMoved(int x, int y);
68  void mouseDragged(int x, int y, int button);
69  void mousePressed(int x, int y, int button);
70  void mouseReleased(int x, int y, int button);
71  void windowResized(int w, int h);
72  void dragEvent(ofDragInfo dragInfo);
73  void gotMessage(ofMessage msg);
81  testApp(long long int uid);
82 
83 
84 #ifdef DEBUGMODE
85  ofEasyCam camera;
86 #endif
87 #ifndef DEBUGMODE
88 
89 
90 
96  /* \brief This is the main camera structure that will navigate the scene */
97  ofCamera camera;
98 
101 
103  int cameraindex=0;
104 
107 
109  float tweenvalue;
110 
113 
116 
119 
122 
127  ofxXmlSettings pictures_XML;
128 
130  long long int userid;
131 
139  vector <ofVec3f> wigglePositions;
140 
143 
146 
149 
152  /* End of Wiggling stuff. */
153 
155  vector<ImageData> combinedImageObjects;
156 
158  vector<ofVec3f>StarPositions;
159 
160 #endif
161 
163  vector<ofVec3f> SpiralPoints;
164 
165 
167  vector<ofImage>ImageVector;
168 
171 
174 
179 
182 
185 
187  ofQTKitPlayer startingMovie;
188 
191 
193  ofSoundPlayer BluementhalMp3;
194 
195 
196  #ifdef USEWII
197 
205  float roll, yaw, pitch, accel, wiiX, wiiY;
206 
208  float accel_x,accel_y,accel_z;
209 
211  float angular_velocity;
212 
214  ofxOscReceiver receiver;
215 
217  string Message;
218 
219  int windowWidth,windowHeight;
220 
222  float prevAngVel=0;
223 
227  #ifdef ADJUSTTIMEGAP
228 
230  float minAngularVelocity,maxAngularVelocity;
231  float minAccel,maxAccel;
232 
233  #endif
234 
235  ofTrueTypeFont fonttodisplayWiimoteValues;
236 
238  string State;
239  #endif
240 
242  float timeGap;
243 
244 
247 
249  bool fadeAudio;
250 
253 
256 
257  /*
258  * The below variables are used in the starting if the person is not swinging
259  */
260 
262  ofTrueTypeFont previewText;
263 
265  string tempText;
266 
268  bool ending;
269 
271 
273  vector<ImageData> taggedImageObjects;
274 
275 
281  /* \brief Vector that will use the above vector and ofLerp to compute the exact cameraposition
282  @returns ofVec3f
283  */
285 
286 
292  ofVec3f animate(int,int);
293 
297  void startAnimation();
298 
302 
311  void pushWigglePositions();
312 
317  ofVec3f wiggle();
318 
322  void loadImagesandXMLData();
323 
324 
326  void drawImages();
327 
329  void generateCircularSpiral();
330 
336  void assignStarPositions();
337  void drawStars();
338 
339 
340 
341 
342 };