summaryrefslogtreecommitdiff
path: root/04_playobjects
diff options
context:
space:
mode:
Diffstat (limited to '04_playobjects')
-rw-r--r--04_playobjects/src/testApp.cpp17
-rw-r--r--04_playobjects/src/testApp.h95
2 files changed, 45 insertions, 67 deletions
diff --git a/04_playobjects/src/testApp.cpp b/04_playobjects/src/testApp.cpp
index fe26030..cfe6119 100644
--- a/04_playobjects/src/testApp.cpp
+++ b/04_playobjects/src/testApp.cpp
@@ -37,6 +37,10 @@ void testApp::setup() {
receiver.setup(OSCPORT);
drawmovies=false;drawcloud=false;
+
+ target.setPosition(0,0,0);
+ camera.setPosition(0,0,-500);
+ camera.lookAt(target,ofVec3f(0,1,0));
}
void testApp::startPlayers(int newplayer){
@@ -84,11 +88,14 @@ void testApp::draw(){
}
if (drawcloud) {
- //cam.begin();
- ofTranslate(ofGetWidth(), ofGetHeight()/2,0);
+ camera.begin();
+
+ ofPushMatrix();
+ ofRotateY(ofGetElapsedTimef()*2.0f);
+ ofTranslate(0,0,-1100);
players[playing].drawCloud();
- ofDrawAxis(100);
- //cam.end();
+ ofPopMatrix();
+ camera.end();
}
}
@@ -100,7 +107,7 @@ void testApp::draw(){
msg += "\nclip: "+ofToString(playing);
if (playing>-1) msg += "\n"+players[playing].audio;
msg += "\noffset: "+ofToString(offset);
- if (drawcloud>-1) msg += "\nwith cloud";
+ if (drawcloud) msg += "\nwith cloud";
verdana.drawString(msg, 10, 10);
}
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h
index e1f1e5c..873db31 100644
--- a/04_playobjects/src/testApp.h
+++ b/04_playobjects/src/testApp.h
@@ -20,7 +20,13 @@ struct record{
//in order to play different clips it seems necessary to have a player per clip
class syncOniPlayer{
public:
- syncOniPlayer() {drawable=false;}
+ int depthW;
+ int depthH;
+ syncOniPlayer() {
+ drawable=false;
+ depthW=320;
+ depthH=240;
+ }
~syncOniPlayer(){
stop();
}
@@ -80,100 +86,64 @@ class syncOniPlayer{
players[i]->drawDepth(50, 0,520,390);
players[i]->drawImage(600, 0,520,390);
- const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap();
-
+ int count;
+ for (int i=0;i<players.size();i++) {
- int range=2500;
+ const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap();
+ //uint16_t* depthpixels=depthmap.getPixels();
+ int range=2500;
-
- int dmw=players[i]->getWidth();
-
- //for (int i=0;i<players[i]->getWidth();i+=2) {
+ for (int i=0;i<depthW;i+=2) {
glBegin(GL_LINES);
- //for (int j=0;j<players[i]->getHeight();j+=2) {
+ for (int j=0;j<depthH;j+=2) {
- ofPoint p= players[i]->projectiveToWorld(ofPoint(300,150,(float)(depthmap[1200])));
-/*
- ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*dmw+i])));
+
+ ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*depthW+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
+ //if (p.z == 0 || p.z>range) continue; // gets rid of background
- glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255);
- glVertex3f(p.x, p.y, p.z);
+ //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();
- //}
+ }
+
+ }
+
}
}
void drawCloud(){
- /*
- int num=0;
- for (int i=0;i<players.size();i++) {
- 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(0,0,-1000);
- user.drawPointCloud();
- ofPopMatrix();
- }
- num+=numUsers;
- ofDisableBlendMode();
- ofPopMatrix();
- }
- return num;
- */
- //cerr<<"drawing "<<players.size()<<" clouds"<<endl; we are getting to here when unititialised
-
+
int count;
for (int i=0;i<players.size();i++) {
- if (players[i]==0x00) {
- cerr<<"more spooky shit....!";
- return;
- }
const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap();
//uint16_t* depthpixels=depthmap.getPixels();
int range=2500;
-
-
- int dmw=players[i]->getWidth();
-
- for (int i=0;i<players[i]->getWidth();i+=2) {
+ for (int i=0;i<depthW;i+=2) {
glBegin(GL_LINES);
- for (int j=0;j<players[i]->getHeight();j+=2) {
-
+ for (int j=0;j<depthH;j+=2) {
- ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*dmw+i])));
+ ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*depthW+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
+ //if (p.z == 0 || p.z>range) continue; // gets rid of background
- glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255);
- glVertex3f(p.x, p.y, p.z);
+ //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;
}
@@ -243,7 +213,8 @@ public:
bool drawmovies,drawcloud;
int offset;
- ofxMayaCam cam;
+ ofCamera camera;
+ ofNode target;
};