diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib
index 315d99f..6cbd078 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 4fb43c0..0057298 100644
--- a/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml
@@ -1,12 +1,12 @@
2
Toggle Video Visibility
- 1
+ 0
2
Toggle Image Visibility
- 0
+ 1
4
@@ -88,3 +88,18 @@
Circle Point Size
52.302627563
+
+ 4
+ Line Width
+ 1.710526347
+
+
+ 4
+ Alpha ..
+ 255.000000000
+
+
+ 4
+ Circle Size
+ 15.460527420
+
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 52a5d36..51fbde4 100644
--- a/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml
@@ -6,7 +6,7 @@
4
BarWidth
- 5.631578922
+ 15.894737244
4
diff --git a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml
index c2835ce..5374e99 100644
--- a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml
@@ -1,7 +1,7 @@
2
Bar graph
- 0
+ 1
2
@@ -11,7 +11,7 @@
2
Separate Body graph
- 1
+ 0
6
@@ -19,3 +19,28 @@
0.786184192
0.059210528
+
+ 4
+ Size
+ 30.016448975
+
+
+ 4
+ Red
+ 255.000000000
+
+
+ 4
+ Green
+ 255.000000000
+
+
+ 4
+ Blue
+ 255.000000000
+
+
+ 4
+ Alpha
+ 255.000000000
+
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 d5f21c3..54570af 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
@@ -21,7 +21,7 @@
4
Graph bottom end (percent)
- 0.875000000
+ 0.769736826
4
diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp
index ad04e7c..d0ede6d 100644
--- a/of/Active Tripod/src/gui/GUI.cpp
+++ b/of/Active Tripod/src/gui/GUI.cpp
@@ -46,6 +46,7 @@ void GUI::addKeyboardShortcutsGUI()
gui->addLabel("']' - NEXT GUI", OFX_UI_FONT_SMALL);
gui->addLabel("'p' - TOGGLE PAUSE ANIMATION", OFX_UI_FONT_SMALL);
gui->addLabel("'f' - TOGGLE FULLSCREEN", OFX_UI_FONT_SMALL);
+ gui->addLabel("'c' - CLEAR ALL GRAPH DATA", OFX_UI_FONT_SMALL);
finaliseCanvas(gui, true);
@@ -67,6 +68,13 @@ void GUI::addGraphGlobalGUI()
gui->addSpacer(length, 1);
gui->addRangeSlider("Graph X begin/end (percent)", 0, 1, &AbstractGraph::minGraphPercent, &AbstractGraph::maxGraphPercent, length, dim);
+ gui->addLabel("GRAPH TEXT");
+ gui->addSpacer(length, 1);
+ gui->addSlider("Size", 5, 50, &app->scene.graphTextSize, length, dim);
+ gui->addSlider("Red", 0, 255, &app->scene.graphTextColour[0], length, dim);
+ gui->addSlider("Green", 0, 255, &app->scene.graphTextColour[1], length, dim);
+ gui->addSlider("Blue", 0, 255, &app->scene.graphTextColour[2], length, dim);
+ gui->addSlider("Alpha", 0, 255, &app->scene.graphTextColour[3], length, dim);
ofAddListener(gui->newGUIEvent, this, &GUI::graphGlobalGUIEvent);
finaliseCanvas(gui, true);
@@ -200,6 +208,10 @@ void GUI::addBackgroundGUI()
gui->addSlider("Hole Width Percent", 0, 2, &app->scene.hudHoleWidthPercentage, length, dim);
gui->addSlider("Hole Height Percent", 0, 2, &app->scene.hudHoleHeightPercentage, length, dim);
gui->addSlider("Circle Point Size", 0, 100, &app->scene.circlePointSize, length, dim);
+ gui->addLabel("CROSSHAIRS SETTINGS");
+ gui->addSlider("Line Width", 0, 10, &app->scene.crosshairLineWidth, length, dim);
+ gui->addSlider("Alpha ..", 0, 255, &app->scene.crosshairAlpha, length, dim);
+ gui->addSlider("Circle Size", 0, 100, &app->scene.crosshairCircleSize, length, dim);
ofAddListener(gui->newGUIEvent, this, &GUI::variousGUIEvent);
finaliseCanvas(gui, true);
diff --git a/of/Active Tripod/src/testApp.cpp b/of/Active Tripod/src/testApp.cpp
index 2a19e9e..5163cdc 100644
--- a/of/Active Tripod/src/testApp.cpp
+++ b/of/Active Tripod/src/testApp.cpp
@@ -2,11 +2,9 @@
// TODO
// ====
-// - Crosshairs in HUD
-// - Create graph animation system
-// - make maxGraphHeight percentage instead of pixels
-// - Create a single config file to be loaded from online location. It will contain IP address and host name
// - If min or max values change - clear graph - ask bout this
+// - Create a single config file to be loaded from online location. It will contain IP address and host name
+// - Create graph animation system
//
//--------------------------------------------------------------
void testApp::setup()
diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp
index 9a134ad..c7e6cc4 100644
--- a/of/Active Tripod/src/visual/Scene.cpp
+++ b/of/Active Tripod/src/visual/Scene.cpp
@@ -29,10 +29,6 @@ void Scene::update()
vidGrabber.update();
activeGraph->update();
-
- text.setLineLength(lineLength);
- text.setLineSpacing(lineSpacing);
- text.setSize(textSize);
}
@@ -40,6 +36,8 @@ void Scene::draw()
{
drawVideo();
activeGraph->draw();
+ drawGraphValues();
+ drawCrosshairs();
drawHUDBG();
drawHUDCopy();
drawHUDColourBars();
@@ -71,6 +69,36 @@ void Scene::drawVideo()
rgbShader.end();
}
+
+void Scene::drawGraphValues()
+{
+ if (activeGraph->publisher0Data.size() < 2) return;
+
+ ofPoint val0 = activeGraph->currentPub0Point;
+ ofPoint val1 = activeGraph->currentPub1Point;
+
+ ofPushStyle();
+ text.setAlignment(FTGL_ALIGN_LEFT);
+ ofSetColor(graphTextColour[0], graphTextColour[1], graphTextColour[2], graphTextColour[3]);
+ text.setSize(graphTextSize);
+ text.drawString(ofToString(activeGraph->publisher0Data.back().value), val0.x + 10, val0.y);
+ text.drawString(ofToString(activeGraph->publisher1Data.back().value), val1.x + 10, val1.y);
+ ofPopStyle();
+}
+
+
+void Scene::drawCrosshairs()
+{
+ ofPushStyle();
+ ofSetLineWidth(crosshairLineWidth);
+ ofSetColor(hudColour[0], hudColour[1], hudColour[2], crosshairAlpha);
+ ofLine(ofGetWidth() * 0.5, 0, ofGetWidth() * 0.5, ofGetHeight()); // vert
+ ofLine(0, ofGetHeight() * 0.5, ofGetWidth(), ofGetHeight() * 0.5); // horz
+ ofCircle(ofGetWidth() * 0.5, ofGetHeight() * 0.5, crosshairCircleSize);
+ ofPopStyle();
+}
+
+
void Scene::drawHUDBG()
{
ofPushStyle();
@@ -103,12 +131,16 @@ 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;
-
+
int amountToAverage = MIN(p0Data->size(), averageAmount);
if (p0Data->size() > 2)
{
diff --git a/of/Active Tripod/src/visual/Scene.h b/of/Active Tripod/src/visual/Scene.h
index dd91036..3612f51 100644
--- a/of/Active Tripod/src/visual/Scene.h
+++ b/of/Active Tripod/src/visual/Scene.h
@@ -24,6 +24,8 @@ public:
void update();
void draw();
void drawVideo();
+ void drawGraphValues();
+ void drawCrosshairs();
void drawHUDBG();
void drawHUDCopy();
void drawHUDColourBars();
@@ -58,7 +60,16 @@ public:
float videoHeightPercentage;
bool isVideoVisible;
bool isImageVisible;
-
+
+ // graph text
+ float graphTextColour[4];
+ float graphTextSize;
+
+ // crosshairs
+ float crosshairLineWidth;
+ float crosshairAlpha;
+ float crosshairCircleSize;
+
// HUD background vars
float hudColour[4];
float circlePointSize;
diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp
index 82bc22a..a051e29 100644
--- a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp
+++ b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp
@@ -29,6 +29,7 @@ void AbstractGraph::draw()
}
+
void AbstractGraph::addNewData(vector newData)
{
publisher0Data.push_back(newData[0]);
diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.h b/of/Active Tripod/src/visual/graph/AbstractGraph.h
index 1cfa3ec..29982e8 100644
--- a/of/Active Tripod/src/visual/graph/AbstractGraph.h
+++ b/of/Active Tripod/src/visual/graph/AbstractGraph.h
@@ -27,6 +27,9 @@ public:
static float minGraphPercent;
static float maxGraphPercent;
+
+ ofPoint currentPub0Point;
+ ofPoint currentPub1Point;
float graphItemXGap;
diff --git a/of/Active Tripod/src/visual/graph/BarGraph.cpp b/of/Active Tripod/src/visual/graph/BarGraph.cpp
index 3d87f48..dbf1ee9 100644
--- a/of/Active Tripod/src/visual/graph/BarGraph.cpp
+++ b/of/Active Tripod/src/visual/graph/BarGraph.cpp
@@ -27,29 +27,6 @@ void BarGraph::draw()
if (publisher0Data.size() > 1)
{
- for (int i = 0; i < publisher0Data.size() - 1; i++)
- {
- if (i < publisher0Data.size() - 2)
- {
- //ofPushStyle();
- //ofSetColor(0, 0, 0);
- //ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]);
- //ofSetColor(0, 0, 0);
- //ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]);
- //ofPopStyle();
- }
- }
-
- for (int i = 0; i < publisher0Data.size() - 1; i++)
- {
- //ofPushStyle();
- //ofSetColor(255, 0, 0);
- //ofCircle(i * graphItemXGap, publisher0Data[i], 5);
- //ofSetColor(0, 255, 0);
- //ofCircle(i * graphItemXGap, publisher1Data[i], 5);
- //ofPopStyle();
- }
-
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax);
float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax);
@@ -58,7 +35,6 @@ void BarGraph::draw()
{
ofPushStyle();
-
ofMesh bar;
float rectTLX = i * graphItemXGap - (barWidth * 0.5) + xOffset;
float rectTLY = ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax);
@@ -72,9 +48,11 @@ void BarGraph::draw()
float rectBRX = i * graphItemXGap - (barWidth * 0.5) + barWidth + xOffset;
float rectBRY = ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax);
-
- //printf("val:%f, min:%f, max:%f - new val:%f \n", publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, rectTLY);
- //printf("val:%f, min:%f, max:%f - new val:%f \n", publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, rectBLY);
+ if (i == publisher0Data.size() - 2)
+ {
+ currentPub0Point = ofPoint(rectTRX, rectTRY);
+ currentPub1Point = ofPoint(rectBRX, rectBRY);
+ }
bar.addVertex(ofVec3f(rectTLX, rectTLY, 0));
bar.addVertex(ofVec3f(rectTRX, rectTRY, 0));
@@ -93,10 +71,6 @@ void BarGraph::draw()
bar.drawFaces();
- //ofSetColor(255, 255, 0);
- //ofRect(i * graphItemXGap - (barWidth * 0.5), publisher0Data[i], barWidth, publisher1Data[i] - publisher0Data[i]);
- //ofSetColor(0, 0, 0);
- //ofLine(i * graphItemXGap, publisher0Data[i], i * graphItemXGap, publisher1Data[i]);
ofPopStyle();
}
}
diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.cpp b/of/Active Tripod/src/visual/graph/BodyGraph.cpp
index f1b2dd5..4c3bd0f 100644
--- a/of/Active Tripod/src/visual/graph/BodyGraph.cpp
+++ b/of/Active Tripod/src/visual/graph/BodyGraph.cpp
@@ -54,6 +54,14 @@ void BodyGraph::draw()
body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3]));
body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3]));
+
+ if (i == publisher0Data.size() - 2)
+ {
+ currentPub0Point = ofPoint(i * graphItemXGap + xOffset,
+ ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax));
+ currentPub1Point = ofPoint(i * graphItemXGap + xOffset,
+ ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax));
+ }
}
body.drawFaces();
diff --git a/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp b/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp
index 13a04b8..bd1f12f 100644
--- a/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp
+++ b/of/Active Tripod/src/visual/graph/SeparateBodyGraph.cpp
@@ -33,12 +33,17 @@ void SeparateBodyGraph::draw()
{
ofMesh body0 = getMesh(publisher0Data, col0);
ofMesh body1 = getMesh(publisher1Data, col1);
-
+
+ if (body0.getVertices().size() > 2)
+ {
+ currentPub0Point = ofPoint(body0.getVertex(body0.getVertices().size() - 2).x, body0.getVertex(body0.getVertices().size() - 2).y);
+ currentPub1Point = ofPoint(body0.getVertex(body1.getVertices().size() - 2).x, body1.getVertex(body1.getVertices().size() - 2).y);
+ }
+
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();
ofPolyline poly0;
@@ -64,8 +69,6 @@ void SeparateBodyGraph::draw()
ofVec2f centroid0 = poly0.getCentroid2D();
ofVec2f centroid1 = poly1.getCentroid2D();
- printf("centroid0.y:%f, centroid1.y:%f\n", centroid0.y, centroid1.y);
-
float av0;
float av1;
@@ -77,8 +80,6 @@ void SeparateBodyGraph::draw()
av0 /= poly0.size();
av1 /= poly1.size();
- printf("av0:%f, av1:%f\n", av0, av1);
-
int lineAlpha = 255;
if (!isDrawLines) lineAlpha = 0;
@@ -102,20 +103,6 @@ void SeparateBodyGraph::draw()
ofSetColor(col0[0],col0[1],col0[2], lineAlpha);
poly0.draw();
}
-
- if (isDrawLines)
- {
- if (av0 > av1)
- {
-
-
- }
- else
- {
-
-
- }
- }
ofPopStyle();
}