Graph/HUD Numbers now tween when changing
This commit is contained in:
parent
c542bcf317
commit
61d192ae2a
Binary file not shown.
@ -1,12 +1,12 @@
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
<Name>Graph Item X Gap</Name>
|
||||
<Value>9.144737244</Value>
|
||||
<Value>8.848684311</Value>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
<Name>BarWidth</Name>
|
||||
<Value>15.894737244</Value>
|
||||
<Value>6.263157845</Value>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
@ -16,7 +16,7 @@
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
<Name>Data send speed (seconds)</Name>
|
||||
<Value>4.485855103</Value>
|
||||
<Value>1.671052575</Value>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
|
||||
@ -27,12 +27,12 @@
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
<Name>Decimal points 0</Name>
|
||||
<Value>5.174342155</Value>
|
||||
<Value>4.049342155</Value>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
<Name>Decimal points 1</Name>
|
||||
<Value>2.332236767</Value>
|
||||
<Value>2.805921078</Value>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
<Name>Data send speed (seconds)</Name>
|
||||
<Value>0.950986862</Value>
|
||||
<Value>1.932894707</Value>
|
||||
</Widget>
|
||||
<Widget>
|
||||
<Kind>4</Kind>
|
||||
|
||||
@ -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<DataObject> *p0Data = &activeGraph->publisher0Data;
|
||||
vector<DataObject> *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<DataObject> 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
|
||||
{
|
||||
|
||||
@ -14,6 +14,8 @@ float AbstractGraph::maxGraphPercent;
|
||||
void AbstractGraph::setup()
|
||||
{
|
||||
millisSinceLastPoint = 0;
|
||||
animatedVal0LLI = 0;
|
||||
animatedVal1LLI = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -53,4 +53,9 @@ public:
|
||||
|
||||
ofPoint graphTextPnt0;
|
||||
ofPoint graphTextPnt1;
|
||||
|
||||
float animatedVal0;
|
||||
float animatedVal1;
|
||||
long long int animatedVal0LLI;
|
||||
long long int animatedVal1LLI;
|
||||
};
|
||||
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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]));
|
||||
|
||||
@ -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<DataObject> publisherData, float* col)
|
||||
ofMesh SeparateBodyGraph::getMesh(vector<DataObject> publisherData, float* col, int graphID)
|
||||
{
|
||||
ofMesh bodyMesh;
|
||||
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
|
||||
@ -142,6 +143,19 @@ ofMesh SeparateBodyGraph::getMesh(vector<DataObject> 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,
|
||||
|
||||
@ -13,7 +13,7 @@ public:
|
||||
virtual void update();
|
||||
virtual void draw();
|
||||
virtual void addNewData(vector<DataObject> newData);
|
||||
ofMesh getMesh(vector<DataObject> publisherData, float* col);
|
||||
ofMesh getMesh(vector<DataObject> publisherData, float* col, int graphID);
|
||||
|
||||
testApp *app;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user