Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/origin/master' into savegame-re…
Browse files Browse the repository at this point in the history
…factor

Conflicts:
doomsday/client/src/ui/widgets/gameselectionwidget.cpp
  • Loading branch information
danij-deng committed Mar 16, 2014
2 parents 4b1b58e + aeef104 commit 81c4692
Show file tree
Hide file tree
Showing 50 changed files with 947 additions and 137 deletions.
2 changes: 2 additions & 0 deletions doomsday/client/client.pro
Expand Up @@ -287,6 +287,7 @@ DENG_HEADERS += \
include/render/decoration.h \
include/render/drawlist.h \
include/render/drawlists.h \
include/render/fx/bloom.h \
include/render/fx/colorfilter.h \
include/render/fx/lensflares.h \
include/render/fx/postprocessing.h \
Expand Down Expand Up @@ -619,6 +620,7 @@ SOURCES += \
src/render/decoration.cpp \
src/render/drawlist.cpp \
src/render/drawlists.cpp \
src/render/fx/bloom.cpp \
src/render/fx/colorfilter.cpp \
src/render/fx/lensflares.cpp \
src/render/fx/postprocessing.cpp \
Expand Down
@@ -1,5 +1,14 @@
profile {
name: Amplified (built-in)
setting "rend-bloom" {
value: 1
}
setting "rend-bloom-intensity" {
value: 0.8
}
setting "rend-bloom-threshold" {
value: 0.3
}
setting "rend-fakeradio" {
value: 1
}
Expand Down
@@ -1,5 +1,8 @@
profile {
name: Vanilla (built-in)
setting "rend-bloom" {
value: 0
}
setting "rend-fakeradio" {
value: 0
}
Expand Down
62 changes: 21 additions & 41 deletions doomsday/client/data/renderer.pack/shaders.dei
Expand Up @@ -110,57 +110,37 @@ group generic {
}

group fx {
# Blurring is done in two passes: horizontal and vertical. This is more
# efficient than doing the equivalent amount of blurring in a single pass.
group blur {
shader horizontal {
path.vertex = "shaders/blur.vsh"
fragment = "
uniform sampler2D uTex;
uniform highp vec2 uBlurStep;
varying highp vec2 vUV;
varying highp vec4 vColor;
void main(void) {
highp vec4 sum = vec4(0.0);
sum += texture2D(uTex, vec2(vUV.s - 4.0 * uBlurStep.s, vUV.t)) * 0.05;
sum += texture2D(uTex, vec2(vUV.s - 3.0 * uBlurStep.s, vUV.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s - 2.0 * uBlurStep.s, vUV.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s - uBlurStep.s, vUV.t)) * 0.154;
sum += texture2D(uTex, vUV) * 0.165;
sum += texture2D(uTex, vec2(vUV.s + uBlurStep.s, vUV.t)) * 0.154;
sum += texture2D(uTex, vec2(vUV.s + 2.0 * uBlurStep.s, vUV.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s + 3.0 * uBlurStep.s, vUV.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s + 4.0 * uBlurStep.s, vUV.t)) * 0.05;
gl_FragColor = sum;
gl_FragColor.a = 1.0;
}"
path.vertex = "shaders/blur.vsh"
path.fragment = "shaders/blur-horizontal.fsh"
}
shader vertical {
path.vertex = "shaders/blur.vsh"
fragment = "
uniform sampler2D uTex;
uniform highp vec2 uBlurStep;
varying highp vec2 vUV;
varying highp vec4 vColor;
void main(void) {
highp vec4 sum = vec4(0.0);
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 4.0 * uBlurStep.t)) * 0.05;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 3.0 * uBlurStep.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 2.0 * uBlurStep.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - uBlurStep.t )) * 0.154;
sum += texture2D(uTex, vUV) * 0.165;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + uBlurStep.t )) * 0.154;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 2.0 * uBlurStep.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 3.0 * uBlurStep.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 4.0 * uBlurStep.t)) * 0.05;
gl_FragColor = sum * vColor;
}"
path.vertex = "shaders/blur.vsh"
path.fragment = "shaders/blur-vertical.fsh"
}
}


