diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib index 75a6190..b550370 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 613d5f1..c7af8f9 100644 --- a/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml @@ -1,12 +1,12 @@ 4 Graph Item X Gap - 9.144737244 + 8.848684311 4 BarWidth - 15.894737244 + 6.263157845 4 @@ -16,7 +16,7 @@ 4 Data send speed (seconds) - 4.485855103 + 1.671052575 4 diff --git a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml index 9b630a1..8b92a28 100644 --- a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml @@ -27,12 +27,12 @@ 4 Decimal points 0 - 5.174342155 + 4.049342155 4 Decimal points 1 - 2.332236767 + 2.805921078 4 diff --git a/of/Active Tripod/bin/data/GUI/SEPARATE BODY GRAPH DESIGNguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/SEPARATE BODY GRAPH DESIGNguiPagesettings.xml index 8fadc04..29aea3a 100644 --- a/of/Active Tripod/bin/data/GUI/SEPARATE BODY GRAPH DESIGNguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/SEPARATE BODY GRAPH DESIGNguiPagesettings.xml @@ -26,7 +26,7 @@ 4 Data send speed (seconds) - 0.950986862 + 1.932894707 4 diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp index 6a0e7ed..5659ff4 100644 --- a/of/Active Tripod/src/visual/Scene.cpp +++ b/of/Active Tripod/src/visual/Scene.cpp @@ -89,6 +89,27 @@ void Scene::drawGraphValues() string stringVal0 = reduceDecimalCount(activeGraph->publisher0Data.back().stringValue, valDecimalPoints0); string stringVal1 = reduceDecimalCount(activeGraph->publisher1Data.back().stringValue, valDecimalPoints1); + if (activeGraph->graphName == "BODY" || activeGraph->graphName == "SEPARATE_BODY") + { + //std::stringstream sstr(activeGraph->animatedVal0LLI); + //__int64 val; + //sstr >> val; + //printf("val:%lld\n", val); + + if (activeGraph->animatedVal0LLI > 100000) + stringVal0 = reduceDecimalCount(ofToString(activeGraph->animatedVal0LLI), valDecimalPoints0); + else + stringVal0 = reduceDecimalCount(ofToString(activeGraph->animatedVal0), valDecimalPoints0); + if (activeGraph->animatedVal1LLI > 100000) + stringVal1 = reduceDecimalCount(ofToString(activeGraph->animatedVal1LLI), valDecimalPoints1); + else + stringVal1 = reduceDecimalCount(ofToString(activeGraph->animatedVal1), valDecimalPoints1); + + stringVal0 = addCommasToNumberString(stringVal0); + stringVal1 = addCommasToNumberString(stringVal1); + } + + ofPushStyle(); text.setAlignment(FTGL_ALIGN_LEFT); ofSetColor(graphTextColour[0], graphTextColour[1], graphTextColour[2], graphTextColour[3]); @@ -178,12 +199,6 @@ void Scene::drawHUDBG() void Scene::drawHUDCopy() { - text.setLineLength(lineLength); - text.setLineSpacing(lineSpacing); - text.setSize(textSize); - - drawTextBox(tlStr, "TOP LEFT"); - drawTextBox(trStr, "TOP RIGHT"); vector *p0Data = &activeGraph->publisher0Data; vector *p1Data = &activeGraph->publisher1Data; @@ -194,6 +209,35 @@ void Scene::drawHUDCopy() string stringVal0 = reduceDecimalCount(activeGraph->publisher0Data.back().stringValue, valDecimalPoints0); string stringVal1 = reduceDecimalCount(activeGraph->publisher1Data.back().stringValue, valDecimalPoints1); + + + + if (activeGraph->graphName == "BODY" || activeGraph->graphName == "SEPARATE_BODY") + { + if (activeGraph->animatedVal0LLI > 100000) + stringVal0 = reduceDecimalCount(ofToString(activeGraph->animatedVal0LLI), valDecimalPoints0); + else + stringVal0 = reduceDecimalCount(ofToString(activeGraph->animatedVal0), valDecimalPoints0); + if (activeGraph->animatedVal1LLI > 100000) + stringVal1 = reduceDecimalCount(ofToString(activeGraph->animatedVal1LLI), valDecimalPoints1); + else + stringVal1 = reduceDecimalCount(ofToString(activeGraph->animatedVal1), valDecimalPoints1); + + stringVal0 = addCommasToNumberString(stringVal0); + stringVal1 = addCommasToNumberString(stringVal1); + } + + tlStr = p0Data->back().info + "\n" + p0Data->back().unitMeasure + "\n" + stringVal0; + trStr = p0Data->back().info + "\n" + p0Data->back().unitMeasure + "\n" + stringVal1; + + text.setLineLength(lineLength); + text.setLineSpacing(lineSpacing); + text.setSize(textSize); + + drawTextBox(tlStr, "TOP LEFT"); + drawTextBox(trStr, "TOP RIGHT"); + + int amountToAverage = MIN(p0Data->size(), averageAmount); if (p0Data->size() > 2) @@ -338,9 +382,6 @@ void Scene::addNewData(vector newData) barGraph.addNewData(newData); bodyGraph.addNewData(newData); separateBodyGraph.addNewData(newData); - - tlStr = newData[0].info + "\n" + newData[0].unitMeasure + "\n" + reduceDecimalCount(ofToString(newData[0].stringValue), valDecimalPoints0); - trStr = newData[1].info + "\n" + newData[1].unitMeasure + "\n" + reduceDecimalCount(ofToString(newData[1].stringValue), valDecimalPoints1); } @@ -373,7 +414,7 @@ string Scene::addCommasToNumberString(string num) if (decimalLocation != -1) { integral = integral.substr(0 , decimalLocation); - fractional = integral.substr(decimalLocation); + fractional = num.substr(decimalLocation); } else { diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp index 6dcbec3..a96521c 100644 --- a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp +++ b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp @@ -14,6 +14,8 @@ float AbstractGraph::maxGraphPercent; void AbstractGraph::setup() { millisSinceLastPoint = 0; + animatedVal0LLI = 0; + animatedVal1LLI = 0; } diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.h b/of/Active Tripod/src/visual/graph/AbstractGraph.h index 74f5550..8d52560 100644 --- a/of/Active Tripod/src/visual/graph/AbstractGraph.h +++ b/of/Active Tripod/src/visual/graph/AbstractGraph.h @@ -53,4 +53,9 @@ public: ofPoint graphTextPnt0; ofPoint graphTextPnt1; + + float animatedVal0; + float animatedVal1; + long long int animatedVal0LLI; + long long int animatedVal1LLI; }; \ 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 dbf1ee9..cd82d31 100644 --- a/of/Active Tripod/src/visual/graph/BarGraph.cpp +++ b/of/Active Tripod/src/visual/graph/BarGraph.cpp @@ -31,6 +31,12 @@ void BarGraph::draw() float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax); float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax); + + + ofPushMatrix(); + //if (publisher0Data.size() >= maxData) + //ofTranslate(ofMap(normalisedTimeInc, 0, 1, 0, -graphItemXGap*0.5), 0); + for (int i = 0; i < publisher0Data.size() - 1; i++) { ofPushStyle(); @@ -73,6 +79,8 @@ void BarGraph::draw() ofPopStyle(); } + + ofPopMatrix(); } } diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.cpp b/of/Active Tripod/src/visual/graph/BodyGraph.cpp index 83296ea..b0c1dc5 100644 --- a/of/Active Tripod/src/visual/graph/BodyGraph.cpp +++ b/of/Active Tripod/src/visual/graph/BodyGraph.cpp @@ -77,6 +77,16 @@ void BodyGraph::draw() endPoint1.x, endPoint1.y, 0)); + + //float mahousive = 1000000000; + //animatedVal0 = ofMap(endPoint0.y * mahousive, outputMin * mahousive, outputMax * mahousive, publisher0Data.back().min * mahousive, publisher0Data.back().max * mahousive); + //animatedVal0LLI = ofMap(endPoint0.y * mahousive, outputMin * mahousive, outputMax * mahousive, publisher0Data.back().min * mahousive, publisher0Data.back().max * mahousive); + animatedVal0 = ofMap(endPoint0.y, outputMin, outputMax, publisher0Data.back().min, publisher0Data.back().max); + animatedVal0LLI = ofMap(endPoint0.y, outputMin, outputMax, publisher0Data.back().min, publisher0Data.back().max); + + animatedVal1 = ofMap(endPoint1.y, outputMin, outputMax, publisher1Data.back().min, publisher1Data.back().max); + animatedVal1LLI = ofMap(endPoint1.y, outputMin, outputMax, publisher1Data.back().min, publisher1Data.back().max); + } body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3])); body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3])); diff --git a/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp b/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp index ac3a7bb..55fd7c4 100644 --- a/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp +++ b/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp @@ -31,8 +31,8 @@ void SeparateBodyGraph::draw() if (publisher0Data.size() > 1) { - ofMesh body0 = getMesh(publisher0Data, col0); - ofMesh body1 = getMesh(publisher1Data, col1); + ofMesh body0 = getMesh(publisher0Data, col0, 0); + ofMesh body1 = getMesh(publisher1Data, col1, 1); if (body0.getVertices().size() > 2) { @@ -43,6 +43,7 @@ void SeparateBodyGraph::draw() float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent; float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax); float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax); + // draw lines ofPushStyle(); @@ -114,7 +115,7 @@ void SeparateBodyGraph::draw() } -ofMesh SeparateBodyGraph::getMesh(vector publisherData, float* col) +ofMesh SeparateBodyGraph::getMesh(vector publisherData, float* col, int graphID) { ofMesh bodyMesh; float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent; @@ -142,6 +143,19 @@ ofMesh SeparateBodyGraph::getMesh(vector publisherData, float* col) float prevY0 = ofMap(publisherData[i-1].value, publisherData[i-1].min, publisherData[i-1].max, outputMin, outputMax); endPoint0.y = ofMap(normalisedTimeInc, 0, 1, prevY0, targetY0); endPoint0.x = (i-1) * graphItemXGap + xOffset + (graphItemXGap * normalisedTimeInc); + + if (graphID == 0) + { + animatedVal0 = ofMap(endPoint0.y, outputMin, outputMax, publisher0Data.back().min, publisher0Data.back().max); + animatedVal0LLI = ofMap(endPoint0.y, outputMin, outputMax, publisher0Data.back().min, publisher0Data.back().max); + //animatedVal0 = 99111222333; + //animatedVal0LLI = 99111222333; + } + else + { + animatedVal1 = ofMap(endPoint0.y, outputMin, outputMax, publisher1Data.back().min, publisher1Data.back().max); + animatedVal1LLI = ofMap(endPoint0.y, outputMin, outputMax, publisher1Data.back().min, publisher1Data.back().max); + } bodyMesh.addVertex(ofVec3f( endPoint0.x, diff --git a/of/Active Tripod/src/visual/graph/SeparateBodyGraph.h b/of/Active Tripod/src/visual/graph/SeparateBodyGraph.h index 21a3ebb..751c65e 100644 --- a/of/Active Tripod/src/visual/graph/SeparateBodyGraph.h +++ b/of/Active Tripod/src/visual/graph/SeparateBodyGraph.h @@ -13,7 +13,7 @@ public: virtual void update(); virtual void draw(); virtual void addNewData(vector newData); - ofMesh getMesh(vector publisherData, float* col); + ofMesh getMesh(vector publisherData, float* col, int graphID); testApp *app;