diff options
| author | Comment <tim@gray.(none)> | 2013-06-20 09:06:40 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-20 09:06:40 +0100 |
| commit | 39bcb5346b1f746399192391b6699e81d0d8ad3a (patch) | |
| tree | 36445cbd0d270f5181fb04eaf875a7b6f3422ff2 /06_performance/src/testApp.cpp | |
| parent | cdd0e0b630bd3a5a8ba15dbce7f5e03221b72f92 (diff) | |
spooky bug fixed, integration nearly right
Diffstat (limited to '06_performance/src/testApp.cpp')
| -rw-r--r-- | 06_performance/src/testApp.cpp | 184 |
1 files changed, 104 insertions, 80 deletions
diff --git a/06_performance/src/testApp.cpp b/06_performance/src/testApp.cpp index d41071a..ac1391b 100644 --- a/06_performance/src/testApp.cpp +++ b/06_performance/src/testApp.cpp @@ -17,11 +17,11 @@ void testApp::setup(){ midiIn.listPorts(); - midiIn.openPort(0); //this was 1 on linux + midiIn.openPort(1); //this was 1 on linux midiIn.addListener(this); midiOut.listPorts(); - midiOut.openPort(0); //this was 1 on linux + midiOut.openPort(1); //this was 1 on linux // 0 output channeLs, // 2 input channels @@ -60,7 +60,7 @@ void testApp::setup(){ F_movieSpeed=0.0; //blendImage.loadImage("blend01.png"); - blendImage.loadMovie("blend01.mov"); + blendImage.loadMovie("blend.mp4"); blendImage.play(); blendImage.setLoopState(OF_LOOP_NORMAL); blendImage.setSpeed(F_movieSpeed); @@ -95,8 +95,8 @@ void testApp::setup(){ F_yRotate=0; F_zRotate=0; - F_xRotation=0; - F_yRotation=180; + F_xRotation=180; + F_yRotation=180; //was 180 F_zRotation=0; F_particleAmount=100; @@ -141,6 +141,11 @@ void testApp::setup(){ fullScreen=false; setMidiState(); + + target.setPosition(0,0,0); + camera.setPosition(0,0,-700); + camera.lookAt(target,ofVec3f(0,1,0)); + narrator.init("TRSS_nesbitt_recordings.xml"); } @@ -171,7 +176,9 @@ void testApp::update(){ I_moviePlaying=I_movieSource; } blendImage.setSpeed(F_movieSpeed); - blendImage.idleMovie(); + //blendImage.idleMovie(); + + narrator.update(); } //-------------------------------------------------------------- @@ -247,86 +254,95 @@ void testApp::draw(){ F_drawFrames=max(1.99f,min(F_drawFrames+(F_drawStep*interval),(float)BUFFER_FRAMES)); ofPushMatrix(); - ofTranslate(hw,hh); - ofRotateX(F_xRotation); - ofRotateY(F_yRotation); - ofRotateZ(F_zRotation); - - - if (inputMode==GRABBER) { - ofSetColor(I_fade2,I_fade2,I_fade2); - ofPushMatrix(); - ofRotateX(90); - ofRotateZ(-90); - outTexture.draw(hw,-hh,-ofGetWidth(),ofGetHeight()); - ofPopMatrix(); - } + //ofTranslate(hw,hh); + camera.begin(); + ofRotateX(F_xRotation); + ofRotateY(F_yRotation); + ofRotateZ(F_zRotation); - GLfloat fogColor[4] = {0,0,0, 1.0}; - glFogi(GL_FOG_MODE, GL_LINEAR); - glFogfv(GL_FOG_COLOR, fogColor); - glFogf(GL_FOG_DENSITY,1.0 ); - glHint(GL_FOG_HINT, GL_DONT_CARE); - glFogf(GL_FOG_START, ofGetWidth()*(0.25+F_drawDecay)); - glFogf(GL_FOG_END, ofGetWidth()*(0.75+F_drawDecay)); - glEnable(GL_FOG); - - //reverse draw order when looking from back - int jStart=0; - int jEnd=F_drawFrames-1; - int jStep=1; - float F_yseg=F_yRotation; - while (F_yseg<-90) F_yseg+=360; - while (F_yseg>270) F_yseg-=360; - if (F_yseg>90) { - jStart=jEnd; - jEnd=0; - jStep=-1; - if (draworder) { - draworder=false; - //printf("switched to reverse order\n"); + /* + if (inputMode==GRABBER) { + ofSetColor(I_fade2,I_fade2,I_fade2); + ofPushMatrix(); + ofRotateX(90); + ofRotateZ(-90); + outTexture.draw(hw,-hh,-ofGetWidth(),ofGetHeight()); + ofPopMatrix(); + } + */ + GLfloat fogColor[4] = {0,0,0, 1.0}; + glFogi(GL_FOG_MODE, GL_LINEAR); + glFogfv(GL_FOG_COLOR, fogColor); + glFogf(GL_FOG_DENSITY,1.0 ); + glHint(GL_FOG_HINT, GL_DONT_CARE); + glFogf(GL_FOG_START, ofGetWidth()*(0.25+F_drawDecay)); + glFogf(GL_FOG_END, ofGetWidth()*(0.75+F_drawDecay)); + glEnable(GL_FOG); + + //reverse draw order when looking from back + int jStart=0; + int jEnd=F_drawFrames-1; + int jStep=1; + float F_yseg=F_yRotation; + while (F_yseg<-90) F_yseg+=360; + while (F_yseg>270) F_yseg-=360; + if (F_yseg>90) { + jStart=jEnd; + jEnd=0; + jStep=-1; + if (draworder) { + draworder=false; + //printf("switched to reverse order\n"); + } + } + else if (!draworder) { + draworder=true; + //printf("switched to normal order\n"); } - } - else if (!draworder) { - draworder=true; - //printf("switched to normal order\n"); - } - for (int j=jStart;j!=jEnd;j+=jStep) { - int fB=(thisFFTbuffer+j)%BUFFER_FRAMES; + for (int j=jStart;j!=jEnd;j+=jStep) { + int fB=(thisFFTbuffer+j)%BUFFER_FRAMES; + + ofPushMatrix(); //coordinate transform for FFT draw direction + ofTranslate(0,0,(j*zStep)-hw); + ofRotateX(F_drawAxis); + + ofFill(); + ofSetColor(0,0,0); + if (B_fill) { + glBegin(GL_QUAD_STRIP); + for (int i = 0; i < lFFTanalyzer.nAverages-1; i++){ + glVertex3f((i*xStep)-hw,-(FFTbuffer[0][i][fB] * F_scale),0); + glVertex3f((i*xStep)-hw,0,0); + } + for (int i =lFFTanalyzer.nAverages, k=lFFTanalyzer.nAverages-1; i < lFFTanalyzer.nAverages+rFFTanalyzer.nAverages; i++, k--){ + glVertex3f((i*xStep)-hw,-(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); + glVertex3f((i*xStep)-hw,0,0); + } + glEnd(); + } + + ofNoFill(); + ofSetLineWidth(F_lineWidth); + ofSetColor(I_fade1,I_fade1,I_fade1); + glBegin(GL_LINE_STRIP); + for (int i = 0; i < lFFTanalyzer.nAverages; i++){ + glVertex3f((i*xStep)-hw,-(FFTbuffer[0][i][fB] * F_scale),0); + } + for (int i =lFFTanalyzer.nAverages, k=lFFTanalyzer.nAverages-1; i < lFFTanalyzer.nAverages+rFFTanalyzer.nAverages; i++, k--){ + glVertex3f((i*xStep)-hw,-(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); + } + glEnd(); + ofPopMatrix(); + } - ofPushMatrix(); //coordinate transform for FFT draw direction - ofTranslate(0,0,(j*zStep)-hw); - ofRotateX(F_drawAxis); + ofPushMatrix(); + ofTranslate(0,150,-1050); + narrator.drawCloud(2); + ofPopMatrix(); - ofFill(); - ofSetColor(0,0,0); - if (B_fill) { - glBegin(GL_QUAD_STRIP); - for (int i = 0; i < lFFTanalyzer.nAverages-1; i++){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[0][i][fB] * F_scale),0); - glVertex3f((i*xStep)-hw,0,0); - } - for (int i =lFFTanalyzer.nAverages, k=lFFTanalyzer.nAverages-1; i < lFFTanalyzer.nAverages+rFFTanalyzer.nAverages; i++, k--){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); - glVertex3f((i*xStep)-hw,0,0); - } - glEnd(); - } + camera.end(); - ofNoFill(); - ofSetLineWidth(F_lineWidth); - ofSetColor(I_fade1,I_fade1,I_fade1); - glBegin(GL_LINE_STRIP); - for (int i = 0; i < lFFTanalyzer.nAverages; i++){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[0][i][fB] * F_scale),0); - } - for (int i =lFFTanalyzer.nAverages, k=lFFTanalyzer.nAverages-1; i < lFFTanalyzer.nAverages+rFFTanalyzer.nAverages; i++, k--){ - glVertex3f((i*xStep)-hw,-(FFTbuffer[1][(lFFTanalyzer.nAverages+rFFTanalyzer.nAverages)-(i+1)][fB] * F_scale),0); - } - glEnd(); - ofPopMatrix(); - } ofPopMatrix(); renderImage.end(); @@ -447,6 +463,8 @@ void testApp::draw(){ glPopMatrix(); */ + + if (showFPS) { ofDrawBitmapString(ofToString(ofGetFrameRate(), 2),20,20); ofDrawBitmapString(ofToString(F_xRotation, 4)+" "+ofToString(F_yRotation, 4)+" "+ofToString(F_zRotation, 4),20,30); @@ -464,6 +482,12 @@ void testApp::keyPressed (int key){ fullScreen=!fullScreen; ofSetFullscreen(fullScreen); } + if(key == ','){ + narrator.previous(); + } + if(key == '.'){ + narrator.next(); + } } //-------------------------------------------------------------- |