# Bloom is a specialized additive blur that only applies to bright pixels
# (given a configurable threshold for brightness).
group bloom {
shader horizontal {
path.vertex = "shaders/bloom.vsh"
path.fragment = "shaders/bloom-horizontal.fsh"
}
shader vertical {
path.vertex = "shaders/bloom.vsh"
path.fragment = "shaders/bloom-vertical.fsh"
}
}

shader lensflares {
path.vertex = "shaders/lensflares.vsh"
path.fragment = "shaders/lensflares.fsh"
}

# Post-processing shaders need to have uFadeInOut (0..1) for
# fading the effect in/out.
group post {
Expand Down
26 changes: 26 additions & 0 deletions doomsday/client/data/renderer.pack/shaders/bloom-horizontal.fsh
@@ -0,0 +1,26 @@
uniform sampler2D uTex;
uniform highp float uIntensity;
uniform highp float uThreshold;
uniform highp vec2 uBlurStep;

varying highp vec2 vUV;

void main(void) {
highp vec4 sum = vec4(0.0);
sum += texture2D(uTex, vec2(vUV.s - 4.0 * uBlurStep.s, vUV.t)) * 0.05;
sum += texture2D(uTex, vec2(vUV.s - 3.0 * uBlurStep.s, vUV.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s - 2.0 * uBlurStep.s, vUV.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s - uBlurStep.s, vUV.t)) * 0.154;
sum += texture2D(uTex, vUV) * 0.165;
sum += texture2D(uTex, vec2(vUV.s + uBlurStep.s, vUV.t)) * 0.154;
sum += texture2D(uTex, vec2(vUV.s + 2.0 * uBlurStep.s, vUV.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s + 3.0 * uBlurStep.s, vUV.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s + 4.0 * uBlurStep.s, vUV.t)) * 0.05;

// Apply a threshold that gets rid of dark, non-luminous pixels.
highp float intens = max(sum.r, max(sum.g, sum.b));

intens = (intens - uThreshold) * uIntensity;

gl_FragColor = vec4(vec3(intens) * normalize(sum.rgb + 0.2), 1.0);
}
18 changes: 18 additions & 0 deletions doomsday/client/data/renderer.pack/shaders/bloom-vertical.fsh
@@ -0,0 +1,18 @@
uniform sampler2D uTex;
uniform highp vec2 uBlurStep;

varying highp vec2 vUV;

void main(void) {
highp vec4 sum = vec4(0.0);
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 4.0 * uBlurStep.t)) * 0.05;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 3.0 * uBlurStep.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 2.0 * uBlurStep.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - uBlurStep.t )) * 0.154;
sum += texture2D(uTex, vUV) * 0.165;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + uBlurStep.t )) * 0.154;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 2.0 * uBlurStep.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 3.0 * uBlurStep.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 4.0 * uBlurStep.t)) * 0.05;
gl_FragColor = sum;
}
13 changes: 13 additions & 0 deletions doomsday/client/data/renderer.pack/shaders/bloom.vsh
@@ -0,0 +1,13 @@
uniform highp mat4 uMvpMatrix;
uniform highp vec4 uColor;
uniform highp vec4 uWindow;

attribute highp vec4 aVertex;
attribute highp vec2 aUV;

varying highp vec2 vUV;

void main(void) {
gl_Position = uMvpMatrix * aVertex;
vUV = uWindow.xy + aUV * uWindow.zw;
}
20 changes: 20 additions & 0 deletions doomsday/client/data/renderer.pack/shaders/blur-horizontal.fsh
@@ -0,0 +1,20 @@
uniform sampler2D uTex;
uniform highp vec2 uBlurStep;

varying highp vec2 vUV;
varying highp vec4 vColor;

