Utility graph colours now configurable

Look in the graph design GUI for sliders
This commit is contained in:
James Alliban 2014-01-22 15:13:38 +00:00
parent fa5df9cad7
commit 8ad8d65b44
19 changed files with 113 additions and 40 deletions

Binary file not shown.

View File

@ -78,3 +78,43 @@
<Name>Grid Alpha</Name>
<Value>79.687500000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Front red</Name>
<Value>242.417770386</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Front green</Name>
<Value>0.000000000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Front blue</Name>
<Value>49.490131378</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Front alpha</Name>
<Value>255.000000000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Back red</Name>
<Value>117.434211731</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Back green</Name>
<Value>255.000000000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Back blue</Name>
<Value>0.000000000</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>Back alpha</Name>
<Value>255.000000000</Value>
</Widget>

View File

@ -1,17 +1,17 @@
<Widget>
<Kind>4</Kind>
<Name>RED</Name>
<Value>19.292762756</Value>
<Value>24.325658798</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>GREEN</Name>
<Value>21.809211731</Value>
<Value>33.552631378</Value>
</Widget>
<Widget>
<Kind>4</Kind>
<Name>BLUE</Name>
<Value>21.809211731</Value>
<Value>66.266448975</Value>
</Widget>
<Widget>
<Kind>4</Kind>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,32 +1,7 @@
Build started 22/1/2014 2:08:26 PM.
Build started 22/1/2014 3:07:50 PM.
1>Project "C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\Utility_Box.vcxproj" on node 2 (Build target(s)).
1>ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\..\libs\openFrameworks /I..\..\..\libs\openFrameworks\graphics /I..\..\..\libs\openFrameworks\app /I..\..\..\libs\openFrameworks\sound /I..\..\..\libs\openFrameworks\utils /I..\..\..\libs\openFrameworks\communication /I..\..\..\libs\openFrameworks\video /I..\..\..\libs\openFrameworks\types /I..\..\..\libs\openFrameworks\math /I..\..\..\libs\openFrameworks\3d /I..\..\..\libs\openFrameworks\gl /I..\..\..\libs\openFrameworks\events /I..\..\..\libs\glut\include /I..\..\..\libs\rtAudio\include /I..\..\..\libs\quicktime\include /I..\..\..\libs\freetype\include /I..\..\..\libs\freetype\include\freetype2 /I..\..\..\libs\freeImage\include /I..\..\..\libs\fmodex\include /I..\..\..\libs\videoInput\include /I..\..\..\libs\glew\include\ /I..\..\..\libs\glu\include /I..\..\..\libs\tess2\include /I..\..\..\libs\cairo\include\cairo /I..\..\..\libs\poco\include /I..\..\..\libs\glfw\include /I..\..\..\..\libs\openssl\include /I..\..\..\addons /Isrc /Isrc\data /Isrc\gui /Isrc\visual /Isrc\visual\graph /I..\..\..\addons\ofxLibwebsockets\libs\jsoncpp /I..\..\..\addons\ofxLibwebsockets\libs\jsoncpp\json /I..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\ /I..\..\..\addons\ofxLibwebsockets\libs\openssl\openssl /I..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include /I..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include\ofxLibwebsockets /I..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\src /I..\..\..\addons\ofxLibwebsockets\src /I..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port /I..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers /I..\..\..\addons\ofxSpacebrew\src /I..\..\..\addons\ofxUI\src /I..\..\..\addons\ofxXmlSettings\libs /I..\..\..\addons\ofxXmlSettings\src /I..\..\..\addons\ofxFTGL\src /I..\..\..\addons\ofxFTGL\libs\FTGL\include\FTGL /I..\..\..\addons\ofxFTGL\libs\FTGL\include /I..\..\..\addons\ofxFTGL\libs\FTGL /I..\..\..\addons\ofxOsc\libs /I..\..\..\addons\ofxOsc\libs\oscpack /I..\..\..\addons\ofxOsc\libs\oscpack\src /I..\..\..\addons\ofxOsc\libs\oscpack\src\ip /I..\..\..\addons\ofxOsc\libs\oscpack\src\ip\posix /I..\..\..\addons\ofxOsc\libs\oscpack\src\ip\win32 /I..\..\..\addons\ofxOsc\libs\oscpack\src\osc /I..\..\..\addons\ofxOsc\src /Zi /nologo /W3 /WX- /O2 /Oy- /D WIN32 /D NDEBUG /D _CONSOLE /D POCO_STATIC /D CAIRO_WIN32_STATIC_BUILD /D DISABLE_SOME_FLOATING_POINT /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"obj\Release\\" /Fd"obj\Release\vc110.pdb" /Gd /TP /analyze- /errorReport:prompt src\main.cpp src\visual\graph\Graph.cpp
main.cpp
1>C:\Users\James Alliban\Work\of_v0.8.0_vs_release\libs\poco\include\Poco/StreamConverter.h(126): warning C4250: 'Poco::InputStreamConverter' : inherits 'std::basic_istream<_Elem,_Traits>::std::basic_istream<_Elem,_Traits>::_Add_vtordisp1' via dominance
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\istream(74) : see declaration of 'std::basic_istream<_Elem,_Traits>::_Add_vtordisp1'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
1>C:\Users\James Alliban\Work\of_v0.8.0_vs_release\libs\poco\include\Poco/StreamConverter.h(144): warning C4250: 'Poco::OutputStreamConverter' : inherits 'std::basic_ostream<_Elem,_Traits>::std::basic_ostream<_Elem,_Traits>::_Add_vtordisp2' via dominance
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\include\ostream(90) : see declaration of 'std::basic_ostream<_Elem,_Traits>::_Add_vtordisp2'
with
[
_Elem=char,
_Traits=std::char_traits<char>
]
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\..\libs\openFrameworks /I..\..\..\libs\openFrameworks\graphics /I..\..\..\libs\openFrameworks\app /I..\..\..\libs\openFrameworks\sound /I..\..\..\libs\openFrameworks\utils /I..\..\..\libs\openFrameworks\communication /I..\..\..\libs\openFrameworks\video /I..\..\..\libs\openFrameworks\types /I..\..\..\libs\openFrameworks\math /I..\..\..\libs\openFrameworks\3d /I..\..\..\libs\openFrameworks\gl /I..\..\..\libs\openFrameworks\events /I..\..\..\libs\glut\include /I..\..\..\libs\rtAudio\include /I..\..\..\libs\quicktime\include /I..\..\..\libs\freetype\include /I..\..\..\libs\freetype\include\freetype2 /I..\..\..\libs\freeImage\include /I..\..\..\libs\fmodex\include /I..\..\..\libs\videoInput\include /I..\..\..\libs\glew\include\ /I..\..\..\libs\glu\include /I..\..\..\libs\tess2\include /I..\..\..\libs\cairo\include\cairo /I..\..\..\libs\poco\include /I..\..\..\libs\glfw\include /I..\..\..\..\libs\openssl\include /I..\..\..\addons /Isrc /Isrc\data /Isrc\gui /Isrc\visual /Isrc\visual\graph /I..\..\..\addons\ofxLibwebsockets\libs\jsoncpp /I..\..\..\addons\ofxLibwebsockets\libs\jsoncpp\json /I..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\ /I..\..\..\addons\ofxLibwebsockets\libs\openssl\openssl /I..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include /I..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\include\ofxLibwebsockets /I..\..\..\addons\ofxLibwebsockets\libs\ofxLibwebsockets\src /I..\..\..\addons\ofxLibwebsockets\src /I..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port /I..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\include\win32port\win32helpers /I..\..\..\addons\ofxSpacebrew\src /I..\..\..\addons\ofxUI\src /I..\..\..\addons\ofxXmlSettings\libs /I..\..\..\addons\ofxXmlSettings\src /I..\..\..\addons\ofxFTGL\src /I..\..\..\addons\ofxFTGL\libs\FTGL\include\FTGL /I..\..\..\addons\ofxFTGL\libs\FTGL\include /I..\..\..\addons\ofxFTGL\libs\FTGL /I..\..\..\addons\ofxOsc\libs /I..\..\..\addons\ofxOsc\libs\oscpack /I..\..\..\addons\ofxOsc\libs\oscpack\src /I..\..\..\addons\ofxOsc\libs\oscpack\src\ip /I..\..\..\addons\ofxOsc\libs\oscpack\src\ip\posix /I..\..\..\addons\ofxOsc\libs\oscpack\src\ip\win32 /I..\..\..\addons\ofxOsc\libs\oscpack\src\osc /I..\..\..\addons\ofxOsc\src /Zi /nologo /W3 /WX- /O2 /Oy- /D WIN32 /D NDEBUG /D _CONSOLE /D POCO_STATIC /D CAIRO_WIN32_STATIC_BUILD /D DISABLE_SOME_FLOATING_POINT /D _UNICODE /D UNICODE /Gm- /EHsc /MD /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"obj\Release\\" /Fd"obj\Release\vc110.pdb" /Gd /TP /analyze- /errorReport:prompt src\visual\graph\Graph.cpp
Graph.cpp
1>C:\Users\James Alliban\Work\of_v0.8.0_vs_release\libs\poco\include\Poco/StreamConverter.h(126): warning C4250: 'Poco::InputStreamConverter' : inherits 'std::basic_istream<_Elem,_Traits>::std::basic_istream<_Elem,_Traits>::_Add_vtordisp1' via dominance
with
@ -52,7 +27,6 @@
_Elem=char,
_Traits=std::char_traits<char>
]
Generating Code...
Link:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:"bin\Utility_Box.exe" /INCREMENTAL:NO /NOLOGO /LIBPATH:..\..\..\libs\glut\lib\vs /LIBPATH:..\..\..\libs\glfw\lib\vs /LIBPATH:..\..\..\libs\rtAudio\lib\vs /LIBPATH:..\..\..\libs\FreeImage\lib\vs /LIBPATH:..\..\..\libs\freetype\lib\vs /LIBPATH:..\..\..\libs\quicktime\lib\vs /LIBPATH:..\..\..\libs\fmodex\lib\vs /LIBPATH:..\..\..\libs\videoInput\lib\vs /LIBPATH:..\..\..\libs\cairo\lib\vs /LIBPATH:..\..\..\libs\glew\lib\vs /LIBPATH:..\..\..\libs\glu\lib\vs /LIBPATH:..\..\..\libs\openssl\lib\vs /LIBPATH:..\..\..\libs\Poco\lib\vs /LIBPATH:..\..\..\libs\tess2\lib\vs /LIBPATH:..\..\..\addons\ofxFTGL\libs\FTGL\lib\vs2012 /LIBPATH:..\..\..\addons\ofxLibwebsockets\libs\libwebsockets\lib\win32\Release "cairo-static.lib" "pixman-1.lib" msimg32.lib OpenGL32.lib GLu32.lib kernel32.lib setupapi.lib Vfw32.lib comctl32.lib glut32.lib rtAudio.lib videoInput.lib libfreetype.lib FreeImage.lib qtmlClient.lib dsound.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib glew32s.lib fmodex_vc.lib glu32.lib crypt32.lib libeay32MD.lib ssleay32MD.lib PocoFoundationmd.lib PocoNetmd.lib PocoUtilmd.lib PocoXMLmd.lib Ws2_32.lib tess2.lib glfw3.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib websockets_static.lib ZLIB.lib ftgl_static.lib /NODEFAULTLIB:PocoFoundationd.lib /NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:LIBC.lib /NODEFAULTLIB:LIBCMT /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:"bin\Utility_Box.pdb" /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /LTCG /TLBID:1 /DYNAMICBASE:NO /NXCOMPAT /IMPLIB:"bin\Utility_Box.lib" /MACHINE:X86 /SAFESEH obj\Release\icon.res
obj\Release\ofxFTGLFont.obj
@ -132,4 +106,4 @@
Build succeeded.
Time Elapsed 00:00:10.40
Time Elapsed 00:00:06.77

