diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib index 66a1d2f..d300a21 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/BAR GRAPH DESIGNguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml index 1828f4f..1380609 100644 --- a/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml @@ -1,18 +1,23 @@ 4 Graph Item X Gap - 13.733552933 + 11.809210777 4 BarWidth - 8.157895088 + 5.631578922 4 Graph Height Max 440.460510254 + + 4 + Data send speed (seconds) + 4.944078445 + 4 Data0 red 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 ab8a49f..d575b63 100644 --- a/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml @@ -11,18 +11,23 @@ 4 Graph Item X Gap - 7.220395088 + 6.332236767 4 Line width - 7.286184311 + 6.157894611 4 Graph Height Max 443.421051025 + + 4 + Data send speed (seconds) + 4.027631760 + 4 Data0 red diff --git a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml index 8a017a7..c6f6fce 100644 --- a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml @@ -1,12 +1,12 @@ 2 Bar graph - 0 + 1 2 Solid Body graph - 1 + 0 2 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 ca14807..3181095 100644 --- a/of/Active Tripod/src/data/DataManager.cpp +++ b/of/Active Tripod/src/data/DataManager.cpp @@ -21,10 +21,12 @@ void DataManager::setup() newData.resize(2); - isPublisher0DataReceived = false; - isPublisher1DataReceived = false; + //isPublisher0DataReceived = false; + //isPublisher1DataReceived = false; setupSpacebrew(); + + nextDataSendTime = 0.1; } @@ -73,11 +75,18 @@ void DataManager::update() } else { - if (isPublisher0DataReceived && isPublisher1DataReceived) + /*if (isPublisher0DataReceived && isPublisher1DataReceived) { isPublisher0DataReceived = false; isPublisher1DataReceived = false; app->scene.addNewData(newData); + }*/ + + //sendDataSpeed = app->scene.activeGraph->sendDataSpeed; + if (ofGetElapsedTimef() >= nextDataSendTime + app->scene.activeGraph->sendDataSpeed) + { + nextDataSendTime += app->scene.activeGraph->sendDataSpeed; + app->scene.addNewData(newData); } } } @@ -132,12 +141,12 @@ void DataManager::onMessage( Spacebrew::Message & m ) if (m.name == publisher0Name) { - isPublisher0DataReceived = true; + //isPublisher0DataReceived = true; newData[0] = dataObject; } else if (m.name == publisher1Name) { - isPublisher1DataReceived = true; + //isPublisher1DataReceived = true; newData[1] = dataObject; } } diff --git a/of/Active Tripod/src/data/DataManager.h b/of/Active Tripod/src/data/DataManager.h index 4b17903..87f8daa 100644 --- a/of/Active Tripod/src/data/DataManager.h +++ b/of/Active Tripod/src/data/DataManager.h @@ -26,6 +26,9 @@ class DataManager void update(); void draw(); vector explode( const string &delimiter, const string &str); + + // listen to spacebrew Messages + void onMessage( Spacebrew::Message & m ); testApp* app; @@ -39,14 +42,13 @@ class DataManager vector newData; - bool isPublisher0DataReceived; - bool isPublisher1DataReceived; + //bool isPublisher0DataReceived; + //bool isPublisher1DataReceived; bool isDataSimulated; float perlinXScale; float perlinYScale; float simulationSpeed; - - // listen to spacebrew Messages - void onMessage( Spacebrew::Message & m ); + + float nextDataSendTime; }; diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp index ea2c87a..a5687b1 100644 --- a/of/Active Tripod/src/gui/GUI.cpp +++ b/of/Active Tripod/src/gui/GUI.cpp @@ -81,6 +81,7 @@ 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->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.barGraph.sendDataSpeed, length, dim); gui->addSpacer(length, 1); gui->addSlider("Data0 red", 0, 255, &app->scene.barGraph.col0[0], length, dim); @@ -108,6 +109,7 @@ 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->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.bodyGraph.sendDataSpeed, length, dim); gui->addSpacer(length, 1); gui->addSlider("Data0 red", 0, 255, &app->scene.bodyGraph.col0[0], length, dim); diff --git a/of/Active Tripod/src/testApp.cpp b/of/Active Tripod/src/testApp.cpp index e9d7190..45a161b 100644 --- a/of/Active Tripod/src/testApp.cpp +++ b/of/Active Tripod/src/testApp.cpp @@ -2,13 +2,13 @@ // TODO // ==== -// - Add option to resize video draw size (rather than making it fullscreen) and init size // - 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 // - Add 'clear all data' button to UI +// - If min or max values change - clear graph - ask bout this // //-------------------------------------------------------------- void testApp::setup() @@ -35,6 +35,7 @@ void testApp::update() dataManager.update(); scene.update(); + //if (gui.isVisible()) } @@ -57,6 +58,8 @@ void testApp::keyPressed(int key) isPaused = !isPaused; else if (key == 'f') ofToggleFullscreen(); + else if (key == 'c') + scene.clearGraphData(); scene.keyPressed(key); } diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp index c4c6c70..ebfb0dc 100644 --- a/of/Active Tripod/src/visual/Scene.cpp +++ b/of/Active Tripod/src/visual/Scene.cpp @@ -208,4 +208,11 @@ void Scene::addNewData(vector newData) void Scene::keyPressed(int key) { +} + + +void Scene::clearGraphData() +{ + barGraph.clear(); + bodyGraph.clear(); } \ No newline at end of file diff --git a/of/Active Tripod/src/visual/Scene.h b/of/Active Tripod/src/visual/Scene.h index 23681c0..062c44c 100644 --- a/of/Active Tripod/src/visual/Scene.h +++ b/of/Active Tripod/src/visual/Scene.h @@ -28,7 +28,9 @@ public: void drawHUDColourBars(); void drawTextBox(string copy, string align); void addNewData(vector newData); + void clearGraphData(); void keyPressed(int key); + BarGraph barGraph; BodyGraph bodyGraph; diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp index 87cff5f..1d744e3 100644 --- a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp +++ b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp @@ -19,7 +19,8 @@ void AbstractGraph::setup() void AbstractGraph::update() { - + maxData = (ofGetWidth() * (AbstractGraph::maxGraphPercent - AbstractGraph::minGraphPercent)) / graphItemXGap; + printf("ofGetWidth():%i, maxData:%i, graphItemXGap:%f, screen active:%f \n", ofGetWidth(), maxData, graphItemXGap, (AbstractGraph::maxGraphPercent - AbstractGraph::minGraphPercent)); } @@ -34,11 +35,16 @@ void AbstractGraph::addNewData(vector newData) publisher0Data.push_back(newData[0]); publisher1Data.push_back(newData[1]); - maxData = (ofGetWidth() / graphItemXGap) * (AbstractGraph::maxGraphPercent - AbstractGraph::minGraphPercent); - while (publisher0Data.size() > maxData && publisher0Data.size() > maxData) { publisher0Data.erase(publisher0Data.begin()); publisher1Data.erase(publisher1Data.begin()); } +} + + +void AbstractGraph::clear() +{ + publisher0Data.clear(); + publisher1Data.clear(); } \ No newline at end of file diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.h b/of/Active Tripod/src/visual/graph/AbstractGraph.h index 6ad1b01..1cfa3ec 100644 --- a/of/Active Tripod/src/visual/graph/AbstractGraph.h +++ b/of/Active Tripod/src/visual/graph/AbstractGraph.h @@ -11,6 +11,7 @@ #include "ofMain.h" #include "DataManager.h" + class AbstractGraph { public: @@ -18,7 +19,8 @@ public: virtual void update(); virtual void draw(); virtual void addNewData(vector newData); - + void clear(); + vector publisher0Data; vector publisher1Data; int maxData; // calculated from graphWidth and graphItemXGap @@ -33,4 +35,7 @@ public: float col0[4]; float col1[4]; + string graphName; + float sendDataSpeed; + }; \ No newline at end of file diff --git a/of/Active Tripod/src/visual/graph/BarGraph.cpp b/of/Active Tripod/src/visual/graph/BarGraph.cpp index 88ea5ab..d6506d2 100644 --- a/of/Active Tripod/src/visual/graph/BarGraph.cpp +++ b/of/Active Tripod/src/visual/graph/BarGraph.cpp @@ -1,23 +1,29 @@ #include "BarGraph.h" +#include "testApp.h" void BarGraph::setup() { AbstractGraph::setup(); - + app = (testApp*)ofGetAppPtr(); graphItemXGap = 10; + graphName = "BAR"; } void BarGraph::update() { -// if (ofGetFrameNum() % 30 == 0) -// printf("publisher0Data.size():%i \n", publisher0Data.size()); + AbstractGraph::update(); } void BarGraph::draw() { - //printf("BarGraph::draw() - graphItemXGap = %f \n", graphItemXGap); + if (app->gui.getVisible()) + { + int timePerScreenfull = maxData * sendDataSpeed; + ofDrawBitmapString("Time to fill screen:" + ofToString(timePerScreenfull), 500, 150); + } + if (publisher0Data.size() > 1) { diff --git a/of/Active Tripod/src/visual/graph/BarGraph.h b/of/Active Tripod/src/visual/graph/BarGraph.h index 05d0bef..ff94387 100644 --- a/of/Active Tripod/src/visual/graph/BarGraph.h +++ b/of/Active Tripod/src/visual/graph/BarGraph.h @@ -3,6 +3,8 @@ #include "ofMain.h" #include "AbstractGraph.h" +class testApp; + class BarGraph : public AbstractGraph { public: @@ -10,9 +12,8 @@ public: virtual void update(); virtual void draw(); virtual void addNewData(vector newData); + + testApp *app; float barWidth; - - - }; \ No newline at end of file diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.cpp b/of/Active Tripod/src/visual/graph/BodyGraph.cpp index 7aa1527..249bddb 100644 --- a/of/Active Tripod/src/visual/graph/BodyGraph.cpp +++ b/of/Active Tripod/src/visual/graph/BodyGraph.cpp @@ -4,23 +4,32 @@ // #include "BodyGraph.h" +#include "testApp.h" void BodyGraph::setup() { AbstractGraph::setup(); + app = (testApp*)ofGetAppPtr(); + graphName = "BODY"; } void BodyGraph::update() { -// if (ofGetFrameNum() % 30 == 0) -// printf("publisher0Data.size():%i \n", publisher0Data.size()); -} + AbstractGraph::update(); +} void BodyGraph::draw() { + if (app->gui.getVisible()) + { + float timePerScreenfull = (float)maxData * sendDataSpeed; + printf("timePerScreenfull:%f, maxData:%i, sendDataSpeed:%f \n", timePerScreenfull, maxData, sendDataSpeed); + ofDrawBitmapString("Time to fill screen:" + ofToString(timePerScreenfull), 500, 150); + } + if (publisher0Data.size() > 1) { //for (int i = 0; i < publisher0Data.size() - 1; i++) diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.h b/of/Active Tripod/src/visual/graph/BodyGraph.h index f59e781..c6ee976 100644 --- a/of/Active Tripod/src/visual/graph/BodyGraph.h +++ b/of/Active Tripod/src/visual/graph/BodyGraph.h @@ -4,6 +4,8 @@ #include "ofMain.h" #include "AbstractGraph.h" +class testApp; + class BodyGraph : public AbstractGraph { public: @@ -11,6 +13,8 @@ public: virtual void update(); virtual void draw(); virtual void addNewData(vector newData); + + testApp *app; float barWidth; float lineWidth;