diff options
| author | Comment <tim@gray.(none)> | 2014-03-02 22:14:34 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2014-03-02 22:14:34 +0000 |
| commit | 1082e9eed74507b6eb5a3d0d7ab8a6cdecf40e19 (patch) | |
| tree | c9e21ac3e1c3434b30c8530497b1f678641038dc /basedProject | |
| parent | a2fe68dfed91e362404ea1171cc8f0b313956cc3 (diff) | |
working version for show
Diffstat (limited to 'basedProject')
| -rw-r--r-- | basedProject/addons.make | 1 | ||||
| -rw-r--r-- | basedProject/bin/data/checker_blue.png | bin | 0 -> 2425 bytes | |||
| -rw-r--r-- | basedProject/bin/data/checker_green.png | bin | 0 -> 2790 bytes | |||
| -rw-r--r-- | basedProject/bin/data/checker_red.png | bin | 0 -> 2426 bytes | |||
| -rw-r--r-- | basedProject/bin/data/settings.xml | 6 | ||||
| -rw-r--r-- | basedProject/bin/data/settings_night2.xml | 12 | ||||
| -rw-r--r-- | basedProject/bin/data/settings_opening_night.xml | 12 | ||||
| -rw-r--r-- | basedProject/bin/data/settings_stage1.xml | 12 | ||||
| -rw-r--r-- | basedProject/bin/data/settings_starting.xml | 12 | ||||
| -rw-r--r-- | basedProject/src/audioGlitcher.h | 2 | ||||
| -rw-r--r-- | basedProject/src/ofApp.cpp | 142 | ||||
| -rw-r--r-- | basedProject/src/ofApp.h | 15 | ||||
| -rw-r--r-- | basedProject/src/viewpoint.cpp | 4 |
13 files changed, 179 insertions, 39 deletions
diff --git a/basedProject/addons.make b/basedProject/addons.make index 936ebc8..ff39ca1 100644 --- a/basedProject/addons.make +++ b/basedProject/addons.make @@ -1,2 +1,3 @@ ofxXmlSettings ofxOpenCv +ofxBeat diff --git a/basedProject/bin/data/checker_blue.png b/basedProject/bin/data/checker_blue.png Binary files differnew file mode 100644 index 0000000..0cbfb9c --- /dev/null +++ b/basedProject/bin/data/checker_blue.png diff --git a/basedProject/bin/data/checker_green.png b/basedProject/bin/data/checker_green.png Binary files differnew file mode 100644 index 0000000..d1490bb --- /dev/null +++ b/basedProject/bin/data/checker_green.png diff --git a/basedProject/bin/data/checker_red.png b/basedProject/bin/data/checker_red.png Binary files differnew file mode 100644 index 0000000..089c3da --- /dev/null +++ b/basedProject/bin/data/checker_red.png diff --git a/basedProject/bin/data/settings.xml b/basedProject/bin/data/settings.xml index 57d3f12..8ba6a68 100644 --- a/basedProject/bin/data/settings.xml +++ b/basedProject/bin/data/settings.xml @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8" ?> <map4> <view> - <settings x="0.000000" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="17.250000" roll="180.000000" targX="49.487381" targY="32.594791" targZ="-1.046636" lat="27.951185" lng="-385.289185" dolly="1557.915527" /> + <settings x="0.000000" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="16.055288" roll="180.002136" targX="43.555927" targY="98.572639" targZ="-1.046636" lat="-36.756008" lng="-552.925232" dolly="1531.048462" /> </view> <view> - <settings x="0.333300" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="17.250000" roll="180.000000" targX="49.487965" targY="32.594845" targZ="0.000000" lat="31.675091" lng="-717.290039" dolly="1557.917236" /> + <settings x="0.333300" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="16.055269" roll="182.087463" targX="135.739166" targY="100.192184" targZ="0.117859" lat="-40.668121" lng="-334.203583" dolly="1500.000000" /> </view> <view> - <settings x="0.666600" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="17.250000" roll="180.000000" targX="49.488358" targY="32.594955" targZ="0.000000" lat="27.952063" lng="-267.794952" dolly="1557.917969" /> + <settings x="0.666600" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="15.451327" roll="184.356995" targX="83.428452" targY="112.406845" targZ="0.000000" lat="-38.271206" lng="-789.523560" dolly="1569.822998" /> </view> </map4> diff --git a/basedProject/bin/data/settings_night2.xml b/basedProject/bin/data/settings_night2.xml new file mode 100644 index 0000000..6a49cac --- /dev/null +++ b/basedProject/bin/data/settings_night2.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<map4> + <view> + <settings x="0.000000" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="16.700001" roll="179.433685" targX="36.859554" targY="110.351402" targZ="-1.046636" lat="-37.442215" lng="-548.214722" dolly="1531.048462" /> + </view> + <view> + <settings x="0.333300" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="19.128784" roll="182.087463" targX="135.739166" targY="113.458458" targZ="0.117859" lat="-38.638939" lng="-339.898407" dolly="1374.356323" /> + </view> + <view> + <settings x="0.666600" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="16.700001" roll="185.134155" targX="87.895744" targY="113.270470" targZ="0.000000" lat="-30.503448" lng="-791.402466" dolly="1573.941772" /> + </view> +</map4> diff --git a/basedProject/bin/data/settings_opening_night.xml b/basedProject/bin/data/settings_opening_night.xml new file mode 100644 index 0000000..188d1f9 --- /dev/null +++ b/basedProject/bin/data/settings_opening_night.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<map4> + <view> + <settings x="0.000000" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="20.962236" roll="164.348434" targX="35.576481" targY="76.392937" targZ="-1.046636" lat="7.370702" lng="-549.137817" dolly="1392.942383" /> + </view> + <view> + <settings x="0.333300" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="19.607670" roll="197.857407" targX="86.775124" targY="94.408981" targZ="0.117859" lat="16.600668" lng="-388.608124" dolly="1406.843872" /> + </view> + <view> + <settings x="0.666600" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="22.156588" roll="186.333176" targX="67.420944" targY="74.653236" targZ="0.000000" lat="30.607965" lng="-284.483551" dolly="1277.667603" /> + </view> +</map4> diff --git a/basedProject/bin/data/settings_stage1.xml b/basedProject/bin/data/settings_stage1.xml new file mode 100644 index 0000000..c0b0e75 --- /dev/null +++ b/basedProject/bin/data/settings_stage1.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<map4> + <view> + <settings x="0.000000" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="15.650028" roll="180.000000" targX="39.801361" targY="76.392937" targZ="-1.046636" lat="7.370702" lng="-549.137817" dolly="1450.000000" /> + </view> + <view> + <settings x="0.333300" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="15.650049" roll="180.000000" targX="91.000008" targY="94.408981" targZ="0.117859" lat="16.600668" lng="-388.608124" dolly="1500.000000" /> + </view> + <view> + <settings x="0.666600" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="16.706652" roll="185.070496" targX="70.420288" targY="100.309235" targZ="0.000000" lat="-35.397739" lng="-792.843933" dolly="1521.202759" /> + </view> +</map4> diff --git a/basedProject/bin/data/settings_starting.xml b/basedProject/bin/data/settings_starting.xml new file mode 100644 index 0000000..68db24d --- /dev/null +++ b/basedProject/bin/data/settings_starting.xml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<map4> + <view> + <settings x="0.000000" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="17.25" roll="180" targX="35.576481" targY="76.392937" targZ="-1.046636" lat="7.370702" lng="-549.137817" dolly="1450" /> + </view> + <view> + <settings x="0.333300" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="17.25" roll="180" targX="86.775124" targY="94.408981" targZ="0.117859" lat="16.600668" lng="-388.608124" dolly="1500" /> + </view> + <view> + <settings x="0.666600" y="0.000000" w="0.333300" h="1.000000" distort="0.000000" fov="17.25" roll="180" targX="67.420944" targY="74.653236" targZ="0.000000" lat="30.607965" lng="-284.483551" dolly="1500" /> + </view> +</map4> diff --git a/basedProject/src/audioGlitcher.h b/basedProject/src/audioGlitcher.h index 8f48288..130abcf 100644 --- a/basedProject/src/audioGlitcher.h +++ b/basedProject/src/audioGlitcher.h @@ -68,7 +68,7 @@ class audioGlitcher { //transform the low res matrix float tX=trans_x-.05; //fraction of image - float tY=trans_y-.04; //fraction of image + float tY=trans_y-.08; //fraction of image float oX=origin_x; //fraction of image float oY=origin_y; //fraction of image float s=scale; diff --git a/basedProject/src/ofApp.cpp b/basedProject/src/ofApp.cpp index 1b2a074..86c50a7 100644 --- a/basedProject/src/ofApp.cpp +++ b/basedProject/src/ofApp.cpp @@ -1,7 +1,7 @@ #include "ofApp.h" //-------------------------------------------------------------- ofApp::~ofApp(){ - saveSettings("settings.xml"); + //saveSettings("settings.xml"); } //-------------------------------------------------------------- @@ -12,9 +12,11 @@ void ofApp::setup() { ///ofSetVerticalSync(true); + + //some model / light stuff /* - glEnable (GL_DEPTH_TEST); + glShadeModel (GL_SMOOTH); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); glEnable (GL_COLOR_MATERIAL); @@ -26,30 +28,95 @@ void ofApp::setup() { fullscreen=false; activeView=0; - xhair.loadImage("crosshairs.png"); + checkers=new ofImage[3]; + + checkers[0].loadImage("checker_blue.png"); + checkers[1].loadImage("checker_green.png"); + checkers[2].loadImage("checker_red.png"); - int bufferSize= 512; //should be based on the size of glitch buffer + int bufferSize= beat.getBufferSize(); //should be based on the size of glitch buffer soundStream.listDevices(); //nb all you have to do to make audio work is to turn off pulseaudio in configuration - soundStream.setup(this, 0, 1, 44100, bufferSize, 1); + soundStream.setup(this, 0, 1, 44100, bufferSize, 4); + samples.resize(bufferSize); - glitch.setup(512,384,&samples); - glitch.set_interp(ofRandom(30)+2,ofRandom(22)+2); + glitch1.setup(512,384,&samples); + glitch2.setup(512,384,&samples); + glitch3.setup(512,384,&samples); + + mode=MODE_RUN; + + kick=snare=hihat=false; + } //-------------------------------------------------------------- void ofApp::update() { ofSetWindowTitle(ofToString(ofGetFrameRate())); - glitch.update(); + if (mode==MODE_RUN){ + + beat.update(ofGetElapsedTimeMillis()); + + + //if (ofRandom(10000)<3) glitch1.set_interp(ofRandom(18)+2,ofRandom(14)+2); + //if (ofRandom(10000)<8) glitch2.set_interp(ofRandom(18)+2,ofRandom(14)+2); + //if (ofRandom(10000)<20) glitch3.set_interp(ofRandom(18)+2,ofRandom(14)+2); + if (beat.kick()>0.9){ + if (!kick){ + int which=ofRandom(3); + switch (which) { + case 0: + glitch1.set_interp(ofRandom(18)+2,ofRandom(14)+2); + break; + case 1: + glitch2.set_interp(ofRandom(18)+2,ofRandom(14)+2); + break; + case 2: + glitch3.set_interp(ofRandom(18)+2,ofRandom(14)+2); + break; + } + kick=true; + } + } + else { + if (kick) kick=false; + } + + if (beat.snare()>0.9){ + if (!snare){ + int which=ofRandom(3); + switch (which) { + case 0: + glitch1.set_scale((ofRandom(100)*.002)+1.0); + break; + case 1: + glitch2.set_scale((ofRandom(100)*.002)+1.0); + break; + case 2: + glitch3.set_scale((ofRandom(100)*.002)+1.0); + break; + } + snare=true; + } + } + else { + if (snare) snare=false; + } + + glitch1.update(); + glitch2.update(); + glitch3.update(); + } } void ofApp::audioIn(float * input, int bufferSize, int nChannels){ for (int i=0;i<bufferSize/nChannels;i+=nChannels){ samples[i]=input[i*nChannels]; } + beat.audioReceived(input, bufferSize, nChannels); } //-------------------------------------------------------------- @@ -57,6 +124,21 @@ void ofApp::draw() { //ofSetColor(255,255, 255); //glitch.draw(0,0); + ofBaseHasTexture *texts[3]; + + switch(mode) { + case MODE_RUN: + texts[0]=&glitch1.renderFBO; + texts[1]=&glitch2.renderFBO; + texts[2]=&glitch3.renderFBO; + break; + case MODE_CALIB: + texts[0]=&checkers[0]; + texts[1]=&checkers[1]; + texts[2]=&checkers[2]; + break; + } + for (int i=0;i<views.size();i++) { views[i].setLight(); } @@ -66,25 +148,20 @@ void ofApp::draw() { ofFill(); - //glitch.renderFBO. - //xhair.getTextureReference().bind(); - bindTexture(glitch.renderFBO); - //ofEnableAlphaBlending(); - //ofSetColor(0, 0, 255, 255); + + bindTexture(*texts[0]); ofDrawSphere(0,0,0,145); - //ofSpherePrimitive s=ofSpherePrimitive(145,50); - //s.enableTextures(); - //s.draw(); - //ofSetColor(0, 255, 0, 255); - ofDrawSphere(200,0,230,75); - //ofSetColor(255, 0,0, 255); - ofDrawSphere(-60,-190,280,47.5); - //ofSetColor(255, 255,255, 255); - //xhair.draw(0,0,views[i].getWidth(),views[i].getHeight()); - //glitch.renderFBO. - //xhair.getTextureReference().unbind(); - unbindTexture(glitch.renderFBO); - //views[i].end2d(); + unbindTexture(*texts[0]); + + bindTexture(*texts[1]); + ofDrawSphere(200,290,0,75); + unbindTexture(*texts[1]); + + bindTexture(*texts[2]); + ofDrawSphere(-70,340,175,44); + unbindTexture(*texts[2]); + ofSetColor(255, 255,255); + views[i].end(); } @@ -131,19 +208,20 @@ void ofApp::keyPressed(int key){ case 'z': loadSettings("defaults.xml"); break; - case ',': - case '<': - //prevMovie(); + case OF_KEY_LEFT: + mode=mode-1; + if (mode<0) mode=NUM_MODES-1; break; - case '.': - case '>': - //nextMovie(); + case OF_KEY_RIGHT: + mode=(mode+1)%NUM_MODES; break; case '/': //light=!light; //printf(light?"LIGHT ON\n":"LIGHT OFF\n"); break; } + if (mode==MODE_RUN) glDisable (GL_DEPTH_TEST); + else glEnable (GL_DEPTH_TEST); } void ofApp::keyReleased(int key){ diff --git a/basedProject/src/ofApp.h b/basedProject/src/ofApp.h index 3e45838..f1ab52a 100644 --- a/basedProject/src/ofApp.h +++ b/basedProject/src/ofApp.h @@ -30,12 +30,17 @@ have to track how many frames each key has been pressed for #include "ofEvents.h" #include "ofxXmlSettings.h" //#include "ofx3DModelLoader.h" +#include "ofxBeat.h" #include "mapUtils.h" #include "viewpoint.h" #include "audioGlitcher.h" +#define NUM_MODES 2 +#define MODE_RUN 0 +#define MODE_CALIB 1 + class ofApp : public ofBaseApp{ @@ -57,13 +62,19 @@ class ofApp : public ofBaseApp{ int activeView; bool fullscreen; - ofImage xhair; + ofImage *checkers; void audioIn(float * input, int bufferSize, int nChannels); - audioGlitcher glitch; + audioGlitcher glitch1; + audioGlitcher glitch2; + audioGlitcher glitch3; ofSoundStream soundStream; vector<float> samples; + int mode; + + ofxBeat beat; + bool kick,snare,hihat; }; diff --git a/basedProject/src/viewpoint.cpp b/basedProject/src/viewpoint.cpp index 85a3bf5..15424ed 100644 --- a/basedProject/src/viewpoint.cpp +++ b/basedProject/src/viewpoint.cpp @@ -57,9 +57,11 @@ void viewpoint::setLight(){ ofNode c=ofNode(); ofNode t=ofNode(); t.setParent(c); - t.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal()); + //make target controls relative to rotation c.rotate(vars[5].getVal(), ofVec3f(0, 1, 0)); + //changed order 27021 + t.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal()); target.setPosition(t.getGlobalPosition()); //camera.orbit(vars[5].getVal(), vars[4].getVal(), vars[7].getVal(), target); |
