diff options
Diffstat (limited to 'gui/src/ofApp.cpp')
| -rw-r--r-- | gui/src/ofApp.cpp | 57 |
1 files changed, 54 insertions, 3 deletions
diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp index 8c42309..ecea8d8 100644 --- a/gui/src/ofApp.cpp +++ b/gui/src/ofApp.cpp @@ -47,6 +47,12 @@ void ofApp::setup(){ gui.add(segmenter_speed.setup("segmenter speed", 0.2, -1.0, 1.0)); gui.add(segmenter_length.setup("segmenter length", 0.2, 0.0, 1.0)); gui.add(segmenter_number.setup("segmenter number", 1, 1, 8)); + gui.add(use_rotate.setup("XF rotate", false)); + gui.add(xf_rotate.setup("rotate speed", 0.0, -1.0, 1.0)); + gui.add(use_scale.setup("XF scale", false)); + gui.add(xf_scale_speed.setup("scale speed", 0.0, 0.0, 1.0)); + gui.add(xf_scale_min.setup("scale min", 0.0, 0.0, 1.0)); + gui.add(xf_scale_max.setup("scale max", 0.0, 0.0, 1.0)); framecounter=0; @@ -58,6 +64,8 @@ void ofApp::setup(){ //======================================= //positioning interface + safety_frame.addVertex(0,0); //etc + bShowPositionInterface=false; bOutputSelected=false; @@ -399,7 +407,10 @@ void ofApp::drawOutput(ofEventArgs & args){ vector <colourPolyline> polyOutput; - phase=fmod(phase+((ofGetElapsedTimef()-prev_time)*segmenter_speed),1); + float interval=ofGetElapsedTimef()-prev_time; + rotate_amt+=interval*xf_rotate*5; + + phase=fmod(phase+(interval*segmenter_speed),1); prev_time=ofGetElapsedTimef(); while (phase<0.0f) { @@ -525,13 +536,28 @@ void ofApp::drawOutput(ofEventArgs & args){ } } + vector <colourPolyline> transformedOutput; + + if (use_rotate||use_scale){ + ofMatrix4x4 rm = ofMatrix4x4::newIdentityMatrix(); + rm.translate(-outputWindowSize.x/2,-outputWindowSize.y/2,0); + rm.rotateRad(rotate_amt,0,0,1); + rm.translate(outputWindowSize.x/2,outputWindowSize.y/2,0); + for (auto& shape:polyOutput){ + transformedOutput.push_back(lineTransformer::polyLineTransform(rm,shape)); + } + } + else { + transformedOutput=polyOutput; + } + vector <colourPolyline> clippedOutput; if (mask.size()&&use_mask){ clipper.Clear(); clipper.addPolylines(mask, ClipperLib::ptClip); vector <ofPolyline> shapes; //TODO make clipper clip colourpolylines - for (auto& poly: polyOutput) + for (auto& poly: transformedOutput) { shapes.push_back(poly); } @@ -549,7 +575,7 @@ void ofApp::drawOutput(ofEventArgs & args){ } } else { - clippedOutput=polyOutput; + clippedOutput=transformedOutput; } glm::vec2 src[]={ @@ -851,6 +877,7 @@ void ofApp::dragEvent(ofDragInfo dragInfo){ void ofApp::newMidiMessage(ofxMidiMessage& msg) { //column 0 for general controls + //printf("Midi: %i %i %i\n",msg.channel,msg.control,msg.value); int offset; @@ -859,9 +886,15 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { if (msg.channel==1&&msg.control==1+offset){ //pot + xf_rotate=(((float)msg.value)/64.0f)-1.0f; + } + if (msg.channel==1&&msg.control==33+offset){ + //pot button + use_rotate=use_rotate?false:true; } if (msg.channel==1&&msg.control==65+offset){ //top button + rotate_amt=ofRandom(5.0f); } if (msg.channel==1&&msg.control==73+offset){ //bottom button @@ -876,6 +909,10 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { if (msg.channel==1&&msg.control==1+offset){ //pot + xf_scale_speed=(((float)msg.value)/128.0f); + } + if (msg.channel==1&&msg.control==33+offset){ + //pot button } if (msg.channel==1&&msg.control==65+offset){ //top button @@ -893,6 +930,10 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { if (msg.channel==1&&msg.control==1+offset){ //pot + xf_scale_min=(((float)msg.value)/128.0f); + } + if (msg.channel==1&&msg.control==33+offset){ + //pot button } if (msg.channel==1&&msg.control==65+offset){ //top button @@ -910,6 +951,10 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { if (msg.channel==1&&msg.control==1+offset){ //pot + xf_scale_max=(((float)msg.value)/128.0f); + } + if (msg.channel==1&&msg.control==33+offset){ + //pot button } if (msg.channel==1&&msg.control==65+offset){ //top button @@ -928,6 +973,9 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { if (msg.channel==1&&msg.control==1+offset){ //pot } + if (msg.channel==1&&msg.control==33+offset){ + //pot button + } if (msg.channel==1&&msg.control==65+offset){ //top button } @@ -945,6 +993,9 @@ void ofApp::newMidiMessage(ofxMidiMessage& msg) { if (msg.channel==1&&msg.control==1+offset){ //pot } + if (msg.channel==1&&msg.control==33+offset){ + //pot button + } if (msg.channel==1&&msg.control==65+offset){ //top button } |