View File

@ -1638,3 +1638,8 @@ C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Util
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.lib
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.exp
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.exp
^C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\Utility_Box.vcxproj
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.lib
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.lib
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.exp
C:\Users\James Alliban\Work\of_v0.8.0_vs_release\CRITICAL-INFRASTRUCTURE\of\Utility_Box\bin\Utility_Box.exp

Binary file not shown.

Binary file not shown.

View File

@ -99,13 +99,15 @@ void GUI::addGraphDesignGUI()
gui->addSlider("Grid Blue", 0, 255, &app->scene.gridCol[2], length, dim);
gui->addSlider("Grid Alpha", 0, 255, &app->scene.gridCol[3], length, dim);
//gui->addSpacer(length, 1);
//gui->addSlider("Data0 red", 0, 255, &app->scene.graphManager.col0[0], length, dim);
//gui->addSlider("Data0 green", 0, 255, &app->scene.graph.col0[1], length, dim);
//gui->addSlider("Data0 blue", 0, 255, &app->scene.graph.col0[2], length, dim);
//gui->addSlider("Data0 alpha", 0, 255, &app->scene.graph.col0[3], length, dim);
gui->addLabel("COLOUR");
gui->addSlider("Front red", 0, 255, &Graph::colFront[0], length, dim);
gui->addSlider("Front green", 0, 255, &Graph::colFront[1], length, dim);
gui->addSlider("Front blue", 0, 255, &Graph::colFront[2], length, dim);
gui->addSlider("Front alpha", 0, 255, &Graph::colFront[3], length, dim);
gui->addSlider("Back red", 0, 255, &Graph::colBack[0], length, dim);
gui->addSlider("Back green", 0, 255, &Graph::colBack[1], length, dim);
gui->addSlider("Back blue", 0, 255, &Graph::colBack[2], length, dim);
gui->addSlider("Back alpha", 0, 255, &Graph::colBack[3], length, dim);
finaliseCanvas(gui, true);

