diff options
Diffstat (limited to 'gistanalysis')
| -rw-r--r-- | gistanalysis/notes | 15 | ||||
| -rw-r--r-- | gistanalysis/src/main.cpp | 4 | ||||
| -rw-r--r-- | gistanalysis/src/ofApp.cpp | 84 | ||||
| -rw-r--r-- | gistanalysis/src/ofApp.h | 19 |
4 files changed, 107 insertions, 15 deletions
diff --git a/gistanalysis/notes b/gistanalysis/notes index e55b867..d7ab8ad 100644 --- a/gistanalysis/notes +++ b/gistanalysis/notes @@ -79,8 +79,17 @@ n- scriptable transforms - fix length overlap - some kind of svg thing for ambulance with audio animation -scale isn't scaling from centre -rotate isn't working at all - +scale isn't scaling from centre - move evrything to centre and use centre feature of ofxHelios +add a master scale +X rotate isn't working at all +set modifiers for transformations to animate need to hook up midi + +1. get full control of placement and sizing - set up mapping framework +2. get a full, smooth waveform working +3. apply segmenter +4. animate origin and output seperately - tv hold effects +5. hook up to midi - get controller + + diff --git a/gistanalysis/src/main.cpp b/gistanalysis/src/main.cpp index 1abb772..88fea88 100644 --- a/gistanalysis/src/main.cpp +++ b/gistanalysis/src/main.cpp @@ -9,8 +9,8 @@ int main(int argc, char *argv[]){ settings.decorated = true; - settings.width = 1024; - settings.height = 768 ; + settings.width = 2048; + settings.height = 1532; settings.setPosition(ofVec2f(1700,0)); settings.resizable = false; diff --git a/gistanalysis/src/ofApp.cpp b/gistanalysis/src/ofApp.cpp index d5fdf65..43c6f29 100644 --- a/gistanalysis/src/ofApp.cpp +++ b/gistanalysis/src/ofApp.cpp @@ -64,7 +64,7 @@ void ofApp::setup(){ - chaosgui.setup("chaos","",230,10); // most of the time you don't need a name but don't forget to call setup + chaosgui.setup("chaos","",230,10); chaosgui.add(plotter.usechaos.set("use",false)); chaosgui.add(plotter.chaosamount.set("amount", 0.5f, 0.0f, 1.0f)); chaosgui.add(plotter.chaos_a.set("a", 0.85f, 0.0f, 10.0f)); @@ -72,6 +72,12 @@ void ofApp::setup(){ chaosgui.add(plotter.chaos_k.set("k", 0.4f, 0.0f, 10.0f)); chaosgui.add(plotter.chaos_p.set("p", 7.7f, 0.0f, 10.0f)); + lasergui.setup("laser","",230,200); + lasergui.add(drawWarpFrame.set("show warp", false)); + lasergui.add(intensity.set("intensity", 30, 0, 255)); + lasergui.add(subdivide.set("subdivide", 15, 1, 100)); + lasergui.add(blank_num.set("blank points", 8, 0, 32)); + lasergui.add(max_angle.set("max angle", 15.0f, 1.0f, 90.0f)); /* //add special crest graph ofxHistoryPlot*crest = addGraph("CREST_AVG",1.0,ofColor(ofRandom(100)+150,ofRandom(100)+150,ofRandom(100)+150)); @@ -199,6 +205,7 @@ void ofApp::draw(){ ofBackground(0); gui.draw(); chaosgui.draw(); + lasergui.draw(); } //-------------------------------------------------------------- void ofApp::drawOutput(ofEventArgs & args){ @@ -299,26 +306,83 @@ void ofApp::drawOutput(ofEventArgs & args){ */ + //ofLoadIdentityMatrix(); - ofMatrix4x4 t; t.makeTranslationMatrix(xform->x,xform->y,0); ofMatrix4x4 r; - r.makeRotationMatrix(rotate,ofVec3f(0,1,07)); + r.makeRotationMatrix(rotate,0,0,1); ofMatrix4x4 s; - r.makeScaleMatrix(scale->x,scale->y,1.0f); + s.makeScaleMatrix(scale->x,scale->y,1.0f); - ofMatrix4x4 x=s*r*t; + ofMatrix4x4 x=r*t*s; vector <colourPolyline> lines=plotter.output(x,scalePlot,decayPlot); - int num=laser.draw(lines,30); - ofTranslate(0,ofGetHeight()/2); - - for (auto line=lines.begin();line!=lines.end();line++){ - line->draw(); +//PROJECTION MAPPING +//how best to move this to it's own class? + + glm::vec2 src[]={ + glm::vec2(0,0), + glm::vec2(ofGetWidth(),0), + glm::vec2(ofGetWidth(),ofGetWidth()), + glm::vec2(0,ofGetHeight()) + }; + + glm::vec2 mp=glm::vec2(ofGetWidth()/2,ofGetWidth()/2); + + glm::vec2 scaled_dest[]={ + ((warpframe[0]-mp)*outputScale)+mp, + ((warpframe[1]-mp)*outputScale)+mp, + ((warpframe[2]-mp)*outputScale)+mp, + ((warpframe[3]-mp)*outputScale)+mp + }; + + ofMatrix4x4 scaled_warp =lineTransformer::getPerspectiveTransformMatrix(src,scaled_dest); + ofMatrix4x4 warp =lineTransformer::getPerspectiveTransformMatrix(src,warpframe); + + vector <colourPolyline> warpedOutput; + vector <colourPolyline> scaledWarpedOutput; + + for (auto s:lines){ + warpedOutput.push_back(lineTransformer::polyLineTransform(warp,s)); + scaledWarpedOutput.push_back(lineTransformer::polyLineTransform(scaled_warp,s)); } + +//PREVIEW + + //ofTranslate(0,ofGetHeight()/2); + //for (auto& line:lines){ + // line->draw(); + //} + + int pnum=0; + + for (auto& shape:warpedOutput){ + shape.draw(); + pnum+=shape.size(); + } + + if (drawWarpFrame){ + lineTransformer::drawWarpFrame(warpframe); + } + +//LASER + + laser.set_subdivide(subdivide); + laser.set_blanknum(blank_num); + laser.set_maxangle(max_angle); + + laser.set_intensity(intensity); + + //int num=laser.draw(lines,30); + + int num=laser.draw(scaledWarpedOutput); + + + + ofSetWindowTitle(ofToString(ofGetFrameRate())+" fps, "+ofToString(num)+" pts"); } diff --git a/gistanalysis/src/ofApp.h b/gistanalysis/src/ofApp.h index 961fcc4..11ddbb6 100644 --- a/gistanalysis/src/ofApp.h +++ b/gistanalysis/src/ofApp.h @@ -19,6 +19,8 @@ #include "ofxHistoryPlot.h" #include "ofxGist.h" +//audioplot draws from 0 to ofGetWidth +//change to -ofGetWidth/2 to ofGetWidth/2 class Audioplotter{ //store and draw a numbr of audio samples @@ -242,5 +244,22 @@ class ofApp : public ofBaseApp, public ofxMidiListener{ ofParameter<ofVec2f> scale; ofxPanel chaosgui; + + ofxPanel lasergui; + ofParameter<int> intensity; + ofParameter<int> subdivide; + ofParameter<int> blank_num; + ofParameter<float> max_angle; + + //======================================= //positioning interface + + ofParameter<bool> drawWarpFrame; + + glm::vec2 warpframe[4]; + int select_warpframe; + + float outputScale; + + }; |
