Body graph now using live data
This commit is contained in:
parent
6d50b2efae
commit
759936b322
Binary file not shown.
@ -51,7 +51,7 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Alpha .</Name>
|
<Name>Alpha .</Name>
|
||||||
<Value>255.000000000</Value>
|
<Value>207.187500000</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
|
|||||||
@ -6,7 +6,12 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Line width</Name>
|
<Name>Line width</Name>
|
||||||
<Value>25.661184311</Value>
|
<Value>7.286184311</Value>
|
||||||
|
</Widget>
|
||||||
|
<Widget>
|
||||||
|
<Kind>4</Kind>
|
||||||
|
<Name>Graph Height Max</Name>
|
||||||
|
<Value>443.421051025</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
@ -26,7 +31,7 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Data0 alpha</Name>
|
<Name>Data0 alpha</Name>
|
||||||
<Value>230.674346924</Value>
|
<Value>155.180923462</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
@ -46,5 +51,5 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
<Name>Data1 alpha</Name>
|
<Name>Data1 alpha</Name>
|
||||||
<Value>185.378295898</Value>
|
<Value>170.279602051</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<Widget>
|
<Widget>
|
||||||
<Kind>2</Kind>
|
<Kind>2</Kind>
|
||||||
<Name>Toggle Data Simulation</Name>
|
<Name>Toggle Data Simulation</Name>
|
||||||
<Value>1</Value>
|
<Value>0</Value>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget>
|
<Widget>
|
||||||
<Kind>4</Kind>
|
<Kind>4</Kind>
|
||||||
|
|||||||
@ -77,7 +77,7 @@ void DataManager::update()
|
|||||||
{
|
{
|
||||||
isPublisher0DataReceived = false;
|
isPublisher0DataReceived = false;
|
||||||
isPublisher1DataReceived = 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());
|
printf("- - min = %s\n", data[i].substr(4, -1).c_str());
|
||||||
dataObject.min = ofToFloat(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());
|
printf("- - max = %s\n", data[i].substr(4, -1).c_str());
|
||||||
dataObject.max = ofToFloat(data[i].substr(5, -1).c_str());
|
dataObject.max = ofToFloat(data[i].substr(4, -1).c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,12 +80,13 @@ void GUI::addBarGraphDesignGUI()
|
|||||||
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.barGraph.graphItemXGap, length, dim);
|
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("BarWidth", 2, 50, &app->scene.barGraph.barWidth, length, dim);
|
||||||
gui->addSlider("Graph Height Max", 100, 1000, &app->scene.barGraph.graphHeightMax, 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 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 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 blue", 0, 255, &app->scene.barGraph.col0[2], length, dim);
|
||||||
gui->addSlider("Data0 alpha", 0, 255, &app->scene.barGraph.col0[3], 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 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 green", 0, 255, &app->scene.barGraph.col1[1], length, dim);
|
||||||
gui->addSlider("Data1 blue", 0, 255, &app->scene.barGraph.col1[2], 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("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("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 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 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 blue", 0, 255, &app->scene.bodyGraph.col0[2], length, dim);
|
||||||
gui->addSlider("Data0 alpha", 0, 255, &app->scene.bodyGraph.col0[3], 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 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 green", 0, 255, &app->scene.bodyGraph.col1[1], length, dim);
|
||||||
gui->addSlider("Data1 blue", 0, 255, &app->scene.bodyGraph.col1[2], length, dim);
|
gui->addSlider("Data1 blue", 0, 255, &app->scene.bodyGraph.col1[2], length, dim);
|
||||||
|
|||||||
@ -2,31 +2,14 @@
|
|||||||
|
|
||||||
// TODO
|
// 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
|
// - Add video camera feed
|
||||||
// - Create text parsing system
|
// - Add colour boxes to text
|
||||||
// - Tidy up the first graph
|
|
||||||
// - Create animation system
|
|
||||||
// - Make system to slow down data - The screen should show 15-20 minutes worth of data
|
// - 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
|
// - 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()
|
void testApp::setup()
|
||||||
{
|
{
|
||||||
@ -45,7 +28,7 @@ void testApp::setup()
|
|||||||
isPaused = false;
|
isPaused = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
void testApp::update()
|
void testApp::update()
|
||||||
{
|
{
|
||||||
if (isPaused) return;
|
if (isPaused) return;
|
||||||
@ -54,7 +37,7 @@ void testApp::update()
|
|||||||
scene.update();
|
scene.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
void testApp::draw()
|
void testApp::draw()
|
||||||
{
|
{
|
||||||
dataManager.draw();
|
dataManager.draw();
|
||||||
@ -62,7 +45,6 @@ void testApp::draw()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
|
||||||
void testApp::mousePressed(int x, int y, int button)
|
void testApp::mousePressed(int x, int y, int button)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@ -132,6 +132,12 @@ void Scene::drawTextBox(string copy, string align)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Scene::addNewData(vector<DataObject> newData)
|
||||||
|
{
|
||||||
|
barGraph.addNewData(newData);
|
||||||
|
bodyGraph.addNewData(newData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Scene::keyPressed(int key)
|
void Scene::keyPressed(int key)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "ofMain.h"
|
#include "ofMain.h"
|
||||||
#include "BarGraph.h"
|
#include "BarGraph.h"
|
||||||
#include "BodyGraph.h"
|
#include "BodyGraph.h"
|
||||||
|
#include "DataManager.h"
|
||||||
#include "ofxFTGL.h"
|
#include "ofxFTGL.h"
|
||||||
|
|
||||||
class testApp;
|
class testApp;
|
||||||
@ -25,6 +26,7 @@ public:
|
|||||||
void drawHUDBG();
|
void drawHUDBG();
|
||||||
void drawHUDCopy();
|
void drawHUDCopy();
|
||||||
void drawTextBox(string copy, string align);
|
void drawTextBox(string copy, string align);
|
||||||
|
void addNewData(vector<DataObject> newData);
|
||||||
void keyPressed(int key);
|
void keyPressed(int key);
|
||||||
|
|
||||||
BarGraph barGraph;
|
BarGraph barGraph;
|
||||||
|
|||||||
@ -33,13 +33,24 @@ void BodyGraph::draw()
|
|||||||
// ofPopStyle();
|
// 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;
|
ofMesh body;
|
||||||
body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
|
body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
|
||||||
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
{
|
{
|
||||||
//body.addVertex(ofVec3f(i * graphItemXGap, publisher0Data[i], 0));
|
body.addVertex(ofVec3f(
|
||||||
//body.addVertex(ofVec3f(i * graphItemXGap, publisher1Data[i], 0));
|
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(col0[0],col0[1],col0[2], col0[3]));
|
||||||
body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3]));
|
body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3]));
|
||||||
@ -48,20 +59,31 @@ void BodyGraph::draw()
|
|||||||
body.drawFaces();
|
body.drawFaces();
|
||||||
|
|
||||||
|
|
||||||
|
// draw lines
|
||||||
|
ofPushStyle();
|
||||||
|
ofPolyline poly0;
|
||||||
|
ofPolyline poly1;
|
||||||
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
for (int i = 0; i < publisher0Data.size() - 1; i++)
|
||||||
{
|
{
|
||||||
if (i < publisher0Data.size() - 2)
|
if (i < publisher0Data.size() - 1)
|
||||||
{
|
{
|
||||||
//ofPushStyle();
|
ofSetLineWidth(lineWidth);
|
||||||
//ofSetLineWidth(lineWidth);
|
poly0.addVertex(ofPoint(
|
||||||
//ofSetColor(col0[0],col0[1],col0[2], 255);
|
i * graphItemXGap + xOffset,
|
||||||
//ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]);
|
ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax)));
|
||||||
//ofSetColor(col1[0],col1[1],col1[2], 255);
|
|
||||||
//ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]);
|
|
||||||
//ofPopStyle();
|
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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user