View File

@ -15,6 +15,8 @@ float Graph::graphHeightMax;
float Graph::graphEndPercent;
float Graph::zRange;
float Graph::graphTextZOffset;
float Graph::colFront[4];
float Graph::colBack[4];
float Graph::lineLength;
float Graph::lineSpacing;
@ -44,6 +46,9 @@ void Graph::update(ofVec3f activeCamPos)
drawInfoToFbo();
}
if (hasColorChanged())
updateColours();
ofVec3f camPos = activeCamPos;
centre = ofVec3f(0.1, 0.1, ofMap(graphID, 0, 29, -zRange, zRange));
distToCam = sqrt(double(ABS(camPos.x - centre.x) * ABS(camPos.x - centre.x) * ABS(camPos.x - centre.x) +
@ -170,7 +175,19 @@ void Graph::addNewData(DataObject newData)
graphMesh.addVertex(vertexTop);
graphMesh.addVertex(vertexBottom);
ofColor col = ofColor(ofMap(graphID, 0, 29, 0, 255), ofMap(graphID, 0, 29, 255, 0), ofMap(graphID, 0, 29, 150, 50), 255);
ofColor col;
col.r = (int)ofMap(graphID, 0, 29, colFront[0], colBack[0]);
col.g = (int)ofMap(graphID, 0, 29, colFront[1], colBack[1]);
col.b = (int)ofMap(graphID, 0, 29, colFront[2], colBack[2]);
col.a = (int)ofMap(graphID, 0, 29, colFront[3], colBack[3]);
//= ofColor(ofMap(
// graphID, 0, 29, 0, 255),
// ofMap(graphID, 0, 29, 255, 0),
// ofMap(graphID, 0, 29, 150, 50),
// 255);
//if (ofRandomuf() < 0.1) col = ofColor(ofRandom(255), ofRandom(255), ofRandom(255), 255);
@ -230,3 +247,32 @@ vector<string> Graph::explode(const string &delimiter, const string &str)
arr.push_back( str.substr(k, i-k) );
return arr;
}
bool Graph::hasColorChanged()
{
if (colFront[0] != colBack[0] || colFront[1] != colBack[1] || colFront[2] != colBack[2] || colFront[3] != colBack[3])
return true;
else
return false;
}
void Graph::updateColours()
{
ofColor col;
col.r = (int)ofMap(graphID, 0, 29, colFront[0], colBack[0]);
col.g = (int)ofMap(graphID, 0, 29, colFront[1], colBack[1]);
col.b = (int)ofMap(graphID, 0, 29, colFront[2], colBack[2]);
col.a = (int)ofMap(graphID, 0, 29, colFront[3], colBack[3]);
for (int i = 0; i < graphMesh.getColors().size(); i+=2)
{
graphMesh.setColor(i, col);
graphMesh.setColor(i+1, ofColor(col.r, col.g, col.b, 0));
}
}

View File

@ -20,6 +20,8 @@ public:
void drawInfoToFbo();
void clear();
vector<string> explode(const string &delimiter, const string &str);
bool hasColorChanged();
void updateColours();
testApp *app;
int graphID;
@ -41,6 +43,10 @@ public:
static float graphEndPercent;
static float zRange;
static float graphTextZOffset;
static float colFront[4];
static float colBack[4];
static float prevColFront[4];
static float prevColBack[4];
static float lineLength;
static float lineSpacing;