summaryrefslogtreecommitdiff
path: root/04_playobjects/src/testApp.h
diff options
context:
space:
mode:
Diffstat (limited to '04_playobjects/src/testApp.h')
-rw-r--r--04_playobjects/src/testApp.h95
1 files changed, 33 insertions, 62 deletions
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;
};