From c42c63d30a31713ffc113d6a03795d4538bd5c84 Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 18 Jun 2013 18:03:31 +0100 Subject: mostly good --- 04_playobjects/src/testApp.cpp | 18 ++++++++++++++++-- 04_playobjects/src/testApp.h | 23 +++++++++++++++++++---- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/04_playobjects/src/testApp.cpp b/04_playobjects/src/testApp.cpp index 6b525e1..c1850f9 100644 --- a/04_playobjects/src/testApp.cpp +++ b/04_playobjects/src/testApp.cpp @@ -33,6 +33,13 @@ void testApp::setup() { offset=0.0f; receiver.setup(OSCPORT); + + user.setUseMaskTexture(true); + user.setUsePointCloud(true); + user.setPointCloudDrawSize(2); // this is the size of the glPoint that will be drawn for the point cloud + user.setPointCloudResolution(2); // this is the step size between points for the cloud -> eg., this sets it to every second point + + drawmovies=false;drawcloud=true; } void testApp::startPlayers(int newplayer){ @@ -40,7 +47,7 @@ void testApp::startPlayers(int newplayer){ soundplayer.stop(); usleep(100000); playing=newplayer; - players[playing].play(); + players[playing].play(user); } //-------------------------------------------------------------- @@ -75,7 +82,8 @@ void testApp::draw(){ ofPushMatrix(); - players[playing].draw(); + if (drawmovies) players[playing].drawWindows(); + if (drawmovies) players[playing].drawCloud(); ofPopMatrix(); @@ -111,6 +119,12 @@ void testApp::keyPressed(int key){ case 'x': offset+=1; break; + case 'q': + drawmovies=!drawmovies; + break; + case 'w': + drawcloud=!drawcloud; + break; } if (newplaying!=playing) startPlayers(newplaying); } diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h index 223bc9d..0de2207 100644 --- a/04_playobjects/src/testApp.h +++ b/04_playobjects/src/testApp.h @@ -35,12 +35,15 @@ class syncOniPlayer{ //players[players.size()-1]->start(); //players[players.size()-1]->startPlayer(name); } - void play(){ + void play(ofxOpenNIUser user){ for (int i=0;isetSafeThreading(true); players[i]->setupFromONI(filenames[i],true); + players[i]->addUserGenerator(); + players[i]->setRegister(true); players[i]->setLooped(false); + players[i]->setBaseUserClass(user); players[i]->start(); //players[players.size()-1]->setSpeed(1.0f); if (audio!="") { @@ -69,9 +72,19 @@ class syncOniPlayer{ } void drawCloud(){ for (int i=0;idrawDepth(50, 0,520,390); - players[i]->drawImage(600, 0,520,390); + ofPushMatrix(); + ofEnableBlendMode(OF_BLENDMODE_ALPHA); + int numUsers = players[i]->getNumTrackedUsers(); + for (int nID = 0; nID < numUsers; nID++){ + ofxOpenNIUser & user = players[i]->getTrackedUser(nID); + user.drawMask(); + ofPushMatrix(); + ofTranslate(ofGetWidth()/2, ofGetHeight()/2, -1000); + user.drawPointCloud(); + ofPopMatrix(); + } + ofDisableBlendMode(); + ofPopMatrix(); } } void stop(){ @@ -117,6 +130,7 @@ public: int numDevices; ofxOpenNI openNIPlayers[MAX_DEVICES]; + ofxOpenNIUser user; int playing; @@ -130,6 +144,7 @@ public: ofxOscReceiver receiver; + bool drawmovies,drawcloud; int offset; }; -- cgit v1.2.3