void main(void) {
highp vec4 sum = vec4(0.0);
sum += texture2D(uTex, vec2(vUV.s - 4.0 * uBlurStep.s, vUV.t)) * 0.05;
sum += texture2D(uTex, vec2(vUV.s - 3.0 * uBlurStep.s, vUV.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s - 2.0 * uBlurStep.s, vUV.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s - uBlurStep.s, vUV.t)) * 0.154;
sum += texture2D(uTex, vUV) * 0.165;
sum += texture2D(uTex, vec2(vUV.s + uBlurStep.s, vUV.t)) * 0.154;
sum += texture2D(uTex, vec2(vUV.s + 2.0 * uBlurStep.s, vUV.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s + 3.0 * uBlurStep.s, vUV.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s + 4.0 * uBlurStep.s, vUV.t)) * 0.05;
gl_FragColor = sum;
gl_FragColor.a = 1.0;
}
19 changes: 19 additions & 0 deletions doomsday/client/data/renderer.pack/shaders/blur-vertical.fsh
@@ -0,0 +1,19 @@
uniform sampler2D uTex;
uniform highp vec2 uBlurStep;

varying highp vec2 vUV;
varying highp vec4 vColor;

void main(void) {
highp vec4 sum = vec4(0.0);
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 4.0 * uBlurStep.t)) * 0.05;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 3.0 * uBlurStep.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - 2.0 * uBlurStep.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s, vUV.t - uBlurStep.t )) * 0.154;
sum += texture2D(uTex, vUV) * 0.165;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + uBlurStep.t )) * 0.154;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 2.0 * uBlurStep.t)) * 0.123;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 3.0 * uBlurStep.t)) * 0.09;
sum += texture2D(uTex, vec2(vUV.s, vUV.t + 4.0 * uBlurStep.t)) * 0.05;
gl_FragColor = sum * vColor;
}
48 changes: 48 additions & 0 deletions doomsday/client/include/render/fx/bloom.h
@@ -0,0 +1,48 @@
/** @file fx/bloom.h Bloom camera lens effect.
*
* @authors Copyright (c) 2014 Jaakko Keränen <jaakko.keranen@iki.fi>
*
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, see:
* http://www.gnu.org/licenses</small>
*/

#ifndef DENG_CLIENT_FX_BLOOM_H
#define DENG_CLIENT_FX_BLOOM_H

#include "render/consoleeffect.h"

namespace fx {

/**
* Draws a bloom effect that spreads out light from bright pixels. The brightness
* threshold and bloom intensity are configurable.
*/
class Bloom : public ConsoleEffect
{
public:
Bloom(int console);

void glInit();
void glDeinit();

void draw();

static void consoleRegister();

private:
DENG2_PRIVATE(d)
};

} // namespace fx

#endif // DENG_CLIENT_FX_BLOOM_H
2 changes: 1 addition & 1 deletion doomsday/client/include/ui/clientwindow.h
Expand Up @@ -161,7 +161,7 @@ class ClientWindow : public de::BaseWindow,
void canvasGLResized(de::Canvas &);

// Implements BaseWindow.
de::Vector2f windowContentSize();
de::Vector2f windowContentSize() const;
void drawWindowContent();
void preDraw();
void postDraw();
Expand Down
Expand Up @@ -20,6 +20,7 @@
#define DENG_CLIENT_RENDERERAPPEARANCEEDITOR_H

#include <de/PanelWidget>
#include <de/IPersistent>

