Skip to content

Commit

Permalink
Renderer|FX|Console: Added cmd ‘postfx’ for setting the post-processi…
Browse files Browse the repository at this point in the history
…ng shader

The ‘postfx’ command can start a shader fade-in animation, or fade
out the current shader. Each console is treated separately (console #
is the first argument).
  • Loading branch information
skyjake committed Nov 15, 2013
1 parent 2f1db96 commit 5fd6348
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions doomsday/client/include/render/cameralensfx.h
Expand Up @@ -19,6 +19,7 @@
#ifndef DENG_CLIENT_CAMERALENSFX_H
#define DENG_CLIENT_CAMERALENSFX_H

void LensFx_Register();
void LensFx_Init();
void LensFx_Shutdown();

Expand Down
38 changes: 37 additions & 1 deletion doomsday/client/src/render/cameralensfx.cpp
Expand Up @@ -43,6 +43,7 @@
#include "render/fx/lensflares.h"
#include "render/fx/postprocessing.h"
#include "render/fx/vignette.h"
#include "con_main.h"

#include "ui/clientwindow.h"

Expand Down Expand Up @@ -74,6 +75,41 @@ struct ConsoleEffectStack

static ConsoleEffectStack fxConsole[DDMAXPLAYERS];

#define IDX_POST_PROCESSING 3

D_CMD(PostFx)
{
DENG_UNUSED(argc);

int console = String(argv[1]).toInt();
String const shader = argv[2];
TimeDelta const span = String(argv[3]).toFloat();

if(console < 0 || console >= DDMAXPLAYERS)
{
LOG_WARNING("Invalid console %i") << console;
return false;
}

fx::PostProcessing *post =
static_cast<fx::PostProcessing *>(fxConsole[console].effects[IDX_POST_PROCESSING]);

// Special case to clear out the current shader.
if(shader == "none")
{
post->fadeOut(span);
return true;
}

post->fadeInShader(shader, span);
return true;
}

void LensFx_Register()
{
C_CMD("postfx", "isf", PostFx);
}

void LensFx_Init()
{
for(int i = 0; i < DDMAXPLAYERS; ++i)
Expand All @@ -82,7 +118,7 @@ void LensFx_Init()
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::PostProcessing(i));
stack.effects.append(new fx::PostProcessing(i)); // IDX_POST_PROCESSING
}
}

Expand Down
1 change: 1 addition & 0 deletions doomsday/client/src/render/rend_main.cpp
Expand Up @@ -329,6 +329,7 @@ void Rend_Register()
Rend_RadioRegister();
Rend_SpriteRegister();
//Rend_ConsoleRegister();
LensFx_Register();
fx::Vignette::consoleRegister();
VR::consoleRegister();
}
Expand Down

0 comments on commit 5fd6348

Please sign in to comment.