diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib index f67f171..c0eb44e 100644 Binary files a/of/Active Tripod/bin/Active_Tripod.lib and b/of/Active Tripod/bin/Active_Tripod.lib differ diff --git a/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml index 44e7a76..09efc90 100644 --- a/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml @@ -51,7 +51,7 @@ 4 Alpha . - 255.000000000 + 207.187500000 4 diff --git a/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml index 973d0d7..1a411e3 100644 --- a/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml @@ -6,7 +6,12 @@ 4 Line width - 25.661184311 + 7.286184311 + + + 4 + Graph Height Max + 443.421051025 4 @@ -26,7 +31,7 @@ 4 Data0 alpha - 230.674346924 + 155.180923462 4 @@ -46,5 +51,5 @@ 4 Data1 alpha - 185.378295898 + 170.279602051 diff --git a/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml index 65a6ee7..1908c35 100644 --- a/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml @@ -1,7 +1,7 @@ 2 Toggle Data Simulation - 1 + 0 4 diff --git a/of/Active Tripod/src/data/DataManager.cpp b/of/Active Tripod/src/data/DataManager.cpp index faf8642..8592abd 100644 --- a/of/Active Tripod/src/data/DataManager.cpp +++ b/of/Active Tripod/src/data/DataManager.cpp @@ -77,7 +77,7 @@ void DataManager::update() { isPublisher0DataReceived = false; isPublisher1DataReceived = false; - app->scene.activeGraph->addNewData(newData); + app->scene.addNewData(newData); } } } @@ -122,10 +122,10 @@ void DataManager::onMessage( Spacebrew::Message & m ) printf("- - min = %s\n", data[i].substr(4, -1).c_str()); dataObject.min = ofToFloat(data[i].substr(4, -1).c_str()); } - if (data[i].substr(0, 5) == " max:") + if (data[i].substr(0, 4) == "max:") { - printf("- - max = %s\n", data[i].substr(5, -1).c_str()); - dataObject.max = ofToFloat(data[i].substr(5, -1).c_str()); + printf("- - max = %s\n", data[i].substr(4, -1).c_str()); + dataObject.max = ofToFloat(data[i].substr(4, -1).c_str()); } } diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp index f9f355d..6529621 100644 --- a/of/Active Tripod/src/gui/GUI.cpp +++ b/of/Active Tripod/src/gui/GUI.cpp @@ -80,12 +80,13 @@ void GUI::addBarGraphDesignGUI() gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.barGraph.graphItemXGap, length, dim); gui->addSlider("BarWidth", 2, 50, &app->scene.barGraph.barWidth, length, dim); gui->addSlider("Graph Height Max", 100, 1000, &app->scene.barGraph.graphHeightMax, length, dim); - + gui->addSpacer(length, 1); gui->addSlider("Data0 red", 0, 255, &app->scene.barGraph.col0[0], length, dim); gui->addSlider("Data0 green", 0, 255, &app->scene.barGraph.col0[1], length, dim); gui->addSlider("Data0 blue", 0, 255, &app->scene.barGraph.col0[2], length, dim); gui->addSlider("Data0 alpha", 0, 255, &app->scene.barGraph.col0[3], length, dim); + gui->addSpacer(length, 1); gui->addSlider("Data1 red", 0, 255, &app->scene.barGraph.col1[0], length, dim); gui->addSlider("Data1 green", 0, 255, &app->scene.barGraph.col1[1], length, dim); gui->addSlider("Data1 blue", 0, 255, &app->scene.barGraph.col1[2], length, dim); @@ -102,11 +103,14 @@ void GUI::addBodyGraphDesignGUI() gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.bodyGraph.graphItemXGap, length, dim); gui->addSlider("Line width", 1, 50, &app->scene.bodyGraph.lineWidth, length, dim); + gui->addSlider("Graph Height Max", 100, 1000, &app->scene.bodyGraph.graphHeightMax, length, dim); + gui->addSpacer(length, 1); gui->addSlider("Data0 red", 0, 255, &app->scene.bodyGraph.col0[0], length, dim); gui->addSlider("Data0 green", 0, 255, &app->scene.bodyGraph.col0[1], length, dim); gui->addSlider("Data0 blue", 0, 255, &app->scene.bodyGraph.col0[2], length, dim); gui->addSlider("Data0 alpha", 0, 255, &app->scene.bodyGraph.col0[3], length, dim); + gui->addSpacer(length, 1); gui->addSlider("Data1 red", 0, 255, &app->scene.bodyGraph.col1[0], length, dim); gui->addSlider("Data1 green", 0, 255, &app->scene.bodyGraph.col1[1], length, dim); gui->addSlider("Data1 blue", 0, 255, &app->scene.bodyGraph.col1[2], length, dim); diff --git a/of/Active Tripod/src/testApp.cpp b/of/Active Tripod/src/testApp.cpp index fcab03d..f15f4a8 100644 --- a/of/Active Tripod/src/testApp.cpp +++ b/of/Active Tripod/src/testApp.cpp @@ -2,31 +2,14 @@ // TODO // ==== -// -// - Map graph min/max -// - Stop graph going beyond 80% of the screen -// - Add separate colour sliders for body graph -// - In body graph use one long line instead of loads of lines -// - Make 2nd graph - body -// - Make 3rd graph - separate fade -// - Add colour boxes to text - DON'T use graph colours - add sliders -// - Crosshairs in HUD // - Add video camera feed -// - Create text parsing system -// - Tidy up the first graph -// - Create animation system +// - Add colour boxes to text // - Make system to slow down data - The screen should show 15-20 minutes worth of data +// - Make 3rd graph - separate fade +// - Crosshairs in HUD +// - Create graph animation system // - Create a single config file to be loaded from online location. It will contain IP address and host name // -// -// -// -// NOTES -// ===== -// - Check that the local data sources always have the same amount of data. - - - //-------------------------------------------------------------- void testApp::setup() { @@ -45,7 +28,7 @@ void testApp::setup() isPaused = false; } -//-------------------------------------------------------------- + void testApp::update() { if (isPaused) return; @@ -54,7 +37,7 @@ void testApp::update() scene.update(); } -//-------------------------------------------------------------- + void testApp::draw() { dataManager.draw(); @@ -62,7 +45,6 @@ void testApp::draw() } -//-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button) { diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp index 8597358..797d841 100644 --- a/of/Active Tripod/src/visual/Scene.cpp +++ b/of/Active Tripod/src/visual/Scene.cpp @@ -132,6 +132,12 @@ void Scene::drawTextBox(string copy, string align) } +void Scene::addNewData(vector newData) +{ + barGraph.addNewData(newData); + bodyGraph.addNewData(newData); +} + void Scene::keyPressed(int key) { diff --git a/of/Active Tripod/src/visual/Scene.h b/of/Active Tripod/src/visual/Scene.h index 5e5950d..c403f00 100644 --- a/of/Active Tripod/src/visual/Scene.h +++ b/of/Active Tripod/src/visual/Scene.h @@ -11,6 +11,7 @@ #include "ofMain.h" #include "BarGraph.h" #include "BodyGraph.h" +#include "DataManager.h" #include "ofxFTGL.h" class testApp; @@ -25,6 +26,7 @@ public: void drawHUDBG(); void drawHUDCopy(); void drawTextBox(string copy, string align); + void addNewData(vector newData); void keyPressed(int key); BarGraph barGraph; diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.cpp b/of/Active Tripod/src/visual/graph/BodyGraph.cpp index 8a8e9db..716f8bc 100644 --- a/of/Active Tripod/src/visual/graph/BodyGraph.cpp +++ b/of/Active Tripod/src/visual/graph/BodyGraph.cpp @@ -33,13 +33,24 @@ void BodyGraph::draw() // ofPopStyle(); //} + + float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent; + float outputMin = (ofGetHeight() * 0.5) - graphHeightMax; + float outputMax = (ofGetHeight() * 0.5) + graphHeightMax; + // draw main part of graph (body) ofMesh body; body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP); for (int i = 0; i < publisher0Data.size() - 1; i++) { - //body.addVertex(ofVec3f(i * graphItemXGap, publisher0Data[i], 0)); - //body.addVertex(ofVec3f(i * graphItemXGap, publisher1Data[i], 0)); + body.addVertex(ofVec3f( + i * graphItemXGap + xOffset, + ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax), + 0)); + body.addVertex(ofVec3f( + i * graphItemXGap + xOffset, + ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax), + 0)); body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3])); body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3])); @@ -48,20 +59,31 @@ void BodyGraph::draw() body.drawFaces(); + // draw lines + ofPushStyle(); + ofPolyline poly0; + ofPolyline poly1; for (int i = 0; i < publisher0Data.size() - 1; i++) { - if (i < publisher0Data.size() - 2) + if (i < publisher0Data.size() - 1) { - //ofPushStyle(); - //ofSetLineWidth(lineWidth); - //ofSetColor(col0[0],col0[1],col0[2], 255); - //ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]); - //ofSetColor(col1[0],col1[1],col1[2], 255); - //ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]); - //ofPopStyle(); + ofSetLineWidth(lineWidth); + poly0.addVertex(ofPoint( + i * graphItemXGap + xOffset, + ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax))); + + + poly1.addVertex(ofPoint( + i * graphItemXGap + xOffset, + ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax))); } } - + + ofSetColor(col0[0],col0[1],col0[2], 255); + poly0.draw(); + ofSetColor(col1[0],col1[1],col1[2], 255); + poly1.draw(); + ofPopStyle(); } }