/**
* Editor for modifying the settings for the renderer's visual appearance.
Expand All @@ -28,13 +29,17 @@
*
* @see ClientApp::rendererAppearanceSettings()
*/
class RendererAppearanceEditor : public de::PanelWidget
class RendererAppearanceEditor : public de::PanelWidget,
public de::IPersistent
{
Q_OBJECT

public:
RendererAppearanceEditor();

void operator >> (de::PersistentState &toState) const;
void operator << (de::PersistentState const &fromState);

public slots:
void foldAll();
void unfoldAll();
Expand Down
8 changes: 4 additions & 4 deletions doomsday/client/src/con_main.cpp
Expand Up @@ -1230,14 +1230,14 @@ D_CMD(Help)
#ifdef __CLIENT__
LOG_SCR_MSG(_E(D) "Keys:" _E(.))
<< TABBED(DENG2_CHAR_SHIFT_KEY "Esc", "Open the taskbar and console")
<< TABBED("Tab", "Autocomplete the word at the cursor")
<< TABBED(DENG2_CHAR_UP_DOWN_ARROW, "Move backwards/forwards through the input command history, or up/down one line inside a multi-line command")
<< TABBED("PgUp/Dn", "Scroll up/down in the history, or expand the history to full height")
<< TABBED(DENG2_CHAR_SHIFT_KEY "PgUp/Dn", "Jump to the top/bottom of the history")
<< TABBED("F5", "Clear the console message history")
<< TABBED("Home", "Move the cursor to the start of the command line")
<< TABBED("End", "Move the cursor to the end of the command line")
<< TABBED("Tab", "Attempt autocompletion of the last word on the input line")
<< TABBED(DENG2_CHAR_UP_DOWN_ARROW, "Move backwards/forwards through the input command history, or up/down one line inside a multi-line command")
<< TABBED(DENG2_CHAR_CONTROL_KEY "K", "Clear everything on the line right of the cursor position");
<< TABBED(DENG2_CHAR_CONTROL_KEY "K", "Clear everything on the line right of the cursor position")
<< TABBED("F5", "Clear the console message history");
#endif
LOG_SCR_MSG(_E(D) "Getting started:");
LOG_SCR_MSG(" " _E(>) "Enter " _E(b) "help (what)" _E(.) " for information about " _E(l) "(what)");
Expand Down
8 changes: 1 addition & 7 deletions doomsday/client/src/dd_main.cpp
Expand Up @@ -1991,16 +1991,10 @@ dd_bool DD_Init(void)
// Lets play a nice title animation.
DD_StartTitle();

// We'll open the console and print a list of the known games too.
//Con_Execute(CMDS_DDAY, "conopen", true, false);
if(!CommandLine_Exists("-noautoselect"))
{
LOG_WARNING("Game could not be selected automatically");
LOG_NOTE("Game could not be selected automatically");
}
/// @todo Whether or not to list the games depends on whether the app
/// has a graphical interface. The graphical client will display the
/// GameSelection widget where as the server will not.
//Con_Execute(CMDS_DDAY, "listgames", false, false);
}

return true;
Expand Down
6 changes: 5 additions & 1 deletion doomsday/client/src/gl/gl_main.cpp
Expand Up @@ -97,14 +97,18 @@ static viewport_t currentView;
static void videoFSAAChanged()
{
if(novideo || !WindowSystem::mainExists()) return;
ClientWindowSystem::main().updateCanvasFormat();
ClientWindow::main().updateCanvasFormat();
}

static void videoVsyncChanged()
{
if(novideo || !WindowSystem::mainExists()) return;

#ifdef WIN32
ClientWindow::main().updateCanvasFormat();
#else
GL_SetVSync(Con_GetByte("vid-vsync") != 0);
#endif
}

void GL_Register()
Expand Down
8 changes: 5 additions & 3 deletions doomsday/client/src/render/cameralensfx.cpp
Expand Up @@ -45,6 +45,7 @@
#include "render/fx/lensflares.h"
#include "render/fx/postprocessing.h"
#include "render/fx/vignette.h"
#include "render/fx/bloom.h"
#include "con_main.h"

#include "ui/clientwindow.h"
Expand Down Expand Up @@ -78,7 +79,7 @@ struct ConsoleEffectStack
static ConsoleEffectStack fxConsole[DDMAXPLAYERS];

#define IDX_LENS_FLARES 2
#define IDX_POST_PROCESSING 3
#define IDX_POST_PROCESSING 4

D_CMD(PostFx)
{
Expand Down Expand Up @@ -122,9 +123,10 @@ void LensFx_Init()
for(int i = 0; i < DDMAXPLAYERS; ++i)
{
ConsoleEffectStack &stack = fxConsole[i];
stack.effects.append(new fx::ColorFilter(i));
stack.effects.append(new fx::Vignette(i));
stack.effects.append(new fx::LensFlares(i));
stack.effects.append(new fx::Bloom(i));
stack.effects.append(new fx::LensFlares(i)); // IDX_LENS_FLARES
stack.effects.append(new fx::ColorFilter(i));
stack.effects.append(new fx::PostProcessing(i)); // IDX_POST_PROCESSING
}
}
Expand Down

0 comments on commit 81c4692

Please sign in to comment.