diff --git a/of/Active Tripod/bin/Active_Tripod.lib b/of/Active Tripod/bin/Active_Tripod.lib index f907311..96b5032 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 87ccddc..8ea72a0 100644 --- a/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/BACKGROUNDguiPagesettings.xml @@ -38,3 +38,38 @@ End alpha 255.000000000 + + 4 + Brightness + 0.980263174 + + + 4 + Contrast + 0.986842096 + + + 4 + Saturation + 0.967105269 + + + 4 + Red + 0.684210539 + + + 4 + Green + 0.947368443 + + + 4 + Blue + 0.644736826 + + + 4 + Alpha + 1.000000000 + diff --git a/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml b/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml index efb7f50..4d73d4c 100644 --- a/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml +++ b/of/Active Tripod/bin/data/GUI/VARIOUSguiPagesettings.xml @@ -1,20 +1,20 @@ 4 RED - 68.782897949 + 19.292762756 4 GREEN - 67.944076538 + 21.809211731 4 BLUE - 104.013153076 + 21.809211731 4 ALPHA - 200.476974487 + 139.243423462 diff --git a/of/Active Tripod/bin/data/images/basement.png b/of/Active Tripod/bin/data/images/basement.png new file mode 100644 index 0000000..3932f9d Binary files /dev/null and b/of/Active Tripod/bin/data/images/basement.png differ diff --git a/of/Active Tripod/bin/data/images/dino.jpeg b/of/Active Tripod/bin/data/images/dino.jpeg new file mode 100644 index 0000000..e65c660 Binary files /dev/null and b/of/Active Tripod/bin/data/images/dino.jpeg differ diff --git a/of/Active Tripod/bin/data/images/tanks.jpg b/of/Active Tripod/bin/data/images/tanks.jpg new file mode 100644 index 0000000..0fb55e3 Binary files /dev/null and b/of/Active Tripod/bin/data/images/tanks.jpg differ diff --git a/of/Active Tripod/bin/data/shaders/RGBShader.frag b/of/Active Tripod/bin/data/shaders/RGBShader.frag new file mode 100644 index 0000000..bad79d0 --- /dev/null +++ b/of/Active Tripod/bin/data/shaders/RGBShader.frag @@ -0,0 +1,57 @@ + +#extension GL_ARB_texture_rectangle : enable + +uniform sampler2DRect baseMap; + +uniform float brightness; +uniform float contrast; +uniform float saturation; +uniform float alpha; +uniform float red; +uniform float green; +uniform float blue; +uniform float shadowIntensity; + +void main(void) +{ + // Extract colors from baseMap + vec4 baseColor = texture2DRect( baseMap, gl_TexCoord[0].st ); + + vec3 baseColor3 = baseColor.rgb; + + + // Brightness, contrast and saturation + const float AvgLumR = 0.5; + const float AvgLumG = 0.5; + const float AvgLumB = 0.5; + const vec3 LumCoeff = vec3(0.2125, 0.7154, 0.0721); + vec3 AvgLumin = vec3(AvgLumR, AvgLumG, AvgLumB); + vec3 brtColor = baseColor3 * brightness; + vec3 intensity = vec3(dot(brtColor, LumCoeff)); + vec3 satColor = mix(intensity, brtColor, saturation); + vec3 conColor = mix(AvgLumin, satColor, contrast); + + baseColor.rgb = conColor; + + + + + // colour, alpha, lighting + //vec3 normal = normalize( v_normal ); + vec3 colourVec = vec3(red, green, blue); + baseColor.rgb *= colourVec; + //float ndotl = max(dot(normal, v_light_dir), shadowIntensity); + //baseColor.rgb *= ndotl; + //baseColor.a = alpha; + + + vec4 result = clamp(baseColor, 0.0, 1.0); + + //result.r += v_colour.r; + //result.g = 1.0; + //result += v_colour; + //result.a = v_colour.a; + + gl_FragColor = result; + +} \ No newline at end of file diff --git a/of/Active Tripod/bin/data/shaders/RGBShader.vert b/of/Active Tripod/bin/data/shaders/RGBShader.vert new file mode 100644 index 0000000..28f2e08 --- /dev/null +++ b/of/Active Tripod/bin/data/shaders/RGBShader.vert @@ -0,0 +1,8 @@ + + + +void main(void) +{ + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = ftransform(); +} diff --git a/of/Active Tripod/src/gui/GUI.cpp b/of/Active Tripod/src/gui/GUI.cpp index ae177b6..70e4393 100644 --- a/of/Active Tripod/src/gui/GUI.cpp +++ b/of/Active Tripod/src/gui/GUI.cpp @@ -17,7 +17,7 @@ void GUI::setup() dim = 8; addKeyboardShortcutsGUI(); - addGraphAnimationGUI(); + //addGraphAnimationGUI(); addBarGraphDesignGUI(); addGraphSimulationGUI(); addBackgroundGUI(); @@ -40,6 +40,8 @@ void GUI::addKeyboardShortcutsGUI() 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); finaliseCanvas(gui, true); @@ -96,14 +98,26 @@ void GUI::addBackgroundGUI() ofxUICanvas* gui = getNewGUI(title); gui->addLabel("GRADIENT COLOUR"); + gui->addSpacer(length, 1); gui->addSlider("Start red", 0, 255, &app->scene.bgGradStartCol[0], length, dim); gui->addSlider("Start green", 0, 255, &app->scene.bgGradStartCol[1], length, dim); gui->addSlider("Start blue", 0, 255, &app->scene.bgGradStartCol[2], length, dim); gui->addSlider("Start alpha", 0, 255, &app->scene.bgGradStartCol[3], length, dim); + gui->addSpacer(length, 1); gui->addSlider("End red", 0, 255, &app->scene.bgGradEndCol[0], length, dim); gui->addSlider("End green", 0, 255, &app->scene.bgGradEndCol[1], length, dim); gui->addSlider("End blue", 0, 255, &app->scene.bgGradEndCol[2], length, dim); gui->addSlider("End alpha", 0, 255, &app->scene.bgGradEndCol[3], length, dim); + gui->addSpacer(length, 1); + gui->addLabel("BACKGROUND IMAGE"); + 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); + 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 5143075..106e5e1 100644 --- a/of/Active Tripod/src/testApp.cpp +++ b/of/Active Tripod/src/testApp.cpp @@ -3,11 +3,10 @@ // TODO // ==== // - Make graph system with 3 simple (for now) but different graphs that can be interchanged -// - Make events system to send data to scene +// - Add image to background and create a mask +// - Use a shader to adjust image brightness/contrast and colour // - -// - -// - Add to GUI -// - - Publisher choice +// - Add to config // - - IP address // - - Host name // - - App name @@ -67,7 +66,7 @@ void testApp::mousePressed(int x, int y, int button) void testApp::keyPressed(int key) { if (key == 'p') - { isPaused = !isPaused; - } + else if (key == 'f') + ofToggleFullscreen(); } \ No newline at end of file diff --git a/of/Active Tripod/src/visual/Scene.cpp b/of/Active Tripod/src/visual/Scene.cpp index 01208d8..5db9c3a 100644 --- a/of/Active Tripod/src/visual/Scene.cpp +++ b/of/Active Tripod/src/visual/Scene.cpp @@ -11,6 +11,8 @@ void Scene::setup() { + bgImg.loadImage("images/tanks.jpg"); + rgbShader.load("shaders/RGBShader"); barGraph.setup(); } @@ -27,6 +29,23 @@ void Scene::draw() ofColor(bgGradEndCol[0], bgGradEndCol[1], bgGradEndCol[2], bgGradEndCol[3]), OF_GRADIENT_CIRCULAR); + + 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); + + bgImg.draw(0, 0, ofGetWidth(), ofGetHeight()); + + rgbShader.end(); + + + barGraph.draw(); } diff --git a/of/Active Tripod/src/visual/Scene.h b/of/Active Tripod/src/visual/Scene.h index 2531f7d..6ec29fd 100644 --- a/of/Active Tripod/src/visual/Scene.h +++ b/of/Active Tripod/src/visual/Scene.h @@ -21,6 +21,10 @@ public: void draw(); BarGraph barGraph; + ofShader rgbShader; + ofImage bgImg; + + float brightness, contrast, saturation, red, green, blue, alpha; float bgGradStartCol[4]; float bgGradEndCol[4];