diff --git a/of/Active Tripod/Active_Tripod.vcxproj b/of/Active Tripod/Active_Tripod.vcxproj
index acb7cbf..22e3020 100644
--- a/of/Active Tripod/Active_Tripod.vcxproj
+++ b/of/Active Tripod/Active_Tripod.vcxproj
@@ -111,6 +111,7 @@
+
@@ -188,6 +189,7 @@
+
diff --git a/of/Active Tripod/Active_Tripod.vcxproj.filters b/of/Active Tripod/Active_Tripod.vcxproj.filters
index 1eeaee0..6a65e08 100644
--- a/of/Active Tripod/Active_Tripod.vcxproj.filters
+++ b/of/Active Tripod/Active_Tripod.vcxproj.filters
@@ -73,6 +73,9 @@
addons\ofxFTGL\src
+
+ src\visual\graph
+
@@ -368,6 +371,9 @@
addons\ofxFTGL\libs\FTGL\include\FTGL
+
+ src\visual\graph
+
diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib
index 058ef0a..f67f171 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 147344a..74ec44d 100644
--- a/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/BAR GRAPH DESIGNguiPagesettings.xml
@@ -8,6 +8,11 @@
BarWidth
17.000000000
+
+ 4
+ Graph Height Max
+ 407.894744873
+
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
new file mode 100644
index 0000000..973d0d7
--- /dev/null
+++ b/of/Active Tripod/bin/data/GUI/BODY GRAPH DESIGNguiPagesettings.xml
@@ -0,0 +1,50 @@
+
+ 4
+ Graph Item X Gap
+ 7.220395088
+
+
+ 4
+ Line width
+ 25.661184311
+
+
+ 4
+ Data0 red
+ 89.753288269
+
+
+ 4
+ Data0 green
+ 208.865127563
+
+
+ 4
+ Data0 blue
+ 84.720397949
+
+
+ 4
+ Data0 alpha
+ 230.674346924
+
+
+ 4
+ Data1 red
+ 164.407897949
+
+
+ 4
+ Data1 green
+ 83.042762756
+
+
+ 4
+ Data1 blue
+ 208.865127563
+
+
+ 4
+ Data1 alpha
+ 185.378295898
+
diff --git a/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml
new file mode 100644
index 0000000..0b6dbf2
--- /dev/null
+++ b/of/Active Tripod/bin/data/GUI/GRAPH GLOBALguiPagesettings.xml
@@ -0,0 +1,21 @@
+
+ 2
+ Bar graph
+ 1
+
+
+ 2
+ Solid Body graph
+ 0
+
+
+ 2
+ Line fade graph
+ 0
+
+
+ 6
+ Graph X begin/end (percent)
+ 0.838815808
+ 0.069078945
+
diff --git a/of/Active Tripod/bin/data/GUI/GRAPH SELECTIONguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/GRAPH SELECTIONguiPagesettings.xml
new file mode 100644
index 0000000..3763805
--- /dev/null
+++ b/of/Active Tripod/bin/data/GUI/GRAPH SELECTIONguiPagesettings.xml
@@ -0,0 +1,15 @@
+
+ 2
+ Bar graph
+ 0
+
+
+ 2
+ Solid Body graph
+ 1
+
+
+ 2
+ Line fade graph
+ 0
+
diff --git a/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml
index 7c9a46e..977081f 100644
--- a/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/HUD TEXTguiPagesettings.xml
@@ -26,7 +26,7 @@
4
Text Size
- 27.763158798
+ 21.842105865
4
@@ -46,5 +46,5 @@
4
Alpha
- 222.286193848
+ 255.000000000
diff --git a/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml
index 568a5d9..65a6ee7 100644
--- a/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/SIMULATIONguiPagesettings.xml
@@ -11,10 +11,10 @@
4
Perlin X Scale (data size)
- 0.148730263
+ 0.163503304
4
Perlin Y Scale (time f)
- 0.147088811
+ 0.217671067
diff --git a/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml
index 4d73d4c..c6d5efc 100644
--- a/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml
+++ b/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml
@@ -16,5 +16,5 @@
4
ALPHA
- 139.243423462
+ 218.930923462
diff --git a/of/Active Tripod/bin/data/fonts/Helvetica.dfont b/of/Active Tripod/bin/data/fonts/Helvetica.dfont
deleted file mode 100644
index 2bd070c..0000000
Binary files a/of/Active Tripod/bin/data/fonts/Helvetica.dfont and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Black.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Black.ttf
new file mode 100644
index 0000000..71f01ac
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Black.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-BlackItalic.ttf b/of/Active Tripod/bin/data/fonts/Roboto-BlackItalic.ttf
new file mode 100644
index 0000000..ec309c7
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-BlackItalic.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Bold.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Bold.ttf
new file mode 100644
index 0000000..aaf374d
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Bold.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-BoldItalic.ttf b/of/Active Tripod/bin/data/fonts/Roboto-BoldItalic.ttf
new file mode 100644
index 0000000..dcd0f80
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-BoldItalic.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Italic.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Italic.ttf
new file mode 100644
index 0000000..f382c68
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Italic.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Light.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Light.ttf
new file mode 100644
index 0000000..664e1b2
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Light.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-LightItalic.ttf b/of/Active Tripod/bin/data/fonts/Roboto-LightItalic.ttf
new file mode 100644
index 0000000..b8f5296
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-LightItalic.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Medium.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Medium.ttf
new file mode 100644
index 0000000..aa00de0
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Medium.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-MediumItalic.ttf b/of/Active Tripod/bin/data/fonts/Roboto-MediumItalic.ttf
new file mode 100644
index 0000000..67e25f0
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-MediumItalic.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Regular.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Regular.ttf
new file mode 100644
index 0000000..3e6e2e7
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Regular.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-Thin.ttf b/of/Active Tripod/bin/data/fonts/Roboto-Thin.ttf
new file mode 100644
index 0000000..d262d14
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-Thin.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/Roboto-ThinItalic.ttf b/of/Active Tripod/bin/data/fonts/Roboto-ThinItalic.ttf
new file mode 100644
index 0000000..63e9f97
Binary files /dev/null and b/of/Active Tripod/bin/data/fonts/Roboto-ThinItalic.ttf differ
diff --git a/of/Active Tripod/bin/data/fonts/cour.ttf b/of/Active Tripod/bin/data/fonts/cour.ttf
deleted file mode 100644
index ebb3361..0000000
Binary files a/of/Active Tripod/bin/data/fonts/cour.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/courbd.ttf b/of/Active Tripod/bin/data/fonts/courbd.ttf
deleted file mode 100644
index a4f26b4..0000000
Binary files a/of/Active Tripod/bin/data/fonts/courbd.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/courbi.ttf b/of/Active Tripod/bin/data/fonts/courbi.ttf
deleted file mode 100644
index fa12206..0000000
Binary files a/of/Active Tripod/bin/data/fonts/courbi.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/couri.ttf b/of/Active Tripod/bin/data/fonts/couri.ttf
deleted file mode 100644
index c0df001..0000000
Binary files a/of/Active Tripod/bin/data/fonts/couri.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/georgia.ttf b/of/Active Tripod/bin/data/fonts/georgia.ttf
deleted file mode 100644
index 317b851..0000000
Binary files a/of/Active Tripod/bin/data/fonts/georgia.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/georgiab.ttf b/of/Active Tripod/bin/data/fonts/georgiab.ttf
deleted file mode 100644
index 75fa68f..0000000
Binary files a/of/Active Tripod/bin/data/fonts/georgiab.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/georgiai.ttf b/of/Active Tripod/bin/data/fonts/georgiai.ttf
deleted file mode 100644
index 3ee04e5..0000000
Binary files a/of/Active Tripod/bin/data/fonts/georgiai.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/georgiaz.ttf b/of/Active Tripod/bin/data/fonts/georgiaz.ttf
deleted file mode 100644
index 1697bc5..0000000
Binary files a/of/Active Tripod/bin/data/fonts/georgiaz.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/mplus-1c-regular.ttf b/of/Active Tripod/bin/data/fonts/mplus-1c-regular.ttf
deleted file mode 100644
index d8d2e2e..0000000
Binary files a/of/Active Tripod/bin/data/fonts/mplus-1c-regular.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/verdana.ttf b/of/Active Tripod/bin/data/fonts/verdana.ttf
deleted file mode 100644
index 49fe2fb..0000000
Binary files a/of/Active Tripod/bin/data/fonts/verdana.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/verdanab.ttf b/of/Active Tripod/bin/data/fonts/verdanab.ttf
deleted file mode 100644
index 344db20..0000000
Binary files a/of/Active Tripod/bin/data/fonts/verdanab.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/verdanai.ttf b/of/Active Tripod/bin/data/fonts/verdanai.ttf
deleted file mode 100644
index 132b655..0000000
Binary files a/of/Active Tripod/bin/data/fonts/verdanai.ttf and /dev/null differ
diff --git a/of/Active Tripod/bin/data/fonts/verdanaz.ttf b/of/Active Tripod/bin/data/fonts/verdanaz.ttf
deleted file mode 100644
index c1724bb..0000000
Binary files a/of/Active Tripod/bin/data/fonts/verdanaz.ttf and /dev/null differ
diff --git a/of/Active Tripod/src/data/DataManager.cpp b/of/Active Tripod/src/data/DataManager.cpp
index aea7e9b..faf8642 100644
--- a/of/Active Tripod/src/data/DataManager.cpp
+++ b/of/Active Tripod/src/data/DataManager.cpp
@@ -31,11 +31,11 @@ void DataManager::setup()
void DataManager::setupSpacebrew()
{
string host = "54.200.6.109"; // Spacebrew::SPACEBREW_CLOUD; // "localhost";
- string name = "CRITTICAL INFRASTRUCTURE";
- string description = "Description goes here. Not sure why.";
+ string name = "CRITICAL INFRASTRUCTURE";
+ string description = "Description goes here. Not sure why. Let me know if you see this and tell me if you need it";
- spacebrew.addSubscribe(publisher0Name, Spacebrew::TYPE_RANGE);
- spacebrew.addSubscribe(publisher1Name, Spacebrew::TYPE_RANGE);
+ spacebrew.addSubscribe(publisher0Name, Spacebrew::TYPE_STRING);
+ spacebrew.addSubscribe(publisher1Name, Spacebrew::TYPE_STRING);
spacebrew.connect( host, name, description );
// listen to spacebrew events
@@ -45,24 +45,39 @@ void DataManager::setupSpacebrew()
void DataManager::update()
{
- if (isPublisher0DataReceived && isPublisher1DataReceived)
- {
- isPublisher0DataReceived = false;
- isPublisher1DataReceived = false;
-
- // send a DataReceived event
- app->scene.barGraph.addNewData(newData);
- }
-
if (isDataSimulated)
{
if (ofGetFrameNum() % (int)simulationSpeed == 0)
{
- //newData[0] = (int)(ofNoise(newData.size() * 0.04, ofGetFrameNum() * 0.03, ofGetElapsedTimef() * 0.1) * 1000);
- newData[0] = (int)(ofNoise(newData.size() * perlinXScale, ofGetElapsedTimef() * perlinYScale) * 1000);
- newData[1] = (int)(ofNoise((newData.size() + 500) * perlinXScale, (ofGetElapsedTimef() + 1000) * perlinYScale) * 1000);
- app->scene.barGraph.addNewData(newData);
+ DataObject dataObject0;
+ dataObject0.info = "Some text to describe the data\nSome more text\nOne more line";
+ dataObject0.value = ofNoise(newData.size() * perlinXScale, ofGetElapsedTimef() * perlinYScale);
+ dataObject0.min = 0;
+ dataObject0.max = 1;
+
+ //printf("dataObject0.value = %f \n", dataObject0.value);
+
+ newData[0] = dataObject0;
+
+ DataObject dataObject1;
+ dataObject1.info = "Some descriptive text\nSome more\nLittle bit more\nLast one";
+ dataObject1.value = ofNoise((newData.size() + 500) * perlinXScale, (ofGetElapsedTimef() + 1000) * perlinYScale);
+ dataObject1.min = 0;
+ dataObject1.max = 1;
+
+ newData[1] = dataObject1;
+
+ app->scene.activeGraph->addNewData(newData);
+ }
+ }
+ else
+ {
+ if (isPublisher0DataReceived && isPublisher1DataReceived)
+ {
+ isPublisher0DataReceived = false;
+ isPublisher1DataReceived = false;
+ app->scene.activeGraph->addNewData(newData);
}
}
}
@@ -81,16 +96,81 @@ void DataManager::draw()
void DataManager::onMessage( Spacebrew::Message & m )
{
+ printf("new message - %s\n", m.valueString().c_str());
+ // split the formatted string into a list of different data types
+ vector data = explode(",", m.valueString());
+ //for(int i = 0; i < data.size(); i++)
+ // cout < DataManager::explode(const string &delimiter, const string &str)
+{
+ vector arr;
+
+ int strleng = str.length();
+ int delleng = delimiter.length();
+ if (delleng==0)
+ return arr;//no change
+
+ int i=0;
+ int k=0;
+ while( i explode( const string &delimiter, const string &str);
testApp* app;
@@ -28,7 +37,7 @@ class DataManager
string publisher0Name;
string publisher1Name;
- vector newData;
+ vector newData;
bool isPublisher0DataReceived;
bool isPublisher1DataReceived;
diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp
index 900261a..f9f355d 100644
--- a/of/Active Tripod/src/gui/GUI.cpp
+++ b/of/Active Tripod/src/gui/GUI.cpp
@@ -8,6 +8,7 @@
#include "GUI.h"
#include "testApp.h"
+#include "AbstractGraph.h"
void GUI::setup()
{
@@ -17,8 +18,9 @@ void GUI::setup()
dim = 8;
addKeyboardShortcutsGUI();
- //addGraphAnimationGUI();
+ addGraphGlobalGUI();
addBarGraphDesignGUI();
+ addBodyGraphDesignGUI();
addGraphSimulationGUI();
addBackgroundGUI();
addHUDTextGUI();
@@ -49,15 +51,27 @@ void GUI::addKeyboardShortcutsGUI()
}
-void GUI::addGraphAnimationGUI()
+void GUI::addGraphGlobalGUI()
{
- string title = "GRAPH ANIMATION";
+ string title = "GRAPH GLOBAL";
ofxUICanvas* gui = getNewGUI(title);
+ vector graphNames;
+ graphNames.push_back("Bar graph");
+ graphNames.push_back("Solid Body graph");
+ graphNames.push_back("Line fade graph");
+
+ gui->addRadio("Graph Selection", graphNames, OFX_UI_ORIENTATION_VERTICAL, dim*2, dim*2);
+ gui->addSpacer(length, 1);
+ gui->addRangeSlider("Graph X begin/end (percent)", 0, 1, &AbstractGraph::minGraphPercent, &AbstractGraph::maxGraphPercent, length, dim);
+
+
+ ofAddListener(gui->newGUIEvent, this, &GUI::graphGlobalGUIEvent);
finaliseCanvas(gui, true);
}
+
void GUI::addBarGraphDesignGUI()
{
string title = "BAR GRAPH DESIGN";
@@ -65,6 +79,8 @@ 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("Data0 red", 0, 255, &app->scene.barGraph.col0[0], length, dim);
gui->addSlider("Data0 green", 0, 255, &app->scene.barGraph.col0[1], length, dim);
@@ -79,6 +95,27 @@ void GUI::addBarGraphDesignGUI()
}
+void GUI::addBodyGraphDesignGUI()
+{
+ string title = "BODY GRAPH DESIGN";
+ ofxUICanvas* gui = getNewGUI(title);
+
+ 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("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 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("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 blue", 0, 255, &app->scene.bodyGraph.col1[2], length, dim);
+ gui->addSlider("Data1 alpha", 0, 255, &app->scene.bodyGraph.col1[3], length, dim);
+
+ finaliseCanvas(gui, true);
+}
+
+
void GUI::addGraphSimulationGUI()
{
string title = "SIMULATION";
@@ -177,6 +214,31 @@ void GUI::draw()
+void GUI::graphGlobalGUIEvent(ofxUIEventArgs &e)
+{
+ string name = e.widget->getName();
+ ofxUIToggle *toggle = (ofxUIToggle *) e.widget;
+
+ if (name == "Bar graph")
+ {
+ //ofxUIToggle *toggle = (ofxUIToggle *) e.widget;
+ if (toggle->getValue()) app->scene.activeGraph = &app->scene.barGraph;
+ }
+ else if (name == "Solid Body graph")
+ {
+ printf("------------------- Solid Body graph\n");
+ if (toggle->getValue()) app->scene.activeGraph = &app->scene.bodyGraph;
+ }
+ else if (name == "Line fade graph")
+ {
+ printf("------------------- Line fade graph\n");
+ //app->scene.activeGraph = &app->scene.lineGraph;
+ }
+}
+
+
+
+
void GUI::variousGUIEvent(ofxUIEventArgs &e)
{
string name = e.widget->getName();
diff --git a/of/Active Tripod/src/gui/GUI.h b/of/Active Tripod/src/gui/GUI.h
index 47bf035..aef1cb4 100644
--- a/of/Active Tripod/src/gui/GUI.h
+++ b/of/Active Tripod/src/gui/GUI.h
@@ -20,13 +20,15 @@ public:
virtual bool getVisible();
void addKeyboardShortcutsGUI();
- void addGraphAnimationGUI();
+ void addGraphGlobalGUI();
void addBarGraphDesignGUI();
+ void addBodyGraphDesignGUI();
void addGraphSimulationGUI();
void addBackgroundGUI();
void addHUDTextGUI();
void addVariousGUI();
+ void graphGlobalGUIEvent(ofxUIEventArgs &e);
void variousGUIEvent(ofxUIEventArgs &e);
virtual void update();
diff --git a/of/Active Tripod/src/testApp.cpp b/of/Active Tripod/src/testApp.cpp
index a22f8d9..fcab03d 100644
--- a/of/Active Tripod/src/testApp.cpp
+++ b/of/Active Tripod/src/testApp.cpp
@@ -2,24 +2,27 @@
// TODO
// ====
-// - Make graph system with 3 simple (for now) but different graphs that can be interchanged
-// - Add image to background and create a mask
-// - Use a shader to adjust image brightness/contrast and colour
-// -
-// - Add to config
-// - - IP address
-// - - Host name
-// - - App name
-//
-//
//
+// - 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
+// - Create text parsing system
+// - Tidy up the first graph
+// - Create animation system
+// - Make system to slow down data - The screen should show 15-20 minutes worth of data
+// - Create a single config file to be loaded from online location. It will contain IP address and host name
//
//
//
//
// NOTES
// =====
-// - Each publisher should have a unique number. There should be a config file kept in c:/ containing a unique ID
// - Check that the local data sources always have the same amount of data.
@@ -33,6 +36,7 @@ void testApp::setup()
ofEnableSmoothing();
ofSeedRandom(ofRandom(23243));
ofSetFullscreen(true);
+ ofSetVerticalSync(true);
dataManager.setup();
scene.setup();
diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp
index 52d50e9..8597358 100644
--- a/of/Active Tripod/src/visual/Scene.cpp
+++ b/of/Active Tripod/src/visual/Scene.cpp
@@ -14,21 +14,18 @@ void Scene::setup()
bgImg.loadImage("images/tanks.jpg");
rgbShader.load("shaders/RGBShader");
barGraph.setup();
+ bodyGraph.setup();
+ //activeGraph = &barGraph;
- text.loadFont("fonts/mplus-1c-regular.ttf", 8);
- //text.setLineLength(ofGetWidth() - margin * 2);
-
-
- xMargin = 500;
- yMargin = 400;
- lineLength = 200;
+ //text.loadFont("fonts/Roboto-Regular.ttf", 8);
+ text.loadFont("fonts/Roboto-Light.ttf", 8);
}
void Scene::update()
{
- barGraph.update();
+ activeGraph->update();
text.setLineLength(lineLength);
text.setLineSpacing(lineSpacing);
@@ -40,7 +37,7 @@ void Scene::update()
void Scene::draw()
{
drawVideo();
- barGraph.draw();
+ activeGraph->draw();
drawHUDBG();
drawHUDCopy();
}
diff --git a/of/Active Tripod/src/visual/Scene.h b/of/Active Tripod/src/visual/Scene.h
index e324e43..5e5950d 100644
--- a/of/Active Tripod/src/visual/Scene.h
+++ b/of/Active Tripod/src/visual/Scene.h
@@ -10,6 +10,7 @@
#include "ofMain.h"
#include "BarGraph.h"
+#include "BodyGraph.h"
#include "ofxFTGL.h"
class testApp;
@@ -25,12 +26,15 @@ public:
void drawHUDCopy();
void drawTextBox(string copy, string align);
void keyPressed(int key);
-
+
BarGraph barGraph;
+ BodyGraph bodyGraph;
ofShader rgbShader;
ofImage bgImg;
ofxFTGLSimpleLayout text;
+ AbstractGraph* activeGraph;
+
// video image vars
diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp
index 85139a8..87cff5f 100644
--- a/of/Active Tripod/src/visual/graph/AbstractGraph.cpp
+++ b/of/Active Tripod/src/visual/graph/AbstractGraph.cpp
@@ -8,6 +8,8 @@
#include "AbstractGraph.h"
+float AbstractGraph::minGraphPercent;
+float AbstractGraph::maxGraphPercent;
void AbstractGraph::setup()
{
@@ -27,14 +29,14 @@ void AbstractGraph::draw()
}
-void AbstractGraph::addNewData(vector newData)
+void AbstractGraph::addNewData(vector newData)
{
publisher0Data.push_back(newData[0]);
publisher1Data.push_back(newData[1]);
- maxData = ofGetWidth() / graphItemXGap;
+ maxData = (ofGetWidth() / graphItemXGap) * (AbstractGraph::maxGraphPercent - AbstractGraph::minGraphPercent);
- if (publisher0Data.size() > maxData && publisher0Data.size() > maxData)
+ while (publisher0Data.size() > maxData && publisher0Data.size() > maxData)
{
publisher0Data.erase(publisher0Data.begin());
publisher1Data.erase(publisher1Data.begin());
diff --git a/of/Active Tripod/src/visual/graph/AbstractGraph.h b/of/Active Tripod/src/visual/graph/AbstractGraph.h
index 4c20b45..386ff36 100644
--- a/of/Active Tripod/src/visual/graph/AbstractGraph.h
+++ b/of/Active Tripod/src/visual/graph/AbstractGraph.h
@@ -9,22 +9,25 @@
#pragma once
#include "ofMain.h"
+#include "DataManager.h"
class AbstractGraph
{
public:
void setup();
- void update();
- void draw();
- virtual void addNewData(vector newData);
+ virtual void update();
+ virtual void draw();
+ virtual void addNewData(vector newData);
- vector publisher0Data;
- vector publisher1Data;
+ vector publisher0Data;
+ vector publisher1Data;
int maxData; // calculated from graphWidth and graphItemXGap
+
+ static float minGraphPercent;
+ static float maxGraphPercent;
float graphItemXGap;
- ofPoint startPnt;
- int graphWidth;
- int graphHeight;
+
+ float graphHeightMax;
};
\ 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 6fb5a18..88ea5ab 100644
--- a/of/Active Tripod/src/visual/graph/BarGraph.cpp
+++ b/of/Active Tripod/src/visual/graph/BarGraph.cpp
@@ -1,14 +1,5 @@
-//
-// gui->cpp
-// emptyExample
-//
-// Created by James Alliban on 25/06/2013.
-//
-//
-
#include "BarGraph.h"
-
void BarGraph::setup()
{
AbstractGraph::setup();
@@ -26,18 +17,20 @@ void BarGraph::update()
void BarGraph::draw()
{
+ //printf("BarGraph::draw() - graphItemXGap = %f \n", graphItemXGap);
+
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();
+ //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();
}
}
@@ -50,16 +43,37 @@ void BarGraph::draw()
//ofCircle(i * graphItemXGap, publisher1Data[i], 5);
//ofPopStyle();
}
+
+ float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
+ float outputMin = (ofGetHeight() * 0.5) - graphHeightMax;
+ float outputMax = (ofGetHeight() * 0.5) + graphHeightMax;
for (int i = 0; i < publisher0Data.size() - 1; i++)
{
ofPushStyle();
+
ofMesh bar;
- bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5), publisher0Data[i], 0));
- bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5) + barWidth, publisher0Data[i], 0));
- bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5), publisher1Data[i], 0));
- bar.addVertex(ofVec3f(i * graphItemXGap - (barWidth * 0.5) + barWidth, publisher1Data[i], 0));
+ float rectTLX = i * graphItemXGap - (barWidth * 0.5) + xOffset;
+ float rectTLY = ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax);
+
+ float rectTRX = i * graphItemXGap - (barWidth * 0.5) + barWidth + xOffset;
+ float rectTRY = ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax);
+
+ float rectBLX = i * graphItemXGap - (barWidth * 0.5) + xOffset;
+ float rectBLY = ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax);
+
+ 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);
+
+ bar.addVertex(ofVec3f(rectTLX, rectTLY, 0));
+ bar.addVertex(ofVec3f(rectTRX, rectTRY, 0));
+ bar.addVertex(ofVec3f(rectBLX, rectBLY, 0));
+ bar.addVertex(ofVec3f(rectBRX, rectBRY, 0));
bar.addIndex(0);
bar.addIndex(1);
bar.addIndex(3);
@@ -84,7 +98,7 @@ void BarGraph::draw()
-void BarGraph::addNewData(vector newData)
+void BarGraph::addNewData(vector newData)
{
AbstractGraph::addNewData(newData);
}
\ No newline at end of file
diff --git a/of/Active Tripod/src/visual/graph/BarGraph.h b/of/Active Tripod/src/visual/graph/BarGraph.h
index 5ffa538..99d9a15 100644
--- a/of/Active Tripod/src/visual/graph/BarGraph.h
+++ b/of/Active Tripod/src/visual/graph/BarGraph.h
@@ -1,11 +1,3 @@
-//
-// BarGraph.h
-// emptyExample
-//
-// Created by James Alliban on 25/06/2013.
-//
-//
-
#pragma once
#include "ofMain.h"
@@ -15,13 +7,14 @@ class BarGraph : public AbstractGraph
{
public:
void setup();
- void update();
- void draw();
- virtual void addNewData(vector newData);
+ virtual void update();
+ virtual void draw();
+ virtual void addNewData(vector newData);
float barWidth;
float col0[4];
float col1[4];
+
};
\ 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
new file mode 100644
index 0000000..8a8e9db
--- /dev/null
+++ b/of/Active Tripod/src/visual/graph/BodyGraph.cpp
@@ -0,0 +1,73 @@
+//
+// Created by James Alliban on 08/01/2014.
+//
+//
+
+#include "BodyGraph.h"
+
+
+void BodyGraph::setup()
+{
+ AbstractGraph::setup();
+}
+
+
+void BodyGraph::update()
+{
+// if (ofGetFrameNum() % 30 == 0)
+// printf("publisher0Data.size():%i \n", publisher0Data.size());
+}
+
+
+void BodyGraph::draw()
+{
+ if (publisher0Data.size() > 1)
+ {
+ //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();
+ //}
+
+
+ ofMesh body;
+ body.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
+ for (int i = 0; i < publisher0Data.size() - 1; i++)
+ {
+ //body.addVertex(ofVec3f(i * graphItemXGap, publisher0Data[i], 0));
+ //body.addVertex(ofVec3f(i * graphItemXGap, publisher1Data[i], 0));
+
+ body.addColor(ofColor(col0[0],col0[1],col0[2], col0[3]));
+ body.addColor(ofColor(col1[0],col1[1],col1[2], col1[3]));
+ }
+
+ body.drawFaces();
+
+
+ for (int i = 0; i < publisher0Data.size() - 1; i++)
+ {
+ if (i < publisher0Data.size() - 2)
+ {
+ //ofPushStyle();
+ //ofSetLineWidth(lineWidth);
+ //ofSetColor(col0[0],col0[1],col0[2], 255);
+ //ofLine(i * graphItemXGap, publisher0Data[i], (i + 1) * graphItemXGap, publisher0Data[i + 1]);
+ //ofSetColor(col1[0],col1[1],col1[2], 255);
+ //ofLine(i * graphItemXGap, publisher1Data[i], (i + 1) * graphItemXGap, publisher1Data[i + 1]);
+ //ofPopStyle();
+ }
+ }
+
+ }
+}
+
+
+
+void BodyGraph::addNewData(vector newData)
+{
+ AbstractGraph::addNewData(newData);
+}
\ No newline at end of file
diff --git a/of/Active Tripod/src/visual/graph/BodyGraph.h b/of/Active Tripod/src/visual/graph/BodyGraph.h
new file mode 100644
index 0000000..2743edd
--- /dev/null
+++ b/of/Active Tripod/src/visual/graph/BodyGraph.h
@@ -0,0 +1,20 @@
+
+#pragma once
+
+#include "ofMain.h"
+#include "AbstractGraph.h"
+
+class BodyGraph : public AbstractGraph
+{
+public:
+ void setup();
+ virtual void update();
+ virtual void draw();
+ virtual void addNewData(vector newData);
+
+ float barWidth;
+ float lineWidth;
+
+ float col0[4];
+ float col1[4];
+};
\ No newline at end of file