From 11229ede83c48fab01e6e566155536b5e7e9d762 Mon Sep 17 00:00:00 2001 From: Comment Date: Mon, 24 Jun 2013 23:18:03 +0100 Subject: yay --- 06_performance/src/oni.cpp | 18 +++++++++++------- 06_performance/src/oni.h | 16 ++++++++++++++++ 06_performance/src/testApp.cpp | 19 +++++++++++++------ 06_performance/src/testApp.h | 2 ++ 4 files changed, 42 insertions(+), 13 deletions(-) (limited to '06_performance/src') diff --git a/06_performance/src/oni.cpp b/06_performance/src/oni.cpp index 3f028fc..346adec 100644 --- a/06_performance/src/oni.cpp +++ b/06_performance/src/oni.cpp @@ -98,13 +98,13 @@ void syncOniPlayer::drawCloud(int step){ } void syncOniPlayer::drawPoints(float birth,float life,float dx,float dy, float dz,float size){ if (!drawable) return; - glEnable(GL_PROGRAM_POINT_SIZE); - glEnable(GL_POINT_SMOOTH); - glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); + //glEnable(GL_PROGRAM_POINT_SIZE); + //glEnable(GL_POINT_SMOOTH); + //glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glEnable( GL_BLEND ); glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); //glPointSize( size); - glBegin(GL_POINTS); + //glBegin(GL_POINTS); const XnDepthPixel* depthmap=players[0]->getDepthGenerator().GetDepthMap(); const ofPixels& pixels=players[0]->getImagePixels(); int range=1700; @@ -121,7 +121,11 @@ void syncOniPlayer::drawPoints(float birth,float life,float dx,float dy, float d //fpoint f=fpoint(p.x, p.y, p.z,pixels[((j*step*dmw)+(i*step))*3],pixels[((j*step*dmw)+(i*step))*3]+1,pixels[((j*step*dmw)+(i*step))*3]+2); //f.draw(life,dx,dy,dz); if (pointPool.size()) {//take 1st dead particle - points[(*pointPool.begin())].setup(p.x, p.y, p.z,pixels[((j*step*dmw)+(i*step))*3],pixels[((j*step*dmw)+(i*step))*3]+1,pixels[((j*step*dmw)+(i*step))*3]+2); + points[(*pointPool.begin())].setup(p.x, p.y, p.z, + LUT[pixels[((j*step*dmw)+(i*step))*3]], + LUT[pixels[((j*step*dmw)+(i*step))*3]+1], + LUT[pixels[((j*step*dmw)+(i*step))*3]+2] + ); pointPool.erase(pointPool.begin()); } else {//make a new one @@ -134,9 +138,9 @@ void syncOniPlayer::drawPoints(float birth,float life,float dx,float dy, float d pointPool.insert(i); } } - glEnd(); + //glEnd(); glDisable( GL_BLEND ); - glDisable(GL_PROGRAM_POINT_SIZE); + //glDisable(GL_PROGRAM_POINT_SIZE); } int syncOniPlayer::getNumParticles(){ return points.size()-pointPool.size(); diff --git a/06_performance/src/oni.h b/06_performance/src/oni.h index 36d216a..c858995 100644 --- a/06_performance/src/oni.h +++ b/06_performance/src/oni.h @@ -22,9 +22,11 @@ class fpoint{ float l=ofGetElapsedTimef()-st; if (life>l) { glPointSize((1.0f-(l/life))*size); + glBegin(GL_POINTS); glColor3ub(r,g,b); //glColor4ub(r,g,b,(unsigned char)255); // ((l/life)*255.0f)); glVertex3f(x-(pow(l,2)*dx),y-(pow(l,2)*dy),z-(pow(l,2)*dz)); + glEnd(); return true; } else { @@ -37,9 +39,21 @@ class syncOniPlayer{ public: syncOniPlayer() { drawable=false; + gamma=3.0f; + LUT=NULL; + makeLUT(); } ~syncOniPlayer(){ stop(); + //if (LUT) delete[] LUT; + } + void makeLUT(){ + if (NULL==LUT){ + LUT=new uint8_t[0xff]; + } + for (int i=0;i<0xFF;i++) { + LUT[i]=(uint8_t)(pow(((float)i)/255.0f,gamma)*255.0f); + } } void addPlayer(string name); void play(); @@ -60,6 +74,8 @@ class syncOniPlayer{ bool drawable; vector points; set pointPool; + float gamma; + uint8_t *LUT; }; //======================================== class oniManager{ diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp index 57749b0..746d52f 100644 --- a/06_performance/src/testApp.cpp +++ b/06_performance/src/testApp.cpp @@ -168,7 +168,10 @@ void testApp::setup(){ else printf("no video clips found!\n"); } } -} + + xOffs=startX=yOffs=startY=0; +}; + @@ -242,6 +245,9 @@ void testApp::update(){ for (int i=0;i videoclips; ofxOscReceiver receiver; + + float xOffs,startX,yOffs,startY; }; #endif -- cgit v1.2.3