Configurable crosshairs added

- Unit measure appended to graph values
This commit is contained in:
James Alliban
2014-01-12 20:08:05 +00:00
parent 1111d2f7e5
commit 96cadd932f
130 changed files with 5563 additions and 315 deletions
+3
View File
@@ -0,0 +1,3 @@
//#define IS_DATA_SIMULATED
+173
View File
@@ -0,0 +1,173 @@
#include "DataManager.h"
#include "testApp.h"
#include "Globals.h"
void DataManager::setup()
{
app = (testApp*)ofGetAppPtr();
newData.resize(2);
//isPublisher0DataReceived = false;
//isPublisher1DataReceived = false;
setupSpacebrew();
nextDataSendTime = 0.1;
}
void DataManager::setupSpacebrew()
{
string host = "54.194.189.129"; // Spacebrew::SPACEBREW_CLOUD; // "localhost";
string name = "CRITICAL INFRASTRUCTURE UTILITY BOX";
string description = "Description goes here. Not sure why. Let me know if you see this and tell me if you need it";
for (int i = 0; i < 30; i++)
{
spacebrew.addSubscribe(ofToString(i), Spacebrew::TYPE_STRING);
}
spacebrew.connect( host, name, description );
// listen to spacebrew events
Spacebrew::addListener(this, spacebrew);
}
void DataManager::update()
{
if (isDataSimulated)
{
if (ofGetFrameNum() % (int)simulationSpeed == 0)
{
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.addNewData(newData);
}*/
//sendDataSpeed = app->scene.activeGraph->sendDataSpeed;
if (ofGetElapsedTimef() >= nextDataSendTime + app->scene.activeGraph->sendDataSpeed)
{
nextDataSendTime += app->scene.activeGraph->sendDataSpeed;
app->scene.addNewData(newData);
}
}
}
void DataManager::draw()
{
ofPushStyle();
ofSetColor(255, 0, 0);
ofCircle(sin(ofGetElapsedTimef() * 0.5) * 300 + 300, 100, 20);
ofPopStyle();
}
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<string> data = explode(",", m.valueString());
//for(int i = 0; i < data.size(); i++)
// cout <<i << " ["<< data[i] <<"] " <<endl;
// make a new data object and add the different data sources to it
DataObject dataObject;
for (int i = 0; i < data.size(); i++)
{
if (data[i].substr(0, 5) == "info:")
{
//printf("- - info = %s\n", data[i].substr(5, -1).c_str());
dataObject.info = data[i].substr(5, -1).c_str();
}
if (data[i].substr(0, 6) == "value:")
{
//printf("- - value = %s\n", data[i].substr(6, -1).c_str());
dataObject.value = ofToFloat(data[i].substr(6, -1).c_str());
}
if (data[i].substr(0, 4) == "min:")
{
//printf("- - min = %s\n", data[i].substr(4, -1).c_str());
dataObject.min = ofToFloat(data[i].substr(4, -1).c_str());
}
if (data[i].substr(0, 4) == "max:")
{
//printf("- - max = %s\n", data[i].substr(4, -1).c_str());
dataObject.max = ofToFloat(data[i].substr(4, -1).c_str());
}
}
if (m.name == publisher0Name)
{
//isPublisher0DataReceived = true;
newData[0] = dataObject;
}
else if (m.name == publisher1Name)
{
//isPublisher1DataReceived = true;
newData[1] = dataObject;
}
}
vector<string> DataManager::explode(const string &delimiter, const string &str)
{
vector<string> arr;
int strleng = str.length();
int delleng = delimiter.length();
if (delleng==0)
return arr;//no change
int i=0;
int k=0;
while( i<strleng )
{
int j=0;
while (i+j<strleng && j<delleng && str[i+j]==delimiter[j])
j++;
if (j==delleng)//found delimiter
{
arr.push_back( str.substr(k, i-k) );
i+=delleng;
k=i;
}
else
{
i++;
}
}
arr.push_back( str.substr(k, i-k) );
return arr;
}
+51
View File
@@ -0,0 +1,51 @@
#pragma once
#include "ofMain.h"
#include "ofxSpacebrew.h"
#include "ofMain.h"
#include "ofxSpacebrew.h"
class testApp;
struct DataObject
{
string info;
float value;
float min;
float max;
};
class DataManager
{
public:
void setup();
void setupSpacebrew();
void update();
void draw();
vector<string> explode( const string &delimiter, const string &str);
// listen to spacebrew Messages
void onMessage( Spacebrew::Message & m );
testApp* app;
int appId;
// create your spacebrew object
Spacebrew::Connection spacebrew;
vector<DataObject> newData;
//bool isPublisher0DataReceived;
//bool isPublisher1DataReceived;
bool isDataSimulated;
float perlinXScale;
float perlinYScale;
float simulationSpeed;
float nextDataSendTime;
};
+325
View File
@@ -0,0 +1,325 @@
//
// gui->cpp
// emptyExample
//
// Created by James Alliban on 25/06/2013.
//
//
#include "GUI.h"
#include "testApp.h"
#include "AbstractGraph.h"
void GUI::setup()
{
app = (testApp*)ofGetAppPtr();
GUIManager::setup();
dim = 8;
addKeyboardShortcutsGUI();
addGraphGlobalGUI();
addBarGraphDesignGUI();
addBodyGraphDesignGUI();
addSeparateBodyGraphDesignGUI();
addGraphSimulationGUI();
addBackgroundGUI();
addHUDTextGUI();
addVariousGUI();
setGUIColour();
}
bool GUI::getVisible()
{
return GUIManager::getVisible();
}
void GUI::addKeyboardShortcutsGUI()
{
string title = "KEYBOARD SHORTCUTS";
ofxUICanvas* gui = getNewGUI(title);
gui->addLabel("SPACE - SHOW/HIDE GUI", OFX_UI_FONT_SMALL);
gui->addLabel("'[' - PREVIOUS GUI", OFX_UI_FONT_SMALL);
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);
}
void GUI::addGraphGlobalGUI()
{
string title = "GRAPH GLOBAL";
ofxUICanvas* gui = getNewGUI(title);
vector<string> graphNames;
graphNames.push_back("Bar graph");
graphNames.push_back("Solid Body graph");
graphNames.push_back("Separate Body 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);
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);
}
void GUI::addBarGraphDesignGUI()
{
string title = "BAR GRAPH DESIGN";
ofxUICanvas* gui = getNewGUI(title);
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", 0, 1, &app->scene.barGraph.graphHeightMax, length, dim);
gui->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.barGraph.sendDataSpeed, length, dim);
gui->addSpacer(length, 1);
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 blue", 0, 255, &app->scene.barGraph.col0[2], 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 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 alpha", 0, 255, &app->scene.barGraph.col1[3], length, dim);
finaliseCanvas(gui, true);
}
void GUI::addBodyGraphDesignGUI()
{
string title = "BODY GRAPH DESIGN";
ofxUICanvas* gui = getNewGUI(title);
gui->addToggle("Toggle Draw Body", &app->scene.bodyGraph.isDrawBody, toggleDim, toggleDim);
gui->addToggle("Toggle Draw Lines", &app->scene.bodyGraph.isDrawLines, toggleDim, toggleDim);
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("Graph Height Max", 0, 1, &app->scene.bodyGraph.graphHeightMax, length, dim);
gui->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.bodyGraph.sendDataSpeed, length, dim);
gui->addSpacer(length, 1);
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->addSpacer(length, 1);
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::addSeparateBodyGraphDesignGUI()
{
string title = "SEPARATE BODY GRAPH DESIGN";
ofxUICanvas* gui = getNewGUI(title);
gui->addToggle("Toggle Draw Lines", &app->scene.separateBodyGraph.isDrawLines, toggleDim, toggleDim);
gui->addSlider("Graph Item X Gap", 5, 50, &app->scene.separateBodyGraph.graphItemXGap, length, dim);
gui->addSlider("Line width", 1, 50, &app->scene.separateBodyGraph.lineWidth, length, dim);
gui->addSlider("Graph Height Max", 0, 1, &app->scene.separateBodyGraph.graphHeightMax, length, dim);
gui->addSlider("Graph bottom end (percent)", 0, 2, &app->scene.separateBodyGraph.graphEndPercent, length, dim);
gui->addSlider("Data send speed (seconds)", 0.1, 20, &app->scene.separateBodyGraph.sendDataSpeed, length, dim);
gui->addSpacer(length, 1);
gui->addSlider("Data0 red", 0, 255, &app->scene.separateBodyGraph.col0[0], length, dim);
gui->addSlider("Data0 green", 0, 255, &app->scene.separateBodyGraph.col0[1], length, dim);
gui->addSlider("Data0 blue", 0, 255, &app->scene.separateBodyGraph.col0[2], length, dim);
gui->addSlider("Data0 alpha", 0, 255, &app->scene.separateBodyGraph.col0[3], length, dim);
gui->addSpacer(length, 1);
gui->addSlider("Data1 red", 0, 255, &app->scene.separateBodyGraph.col1[0], length, dim);
gui->addSlider("Data1 green", 0, 255, &app->scene.separateBodyGraph.col1[1], length, dim);
gui->addSlider("Data1 blue", 0, 255, &app->scene.separateBodyGraph.col1[2], length, dim);
gui->addSlider("Data1 alpha", 0, 255, &app->scene.separateBodyGraph.col1[3], length, dim);
finaliseCanvas(gui, true);
}
void GUI::addGraphSimulationGUI()
{
string title = "SIMULATION";
ofxUICanvas* gui = getNewGUI(title);
gui->addToggle("Toggle Data Simulation", &app->dataManager.isDataSimulated, toggleDim, toggleDim);
gui->addSlider("Speed (data per frame)", 1, 60, &app->dataManager.simulationSpeed, length, dim);
gui->addSlider("Perlin X Scale (data size)", 0.001, 0.5, &app->dataManager.perlinXScale, length, dim);
gui->addSlider("Perlin Y Scale (time f)", 0.001, 0.5, &app->dataManager.perlinYScale, length, dim);
finaliseCanvas(gui, true);
}
void GUI::addBackgroundGUI()
{
string title = "BACKGROUND";
ofxUICanvas* gui = getNewGUI(title);
gui->addToggle("Toggle Video Visibility", &app->scene.isVideoVisible, toggleDim, toggleDim);
gui->addToggle("Toggle Image Visibility", &app->scene.isImageVisible, toggleDim, toggleDim);
gui->addSlider("Video/Image Width Percent", 0, 2, &app->scene.videoWidthPercentage, length, dim);
gui->addSlider("Video/Image Height Percent", 0, 2, &app->scene.videoHeightPercentage, length, dim);
gui->addLabel("VIDEO IMAGE SETTINGS");
gui->addSlider("Brightness", 0, 2, &app->scene.brightness, length, dim);
gui->addSlider("Contrast", 0, 2, &app->scene.contrast, length, dim);
gui->addSlider("Saturation", 0, 2, &app->scene.saturation, length, dim);
gui->addSlider("Red", 0, 2, &app->scene.red, length, dim);
gui->addSlider("Green", 0, 2, &app->scene.green, length, dim);
gui->addSlider("Blue", 0, 2, &app->scene.blue, length, dim);
gui->addSlider("Alpha", 0, 2, &app->scene.alpha, length, dim);
gui->addSpacer(length, 1);
gui->addLabel("HUD BACKGROUND SETTINGS");
gui->addSlider("Red .", 0, 255, &app->scene.hudColour[0], length, dim);
gui->addSlider("Green .", 0, 255, &app->scene.hudColour[1], length, dim);
gui->addSlider("Blue .", 0, 255, &app->scene.hudColour[2], length, dim);
gui->addSlider("Alpha .", 0, 255, &app->scene.hudColour[3], length, dim);
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);
}
void GUI::addHUDTextGUI()
{
string title = "HUD TEXT";
ofxUICanvas* gui = getNewGUI(title);
gui->addSlider("X Margin", 0, 500, &app->scene.xMargin, length, dim);
gui->addSlider("Y Margin", 0, 500, &app->scene.yMargin, length, dim);
gui->addSlider("Y Margin Bottom Offset", 0, 300, &app->scene.yMarginBottomOffset, length, dim);
gui->addSlider("Line Length", 50, 500, &app->scene.lineLength, length, dim);
gui->addSlider("Line Spacing", 0, 10, &app->scene.lineSpacing, length, dim);
gui->addSlider("Text Size", 10, 100, &app->scene.textSize, length, dim);
gui->addSlider("Value average amount", 2, 150, &app->scene.averageAmount, length, dim);
gui->addSpacer(length, 1);
gui->addSlider("Red", 0, 255, &app->scene.textColour[0], length, dim);
gui->addSlider("Green", 0, 255, &app->scene.textColour[1], length, dim);
gui->addSlider("Blue", 0, 255, &app->scene.textColour[2], length, dim);
gui->addSlider("Alpha", 0, 255, &app->scene.textColour[3], length, dim);
gui->addSpacer(length, 1);
gui->addLabel("COLOUR KEY");
gui->addSlider("Top Colour Box Y Offset", -300, 300, &app->scene.topColourBoxXOffset, length, dim);
gui->addSlider("Bottom Colour Box Y Offset", -300, 300, &app->scene.bottomColourBoxXOffset, length, dim);
gui->addSlider("Colour Box Thickness", 1, 50, &app->scene.colourBoxThickness, length, dim);
ofAddListener(gui->newGUIEvent, this, &GUI::variousGUIEvent);
finaliseCanvas(gui, true);
}
void GUI::addVariousGUI()
{
string title = "VARIOUS";
ofxUICanvas* gui = getNewGUI(title);
//gui->addLabel("GRID");
//gui->addToggle("GRID VISIBLE", &app->scene.isGridVisible, toggleDim, toggleDim);
//gui->addSlider("GRID ALPHA", 0, 255, &app->scene.gridAlpha, length, dim);
gui->addLabel("GUI DESIGN");
gui->addSlider("RED", 0, 255, 255, length, dim);
gui->addSlider("GREEN", 0, 255, 1, length, dim);
gui->addSlider("BLUE", 0, 255, 1, length, dim);
gui->addSlider("ALPHA", 0, 255, 255, length, dim);
ofAddListener(gui->newGUIEvent, this, &GUI::variousGUIEvent);
finaliseCanvas(gui, true);
}
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 == "Separate Body graph")
{
printf("------------------- Line fade graph\n");
if (toggle->getValue()) app->scene.activeGraph = &app->scene.separateBodyGraph;
}
}
void GUI::variousGUIEvent(ofxUIEventArgs &e)
{
string name = e.widget->getName();
if (name == "RED")
{
ofxUISlider *slider = (ofxUISlider *) e.widget;
color.r = slider->getScaledValue();
setGUIColour();
}
else if (name == "GREEN")
{
ofxUISlider *slider = (ofxUISlider *) e.widget;
color.g = slider->getScaledValue();
setGUIColour();
}
else if (name == "BLUE")
{
ofxUISlider *slider = (ofxUISlider *) e.widget;
color.b = slider->getScaledValue();
setGUIColour();
}
else if (name == "ALPHA")
{
ofxUISlider *slider = (ofxUISlider *) e.widget;
color.a = slider->getScaledValue();
setGUIColour();
}
}
+39
View File
@@ -0,0 +1,39 @@
//
// GUI.h
// emptyExample
//
// Created by James Alliban on 25/06/2013.
//
//
#pragma once
#include "ofMain.h"
#include "GUIManager.h"
class testApp;
class GUI : GUIManager
{
public:
virtual void setup();
virtual bool getVisible();
void addKeyboardShortcutsGUI();
void addGraphGlobalGUI();
void addBarGraphDesignGUI();
void addBodyGraphDesignGUI();
void addSeparateBodyGraphDesignGUI();
void addGraphSimulationGUI();
void addBackgroundGUI();
void addHUDTextGUI();
void addVariousGUI();
void graphGlobalGUIEvent(ofxUIEventArgs &e);
void variousGUIEvent(ofxUIEventArgs &e);
testApp* app;
vector<string> publishers;
};
+204
View File
@@ -0,0 +1,204 @@
//
// GUIManager.cpp
//
// Created by James Alliban on 25/06/2013.
//
#include "GUIManager.h"
void GUIManager::setup()
{
ofAddListener(ofEvents().keyPressed, this, &GUIManager::keyPressed);
ofAddListener(ofEvents().exit, this, &GUIManager::exit);
currentUIID = 0;
dim = 16;
toggleDim = 16;
canvasW = 320;
canvasH = ofGetScreenHeight();
xInit = OFX_UI_GLOBAL_WIDGET_SPACING;
length = canvasW - xInit* 2;
toggleSize = 32;
spacerW = canvasW - xInit* 2;
spacerH = 1;
color = ofColor(100, 100, 210, 230);
isVisible = false;
isAutoSave = true;
buildTopBarGUI();
}
bool GUIManager::getVisible()
{
return isVisible;
}
void GUIManager::buildTopBarGUI()
{
topBarGui = new ofxUICanvas(canvasW, 0, 600, 146);
topBarGui->setColorBack(color);
topBarGui->setName(TOP_TITLE);
topBarGui->addWidgetRight(new ofxUIFPS(OFX_UI_FONT_MEDIUM));
topBarGui->addWidgetRight(new ofxUILabelToggle(true, TOP_AUTO_SAVE));
topBarGui->addWidgetRight(new ofxUILabelButton(false, TOP_SAVE));
topBarGui->addWidgetRight(new ofxUILabelButton(false, TOP_PREVIOUS));
topBarGui->addWidgetRight(new ofxUILabelButton(false, TOP_NEXT));
topBarGui->autoSizeToFitWidgets();
ofAddListener(topBarGui->newGUIEvent, this, &GUIManager::topBarGUIEvent);
finaliseCanvas(topBarGui, false);
}
ofxUICanvas* GUIManager::getNewGUI(string title)
{
ofxUICanvas* gui = new ofxUICanvas(0, 0, canvasW, canvasH);
gui->setColorBack(color);
gui->setName(title);
gui->addWidgetDown(new ofxUILabel(gui->getName(), OFX_UI_FONT_MEDIUM));
gui->addSpacer(spacerW, spacerH);
return gui;
}
void GUIManager::finaliseCanvas(ofxUICanvas* gui, bool isAddedToArray)
{
string name = gui->getName();
string xmlPath = "GUI/" + name + "GuiPageSettings.xml";
gui->loadSettings(xmlPath);
gui->setVisible(false);
gui->autoSizeToFitWidgets();
if (isAddedToArray) guiPages.push_back(gui);
}
void GUIManager::topBarGUIEvent(ofxUIEventArgs &e) //---------------- Top bar
{
string name = e.widget->getName();
if (name == TOP_AUTO_SAVE)
{
ofxUIToggle *toggle = (ofxUIToggle *)e.widget;
isAutoSave = toggle->getValue();
}
else if (name == TOP_SAVE)
{
saveSettings();
}
else if (name == TOP_NEXT)
{
ofxUIButton *button = (ofxUIButton *)e.widget;
if (button->getValue()) nextPage();
}
else if (name == TOP_PREVIOUS)
{
ofxUIButton *button = (ofxUIButton *)e.widget;
if (button->getValue()) previousPage();
}
}
void GUIManager::keyPressed(ofKeyEventArgs& eventArgs) //int key)
{
printf("keyPressed - key = %c \n", eventArgs.key);
switch (eventArgs.key)
{
case '[':
previousPage();
break;
case ']':
nextPage();
break;
case ' ':
toggleVisible();
}
}
void GUIManager::nextPage()
{
printf("next\n");
++currentUIID;
showGUI();
}
void GUIManager::previousPage()
{
printf("prev\n");
--currentUIID;
if (currentUIID < 0) currentUIID = guiPages.size() - 1;
showGUI();
}
void GUIManager::showGUI()
{
for (int i = 0; i < (int)guiPages.size(); i++)
{
guiPages[i]->setVisible(false);
}
isVisible = true;
if (guiPages.size() > 0)
{
int newVisibleGUIID = currentUIID % (int)guiPages.size();
guiPages[newVisibleGUIID]->setVisible(true);
}
topBarGui->setVisible(true);
}
void GUIManager::toggleVisible()
{
isVisible = !isVisible;
if (isVisible)
{
showGUI();
}
else
{
for (int i = 0; i < (int)guiPages.size(); i++)
{
guiPages[i]->setVisible(false);
}
topBarGui->setVisible(false);
}
}
void GUIManager::saveSettings()
{
for (int i = 0; i < (int)guiPages.size(); i++)
{
string xmlPath = "GUI/" + guiPages[i]->getName() + "guiPagesettings.xml";
guiPages[i]->saveSettings(xmlPath);
}
//topBarGui->saveSettings("GUI/" + topBarGui->getName() + "guiPagesettings.xml");
}
void GUIManager::setGUIColour()
{
for (int i = 0; i < (int)guiPages.size(); i++)
{
guiPages[i]->setColorBack(color);
}
topBarGui->setColorBack(color);
}
void GUIManager::exit(ofEventArgs& eventArgs)
{
if (isAutoSave) saveSettings();
delete topBarGui;
for (int i = 0; i < guiPages.size(); i++)
delete guiPages[i];
}
+67
View File
@@ -0,0 +1,67 @@
//
// GUIManager.h
//
// Created by James Alliban on 25/06/2013.
//
#pragma once
#include "ofMain.h"
#include "ofEvents.h"
#include "ofxUI.h"
// gui titles
#define TOP_TITLE "TOP"
#define TOP_AUTO_SAVE "AUTO SAVE"
#define TOP_SAVE "SAVE"
#define TOP_NEXT "NEXT"
#define TOP_PREVIOUS "PREV"
class GUIManager
{
public:
//GUIManager();
virtual void setup();
virtual bool getVisible();
ofColor color;
protected:
virtual void buildTopBarGUI();
virtual ofxUICanvas* getNewGUI(string title);
virtual void keyPressed(ofKeyEventArgs& eventArgs);
virtual void exit(ofEventArgs& eventArgs);
virtual void finaliseCanvas(ofxUICanvas* gui, bool isAddedToArray);
virtual void topBarGUIEvent(ofxUIEventArgs &e);
void guiEvent(ofxUIEventArgs &e);
void nextPage();
void previousPage();
void showGUI();
void toggleVisible();
void saveSettings();
void setGUIColour();
ofxUICanvas* topBarGui;
vector<ofxUICanvas *> guiPages;
int currentUIID;
float dim;
float toggleDim;
float xInit;
float length;
float canvasW;
float canvasH;
float toggleSize;
float spacerW, spacerH;
bool isVisible;
bool isAutoSave;
};
+1 -1
View File
@@ -6,7 +6,7 @@
int main( ){
ofAppGlutWindow window;
ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context
ofSetupOpenGL(&window, 1400, 1024, OF_WINDOW); // <-------- setup the GL context
// this kicks off the running of my app
// can be OF_WINDOW or OF_FULLSCREEN
+51 -68
View File
@@ -1,83 +1,66 @@
#include "testApp.h"
// TODO
// ====
// - 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(){
ofSetFrameRate(60);
string host = Spacebrew::SPACEBREW_CLOUD; // "localhost";
string name = "of-button-example";
string description = "It's amazing";
spacebrew.addPublish("button", Spacebrew::TYPE_BOOLEAN);
spacebrew.addSubscribe("backgroundOn", Spacebrew::TYPE_BOOLEAN); //"boolean" ); // just typing "boolean" also works
spacebrew.connect( host, name, description );
// listen to spacebrew events
Spacebrew::addListener(this, spacebrew);
// circle stuff
bButtonPressed = false;
radius = 200;
// background
bBackgroundOn = false;
// layout stuff
ofBackground(0);
ofSetRectMode(OF_RECTMODE_CENTER);
ofEnableSmoothing();
ofSetCircleResolution(100);
void testApp::setup()
{
ofSetFrameRate(30);
ofSetLogLevel(OF_LOG_SILENT);
ofSetWindowPosition(0, 100);
ofEnableSmoothing();
ofSeedRandom(ofRandom(23243));
ofSetFullscreen(true);
ofSetVerticalSync(true);
dataManager.setup();
scene.setup();
gui.setup();
isPaused = false;
}
//--------------------------------------------------------------
void testApp::update(){}
//--------------------------------------------------------------
void testApp::draw(){
if ( !bBackgroundOn ){
ofBackgroundGradient(ofColor(0,0,0), ofColor(50,50,50));
} else {
ofBackgroundGradient(ofColor(100,0,0), ofColor(150,150,0));
}
string textToDraw = "PRESS ME";
if ( bButtonPressed ){
ofSetColor( 150, 0, 0 );
textToDraw = "THANKS";
} else {
ofSetColor(150);
}
ofCircle(ofGetWidth() / 2.0f, ofGetHeight()/2.0f, radius);
ofSetColor(255);
ofDrawBitmapString(textToDraw, ofGetWidth() / 2.0f - 30, ofGetHeight()/2.0f);
void testApp::update()
{
if (isPaused) return;
dataManager.update();
scene.update();
//if (gui.isVisible())
}
//--------------------------------------------------------------
void testApp::onMessage( Spacebrew::Message & m ){
if ( m.name == "backgroundOn" ){
bBackgroundOn = m.valueBoolean();
}
void testApp::draw()
{
dataManager.draw();
scene.draw();
}
//--------------------------------------------------------------
void testApp::mousePressed(int x, int y, int button){
if ( checkInsideCircle( ofPoint(x,y), ofPoint(ofGetWidth() / 2.0f, ofGetHeight()/2.0f), radius) ){
bButtonPressed = true;
spacebrew.sendBoolean("button", true);
}
void testApp::mousePressed(int x, int y, int button)
{
}
//--------------------------------------------------------------
void testApp::mouseReleased(int x, int y, int button){
if (bButtonPressed){
spacebrew.sendBoolean("button", false);
}
bButtonPressed = false;
void testApp::keyPressed(int key)
{
if (key == 'p')
isPaused = !isPaused;
else if (key == 'f')
ofToggleFullscreen();
else if (key == 'c')
scene.clearGraphData();
scene.keyPressed(key);
}
//--------------------------------------------------------------
bool testApp::checkInsideCircle( ofPoint point, ofPoint position, int radius ){
return ( point.x < position.x + radius
&& point.x > position.x - radius
&& point.y < position.y + radius
&& point.y > position.y - radius );
void testApp::windowResized(int w, int h)
{
}
+11 -17
View File
@@ -2,7 +2,9 @@
#include "ofMain.h"
#include "ofxSpacebrew.h"
#include "DataManager.h"
#include "Scene.h"
#include "GUI.h"
class testApp : public ofBaseApp{
@@ -10,21 +12,13 @@ class testApp : public ofBaseApp{
void setup();
void update();
void draw();
void mousePressed(int x, int y, int button);
void mouseReleased(int x, int y, int button);
// create your spacebrew object
Spacebrew::Connection spacebrew;
// listen to spacebrew Messages
void onMessage( Spacebrew::Message & m );
// button stuff
int radius;
bool bButtonPressed;
bool bBackgroundOn;
// useful quick test
bool checkInsideCircle( ofPoint point, ofPoint position, int radius );
void keyPressed(int key);
void windowResized(int w, int h);
DataManager dataManager;
Scene scene;
GUI gui;
bool isPaused;
};
+253
View File
@@ -0,0 +1,253 @@
//
// gui->cpp
// emptyExample
//
// Created by James Alliban on 25/06/2013.
//
//
#include "Scene.h"
void Scene::setup()
{
vidGrabber.initGrabber(1280, 720);
vidGrabber.setDesiredFrameRate(30);
bgImg.loadImage("images/tanks.jpg");
rgbShader.load("shaders/RGBShader");
barGraph.setup();
bodyGraph.setup();
separateBodyGraph.setup();
text.loadFont("fonts/Roboto-Light.ttf", 8);
}
void Scene::update()
{
vidGrabber.update();
activeGraph->update();
}
void Scene::draw()
{
drawVideo();
activeGraph->draw();
drawGraphValues();
drawCrosshairs();
drawHUDBG();
drawHUDCopy();
drawHUDColourBars();
}
void Scene::drawVideo()
{
rgbShader.begin();
rgbShader.setUniform1f("brightness", brightness);
rgbShader.setUniform1f("contrast", contrast);
rgbShader.setUniform1f("saturation", saturation);
rgbShader.setUniform1f("red", red);
rgbShader.setUniform1f("green", green);
rgbShader.setUniform1f("blue", blue);
rgbShader.setUniform1f("alpha", alpha);
float vidW = ofGetWidth() * videoWidthPercentage;
float vidH = ofGetHeight() * videoHeightPercentage;
ofPushMatrix();
ofTranslate((ofGetWidth() - vidW) * 0.5, (ofGetHeight() - vidH) * 0.5);
if (isVideoVisible)
vidGrabber.draw(0, 0, vidW, vidH);
if (isImageVisible)
bgImg.draw(0, 0, vidW, vidH);
ofPopMatrix();
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();
ofSetColor(hudColour[0], hudColour[1], hudColour[2], hudColour[3]);
ofBeginShape();
ofVertex(0, 0);
ofVertex(ofGetWidth(), 0);
ofVertex(ofGetWidth(), ofGetHeight());
ofVertex(0, ofGetHeight());
ofNextContour(true);
float radiusW = (ofGetWidth() * 0.5) * hudHoleWidthPercentage;
float radiusH = (ofGetHeight() * 0.5) * hudHoleHeightPercentage;
for (int i = 0; i < (int)circlePointSize; i++)
{
float x = (ofGetWidth() * 0.5) + cos(((float)i / (int)circlePointSize) * TWO_PI) * radiusW;
float y = (ofGetHeight() * 0.5) + sin(((float)i / (int)circlePointSize) * TWO_PI) * radiusH;
ofVertex(x, y);
}
ofEndShape(true);
ofPopStyle();
ofFill();
}
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;
int amountToAverage = MIN(p0Data->size(), averageAmount);
if (p0Data->size() > 2)
{
float average0 = 0;
for (int i = 0; i < (int)amountToAverage; i++)
average0 += p0Data->at(p0Data->size() - i - 1).value;
average0 /= (int)amountToAverage;
// (p0Data->back() + p0Data->at(p0Data->size() - 2) + p0Data->at(p0Data->size() - 2))
blStr = "Increase: " + ofToString(p0Data->back().value - p0Data->at(p0Data->size() - 2).value) + "\n" +
"Current Value: " + ofToString(p0Data->back().value) + "\n" +
"Running average: " + ofToString(average0);
drawTextBox(blStr, "BOTTOM LEFT");
float average1 = 0;
for (int i = 0; i < (int)amountToAverage; i++)
average1 += p1Data->at(p1Data->size() - i - 1).value;
average1 /= (int)amountToAverage;
brStr = "Increase: " + ofToString(p1Data->back().value - p1Data->at(p1Data->size() - 2).value) + "\n" +
"Current Value: " + ofToString(p1Data->back().value) + "\n" +
"Running average: " + ofToString(average1);
drawTextBox(brStr, "BOTTOM RIGHT");
}
}
void Scene::drawTextBox(string copy, string align)
{
ofPushStyle();
ofSetColor(textColour[0], textColour[1], textColour[2], textColour[3]);
ofPushMatrix();
if (align == "TOP LEFT")
{
text.setAlignment(FTGL_ALIGN_LEFT);
ofTranslate(xMargin, yMargin);
}
else if (align == "TOP RIGHT")
{
text.setAlignment(FTGL_ALIGN_RIGHT);
ofTranslate(ofGetWidth() - xMargin - lineLength, yMargin);
}
else if (align == "BOTTOM LEFT")
{
ofTranslate(xMargin, ofGetHeight() - yMargin - yMarginBottomOffset);
text.setAlignment(FTGL_ALIGN_LEFT);
}
if (align == "BOTTOM RIGHT")
{
text.setAlignment(FTGL_ALIGN_RIGHT);
ofTranslate(ofGetWidth() - xMargin - lineLength, ofGetHeight() - yMargin - yMarginBottomOffset);
}
text.drawString(copy, 0, 0);
//printf("%s text.getXHeight() = %f\n", align.c_str(), text.getStringBoundingBox(copy, xMargin, yMargin));
ofPopMatrix();
ofPopStyle();
}
void Scene::drawHUDColourBars()
{
ofPushStyle();
ofSetColor(activeGraph->col0[0], activeGraph->col0[1], activeGraph->col0[2], activeGraph->col0[3]);
ofRect(xMargin, yMargin + topColourBoxXOffset, lineLength, colourBoxThickness);
ofSetColor(activeGraph->col0[0], activeGraph->col0[1], activeGraph->col0[2], activeGraph->col0[3]);
ofRect(xMargin, ofGetHeight() - yMargin - yMarginBottomOffset + bottomColourBoxXOffset, lineLength, colourBoxThickness);
ofSetColor(activeGraph->col1[0], activeGraph->col1[1], activeGraph->col1[2], activeGraph->col1[3]);
ofRect(ofGetWidth() - xMargin - lineLength, yMargin + topColourBoxXOffset, lineLength, colourBoxThickness);
ofSetColor(activeGraph->col1[0], activeGraph->col1[1], activeGraph->col1[2], activeGraph->col1[3]);
ofRect(ofGetWidth() - xMargin - lineLength, ofGetHeight() - yMargin - yMarginBottomOffset + bottomColourBoxXOffset, lineLength, colourBoxThickness);
ofPopStyle();
}
void Scene::addNewData(vector<DataObject> newData)
{
barGraph.addNewData(newData);
bodyGraph.addNewData(newData);
separateBodyGraph.addNewData(newData);
tlStr = newData[0].info + "\n" + ofToString(newData[0].value);
trStr = newData[1].info + "\n" + ofToString(newData[1].value);
millisAtLastData = ofGetElapsedTimeMillis();
}
void Scene::keyPressed(int key)
{
}
void Scene::clearGraphData()
{
barGraph.clear();
bodyGraph.clear();
separateBodyGraph.clear();
}
+98
View File
@@ -0,0 +1,98 @@
//
// GUI.h
// emptyExample
//
// Created by James Alliban on 25/06/2013.
//
//
#pragma once
#include "ofMain.h"
#include "BarGraph.h"
#include "BodyGraph.h"
#include "SeparateBodyGraph.h"
#include "DataManager.h"
#include "ofxFTGL.h"
class testApp;
class Scene
{
public:
void setup();
void update();
void draw();
void drawVideo();
void drawGraphValues();
void drawCrosshairs();
void drawHUDBG();
void drawHUDCopy();
void drawHUDColourBars();
void drawTextBox(string copy, string align);
void addNewData(vector<DataObject> newData);
void clearGraphData();
void keyPressed(int key);
BarGraph barGraph;
BodyGraph bodyGraph;
SeparateBodyGraph separateBodyGraph;
ofShader rgbShader;
ofVideoGrabber vidGrabber;
ofImage bgImg;
ofxFTGLSimpleLayout text;
AbstractGraph* activeGraph;
// video image vars
float brightness;
float contrast;
float saturation;
float red;
float green;
float blue;
float alpha;
float videoWidthPercentage;
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;
float hudHoleWidthPercentage;
float hudHoleHeightPercentage;
// text vars
float xMargin;
float yMargin;
float yMarginBottomOffset;
float lineLength;
float lineSpacing;
float textSize;
float textColour[4];
string tlStr;
string trStr;
string blStr;
string brStr;
long millisAtLastData;
float averageAmount;
// text colour boxes
float topColourBoxXOffset;
float bottomColourBoxXOffset;
float colourBoxThickness;
};
@@ -0,0 +1,50 @@
//
// gui->cpp
// emptyExample
//
// Created by James Alliban on 25/06/2013.
//
//
#include "AbstractGraph.h"
float AbstractGraph::minGraphPercent;
float AbstractGraph::maxGraphPercent;
void AbstractGraph::setup()
{
printf("AbstractGraph::setup()\n");
}
void AbstractGraph::update()
{
maxData = (ofGetWidth() * (AbstractGraph::maxGraphPercent - AbstractGraph::minGraphPercent)) / graphItemXGap;
}
void AbstractGraph::draw()
{
}
void AbstractGraph::addNewData(vector<DataObject> newData)
{
publisher0Data.push_back(newData[0]);
publisher1Data.push_back(newData[1]);
while (publisher0Data.size() > maxData && publisher0Data.size() > maxData)
{
publisher0Data.erase(publisher0Data.begin());
publisher1Data.erase(publisher1Data.begin());
}
}
void AbstractGraph::clear()
{
publisher0Data.clear();
publisher1Data.clear();
}
@@ -0,0 +1,44 @@
//
// AbstractGraph.h
// emptyExample
//
// Created by James Alliban on 25/06/2013.
//
//
#pragma once
#include "ofMain.h"
#include "DataManager.h"
class AbstractGraph
{
public:
void setup();
virtual void update();
virtual void draw();
virtual void addNewData(vector<DataObject> newData);
void clear();
vector<DataObject> publisher0Data;
vector<DataObject> publisher1Data;
int maxData; // calculated from graphWidth and graphItemXGap
static float minGraphPercent;
static float maxGraphPercent;
ofPoint currentPub0Point;
ofPoint currentPub1Point;
float graphItemXGap;
float graphHeightMax;
float col0[4];
float col1[4];
string graphName;
float sendDataSpeed;
};
@@ -0,0 +1,143 @@
//
// Created by James Alliban on 11/01/2014.
//
//
#include "SeparateBodyGraph.h"
#include "testApp.h"
void SeparateBodyGraph::setup()
{
AbstractGraph::setup();
app = (testApp*)ofGetAppPtr();
graphName = "SEPARATE_BODY";
}
void SeparateBodyGraph::update()
{
AbstractGraph::update();
}
void SeparateBodyGraph::draw()
{
if (app->gui.getVisible())
{
float timePerScreenfull = (float)maxData * sendDataSpeed;
ofDrawBitmapString("Time to fill screen:" + ofToString(timePerScreenfull), 500, 150);
}
if (publisher0Data.size() > 1)
{
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;
ofPolyline poly1;
for (int i = 0; i < publisher0Data.size() - 1; i++)
{
if (i < publisher0Data.size() - 1)
{
ofSetLineWidth(lineWidth);
poly0.addVertex(ofPoint(
i * graphItemXGap + xOffset,
ofMap(publisher0Data[i].value, publisher0Data[i].min, publisher0Data[i].max, outputMin, outputMax)));
poly1.addVertex(ofPoint(
i * graphItemXGap + xOffset,
ofMap(publisher1Data[i].value, publisher1Data[i].min, publisher1Data[i].max, outputMin, outputMax)));
}
}
ofVec2f centroid0 = poly0.getCentroid2D();
ofVec2f centroid1 = poly1.getCentroid2D();
float av0;
float av1;
for (int i = 0; i < poly0.size(); i++)
{
av0 += poly0[i].y;
av1 += poly1[i].y;
}
av0 /= poly0.size();
av1 /= poly1.size();
int lineAlpha = 255;
if (!isDrawLines) lineAlpha = 0;
if (av0 < av1)
{
body0.drawFaces();
ofSetColor(col0[0],col0[1],col0[2], lineAlpha);
poly0.draw();
body1.drawFaces();
ofSetColor(col1[0],col1[1],col1[2], lineAlpha);
poly1.draw();
}
else
{
body1.drawFaces();
ofSetColor(col1[0],col1[1],col1[2], lineAlpha);
poly1.draw();
body0.drawFaces();
ofSetColor(col0[0],col0[1],col0[2], lineAlpha);
poly0.draw();
}
ofPopStyle();
}
}
ofMesh SeparateBodyGraph::getMesh(vector<DataObject> publisherData, float* col)
{
ofMesh bodyMesh;
float xOffset = ofGetWidth() * AbstractGraph::minGraphPercent;
float outputMin = (ofGetHeight() * 0.5) - ((ofGetHeight() * 0.5) * graphHeightMax);
float outputMax = (ofGetHeight() * 0.5) + ((ofGetHeight() * 0.5) * graphHeightMax);
// draw main part of graph (xOffset)
bodyMesh.setMode(OF_PRIMITIVE_TRIANGLE_STRIP);
for (int i = 0; i < publisherData.size() - 1; i++)
{
bodyMesh.addVertex(ofVec3f(
i * graphItemXGap + xOffset,
ofMap(publisherData[i].value, publisherData[i].min, publisherData[i].max, outputMin, outputMax),
0));
bodyMesh.addVertex(ofVec3f(
i * graphItemXGap + xOffset,
ofGetHeight() * graphEndPercent,
0));
bodyMesh.addColor(ofColor(col[0],col[1],col[2], col[3]));
bodyMesh.addColor(ofColor(col[0],col[1],col[2], 0));
}
return bodyMesh;
}
void SeparateBodyGraph::addNewData(vector<DataObject> newData)
{
AbstractGraph::addNewData(newData);
}
@@ -0,0 +1,24 @@
#pragma once
#include "ofMain.h"
#include "AbstractGraph.h"
class testApp;
class SeparateBodyGraph : public AbstractGraph
{
public:
void setup();
virtual void update();
virtual void draw();
virtual void addNewData(vector<DataObject> newData);
ofMesh getMesh(vector<DataObject> publisherData, float* col);
testApp *app;
float lineWidth;
bool isDrawLines;
float graphEndPercent;
};