summaryrefslogtreecommitdiff
path: root/03_play
diff options
context:
space:
mode:
Diffstat (limited to '03_play')
-rw-r--r--03_play/src/testApp.cpp138
-rw-r--r--03_play/src/testApp.h3
2 files changed, 89 insertions, 52 deletions
diff --git a/03_play/src/testApp.cpp b/03_play/src/testApp.cpp
index 5553bc8..56896cc 100644
--- a/03_play/src/testApp.cpp
+++ b/03_play/src/testApp.cpp
@@ -41,6 +41,8 @@ void testApp::setup() {
//ofSetFrameRate(25.0f);
offset=0.0f;
+ drawmovies=false;drawcloud=true;
+ frame=0;
}
void testApp::startPlayers(){
@@ -49,6 +51,9 @@ void testApp::startPlayers(){
//openNIPlayers[deviceID].setup(false);
//openNIPlayers[deviceID].start();
openNIPlayers[deviceID].startPlayer(ofToDataPath(recs[playing].data[deviceID]));
+ //openNIPlayers[deviceID].setSpeed(0.0000001f);
+ //openNIPlayers[deviceID].setPaused(true);
+
soundplayer.stop();
@@ -63,24 +68,17 @@ void testApp::startPlayers(){
//--------------------------------------------------------------
void testApp::update(){
for (int deviceID = 0; deviceID < numDevices; deviceID++){
+ openNIPlayers[deviceID].setFrame(frame);
openNIPlayers[deviceID].update();
}
}
//--------------------------------------------------------------
void testApp::draw(){
- ofBackground(0, 0, 0);
+ ofBackground(50, 50, 50);
ofSetColor(255, 255, 255);
-
-
- ofPushMatrix();
- //ofTranslate(0,0,-1500);
- ofRotate(0,1,0,180);
-
- //cam.begin();
- ofDrawAxis(100);
//glEnable(GL_PROGRAM_POINT_SIZE);
//glEnable(GL_POINT_SMOOTH);
@@ -88,69 +86,92 @@ void testApp::draw(){
//glPointSize(12.0f);
+
+
for (int deviceID = 0; deviceID < numDevices; deviceID++){
- //ofTranslate(0, deviceID * 400);
- //openNIPlayers[deviceID].drawDebug();
- //openNIPlayers[deviceID].drawDepth(50, 0,520,390);
- //openNIPlayers[deviceID].drawImage(600, 0,520,390);
+
+ if (drawmovies) {
+ ofTranslate(0, deviceID * 400);
+ //openNIPlayers[deviceID].drawDebug();
+ openNIPlayers[deviceID].drawDepth(50, 0,520,390);
+ openNIPlayers[deviceID].drawImage(600, 0,520,390);
+ }
//construct points
//glBegin(GL_POINTS);
//how to find buffer size?
- /*
- XnStatus xn::DepthGenerator::ConvertProjectiveToRealWorld ( XnUInt32 nCount,
- const XnPoint3D aProjective[],
- XnPoint3D aRealWorld[]
- )
- */
+ /*
+ XnStatus xn::DepthGenerator::ConvertProjectiveToRealWorld ( XnUInt32 nCount,
+ const XnPoint3D aProjective[],
+ XnPoint3D aRealWorld[]
+ )
+ */
- int count;
- const XnDepthPixel* depthmap=openNIPlayers[deviceID].getDepthGenerator().GetDepthMap();
- int range=2000;
+ if (drawcloud) {
- int dmw=openNIPlayers[deviceID].getWidth();
+ cam.begin();
- for (int i=0;i<openNIPlayers[deviceID].getWidth();i+=2) {
+ ofPushMatrix();
+ ofRotate(0,1,0,180);
+ ofTranslate(0,0,1500);
+
- glBegin(GL_LINES);
+
+
+ ofDrawAxis(100);
- for (int j=0;j<openNIPlayers[deviceID].getHeight();j+=2) {
+ int count;
+ const XnDepthPixel* depthmap=openNIPlayers[deviceID].getDepthGenerator().GetDepthMap();
+ int range=2500;
+ int dmw=openNIPlayers[deviceID].getWidth();
+ for (int i=0;i<openNIPlayers[deviceID].getWidth();i+=2) {
- ofPoint p= openNIPlayers[deviceID].projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
- //ofPoint p= projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
-
- if (p.z == 0 || p.z>range) continue; // gets rid of background -> still a bit weird if userID > 0... //&& isCPBkgnd
- //ofColor color = kinect->getColorAt(x,y); //userID);
- //if (col) glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a);
- // else
+ glBegin(GL_LINES);
+ for (int j=0;j<openNIPlayers[deviceID].getHeight();j+=2) {
- glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255);
- glVertex3f(p.x, p.y, p.z);
- //if (i==320&&j==160) cerr<<"world point: "<<p.x<<","<<p.y<<","<<p.z<<endl;
- }
- glEnd();
- }
- }
- //export for fast/ switchable playback
- //figure out how to line up (could be one off)
- //export frame and find matching coords
- //manually find positions
- //calculate offset
- //audio sync
- //gui
- //audio analysis
- //sfx for point cloud
+ ofPoint p= openNIPlayers[deviceID].projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
+ //ofPoint p= projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
+
+ if (p.z == 0 || p.z>range) continue; // gets rid of background -> still a bit weird if userID > 0... //&& isCPBkgnd
+ //ofColor color = kinect->getColorAt(x,y); //userID);
+ //if (col) glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a);
+ // else
+
- //cam.end();
+ glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255);
+ glVertex3f(p.x, p.y, p.z);
+ //if (i==320&&j==160) cerr<<"world point: "<<p.x<<","<<p.y<<","<<p.z<<endl;
+ }
- ofPopMatrix();
+ glEnd();
+ }
+
+
+ //export for fast/ switchable playback
+ //figure out how to line up (could be one off)
+ //export frame and find matching coords
+ //manually find positions
+ //calculate offset
+ //audio sync
+ //gui
+ //audio analysis
+ //sfx for point cloud
+
+ //
+
+ ofPopMatrix();
+
+ cam.end();
+
+ glDisable(GL_PROGRAM_POINT_SIZE);
- glDisable(GL_PROGRAM_POINT_SIZE);
+ }
+ }
ofSetColor(255, 255, 255);
string msg = "MILLIS: " + ofToString(ofGetElapsedTimeMillis());
@@ -185,6 +206,19 @@ void testApp::keyPressed(int key){
case 'x':
offset-=.025;
break;
+ case 'q':
+ drawmovies=!drawmovies;
+ break;
+ case 'w':
+ drawcloud=!drawcloud;
+ break;
+ case 'a':
+ frame--;
+ if (frame<0) frame=openNIPlayers[0].getTotalNumFrames()-1;
+ break;
+ case 's':
+ frame=((frame+1)%openNIPlayers[0].getTotalNumFrames());
+ break;
}
if (changed) startPlayers();
diff --git a/03_play/src/testApp.h b/03_play/src/testApp.h
index 1b3a0c1..67cd4dc 100644
--- a/03_play/src/testApp.h
+++ b/03_play/src/testApp.h
@@ -47,6 +47,9 @@ public:
float offset;
ofxMayaCam cam;
+
+ bool drawmovies,drawcloud;
+ int frame;
};