Added OSC sender for live values
This commit is contained in:
@@ -86,16 +86,8 @@ void Scene::draw()
|
||||
{
|
||||
string newStr = ofToString(i) + " - " + graphManager.graphs[i]->info;
|
||||
str += newStr + "\n";
|
||||
//if (ofGetFrameNum() % 30 == 0)
|
||||
// printf("- str:%s\n- - - - - *** - - - - -\n", newStr.c_str());
|
||||
}
|
||||
//if (ofGetFrameNum() % 30 == 0)
|
||||
//{
|
||||
// printf("\n\n\n\n");
|
||||
// printf("str(all):%s\n- - - - - *** - - - - -\n", str.c_str());
|
||||
// printf("\n\n\n\n");
|
||||
//}
|
||||
|
||||
|
||||
text.drawString(str, legendTextPoint.x, legendTextPoint.y);
|
||||
ofPopStyle();
|
||||
}
|
||||
|
||||
@@ -176,6 +176,12 @@ void Graph::addNewData(DataObject newData)
|
||||
float xOffset = 0;
|
||||
float outputMin = 0;
|
||||
float outputMax = graphHeightMax;
|
||||
|
||||
if (newData.value == -999) newData.value = 0;
|
||||
if (newData.min == -999) newData.min = 0;
|
||||
if (newData.max == -999) newData.max = 0;
|
||||
|
||||
currentValue = newData.value;
|
||||
|
||||
int graphMeshSize = graphMesh.getVertices().size();
|
||||
vector<ofVec3f> *meshVertices = &graphMesh.getVertices();
|
||||
|
||||
@@ -16,7 +16,6 @@ public:
|
||||
void drawGraphBody();
|
||||
void drawGraphText();
|
||||
void addNewData(DataObject newData);
|
||||
ofMesh getMesh(vector<DataObject> publisherData, float* col);
|
||||
void setFboSettings();
|
||||
void drawInfoToFbo();
|
||||
void clear();
|
||||
@@ -61,5 +60,5 @@ public:
|
||||
string info;
|
||||
|
||||
ofMesh graphMesh;
|
||||
|
||||
float currentValue;
|
||||
};
|
||||
@@ -12,6 +12,8 @@ void GraphManager::setup()
|
||||
graphs.push_back(graph);
|
||||
reorderedGraphs.push_back(graph);
|
||||
}
|
||||
|
||||
sender.setup(HOST, PORT);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +26,15 @@ void GraphManager::update(ofVec3f ativeCamPos)
|
||||
graph->update(ativeCamPos);
|
||||
}
|
||||
|
||||
ofxOscMessage m;
|
||||
m.setAddress("/utilityvalues");
|
||||
for (int i = 0; i < graphs.size(); i++)
|
||||
{
|
||||
m.addStringArg(graphs[i]->info);
|
||||
m.addFloatArg(graphs[i]->currentValue);
|
||||
}
|
||||
sender.sendMessage(m);
|
||||
|
||||
std::sort(reorderedGraphs.begin(), reorderedGraphs.end(), compareGraphByDistToCam());
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
#include "DataManager.h"
|
||||
#include "Graph.h"
|
||||
#include "ofxFTGL.h"
|
||||
#include "ofxOsc.h"
|
||||
|
||||
#define HOST "localhost"
|
||||
#define PORT 7500
|
||||
|
||||
struct compareGraphByDistToCam
|
||||
{
|
||||
@@ -23,4 +27,6 @@ public:
|
||||
vector<Graph*> graphs;
|
||||
vector<Graph*> reorderedGraphs;
|
||||
ofxFTGLSimpleLayout text;
|
||||
|
||||
ofxOscSender sender;
|
||||
};
|
||||
Reference in New Issue
Block a user