Commit 3178ade4 authored by AL's avatar AL

added blur manager (no blur yet)

parent aed6a515
#include "BlurManager.h"
#include <algorithm>
#include "Framework\FrameCommander.h"
void BlurManager::AddBlur(float blur)
{
pendingBlur += blur;
}
void BlurManager::UpdateBlur(float dt)
{
pendingBlur *= (blurFalloff*dt);
float coeff = blurChangeSensitivity * dt;
currentBlur = currentBlur * (1.0f - coeff) + pendingBlur * coeff;
if (currentBlur <= 0.001f)currentBlur = 0.0f;
FrameCommander::SetBlurMod(currentBlur);
}
float BlurManager::pendingBlur = 0.0f;
#pragma once
class BlurManager
{
public:
static void AddBlur(float blur); //1.0f - a lot of blur
void UpdateBlur(float dt);
private:
float currentBlur = 0.0f;
static float pendingBlur;
static constexpr float blurFalloff = 56.5f;
static constexpr float blurChangeSensitivity = 5.99f;
};
......@@ -12,6 +12,11 @@
#include "EffectHandler.h"
#include "CameraManager.h"
#include "BlurManager.h"
#define DDDR damageDigitsDrawingRange
......@@ -120,40 +125,39 @@ int CombatManager::ProcessInput(Keyboard::Event in_event) //why does it return
//{
// SL::PendDistortion(SL::LightDistortionType::YellowSpark);
//}
//if (in_event.GetCode() == 'H') //for testing
if (in_event.GetCode() == 'H') //for testing
{
BlurManager::AddBlur(0.2f);
}
if (in_event.GetCode() == 'J') //for testing
{
BlurManager::AddBlur(0.9f);
}
//
//if (in_event.GetCode() == 'K') //for testing
//{
// SL::PendDistortion(SL::LightDistortionType::GreenWave);
// EH::AddEffect3D(EH::Effect::PlayerSandThrow);
//}
//
//if (in_event.GetCode() == 'J') //for testing
//if (in_event.GetCode() == 'L') //for testing
//{
// EH::AddEffect3D(EH::Effect::PlayerSandThrowDamage);
// EH::AddEffect3D(EH::Effect::PlayerSandStorm);
//}
//if (in_event.GetCode() == 'T') //for testing
//{
// CM::PendScenario(CM::Scenario::GhoulRage);
//}
//if (in_event.GetCode() == 'Y') //for testing
//{
// CM::PendScenario(CM::Scenario::GhoulAttack);
//}
//if (in_event.GetCode() == 'U') //for testing
//{
// CM::PendScenario(CM::Scenario::GhoulAttackMiss);
//}
//if (in_event.GetCode() == 'I') //for testing
//{
// CM::PendScenario(CM::Scenario::GhoulAttackBlock);
//}
//
if (in_event.GetCode() == 'K') //for testing
{
EH::AddEffect3D(EH::Effect::PlayerSandThrow);
}
if (in_event.GetCode() == 'L') //for testing
{
EH::AddEffect3D(EH::Effect::PlayerSandStorm);
}
if (in_event.GetCode() == 'T') //for testing
{
CM::PendScenario(CM::Scenario::GhoulRage);
}
if (in_event.GetCode() == 'Y') //for testing
{
CM::PendScenario(CM::Scenario::GhoulAttack);
}
if (in_event.GetCode() == 'U') //for testing
{
CM::PendScenario(CM::Scenario::GhoulAttackMiss);
}
if (in_event.GetCode() == 'I') //for testing
{
CM::PendScenario(CM::Scenario::GhoulAttackBlock);
}
if (curTurn != Turn::NotInCombat)
{
......
......@@ -178,6 +178,7 @@
<ItemGroup>
<ClInclude Include="AchievementManager.h" />
<ClInclude Include="AchievementsScreen.h" />
<ClInclude Include="BlurManager.h" />
<ClInclude Include="CameraManager.h" />
<ClInclude Include="HPBar.h" />
<ClInclude Include="Camera.h" />
......@@ -355,6 +356,7 @@
<ClCompile Include="AchievementManager.cpp" />
<ClCompile Include="AchievementsScreen.cpp" />
<ClCompile Include="ActionBox.cpp" />
<ClCompile Include="BlurManager.cpp" />
<ClCompile Include="CameraManager.cpp" />
<ClCompile Include="EffectHandler.cpp" />
<ClCompile Include="Framework\FrameCommander.cpp" />
......
......@@ -585,6 +585,9 @@
<ClInclude Include="SkillHandler.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BlurManager.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Game.cpp">
......@@ -899,6 +902,9 @@
<ClCompile Include="SkillHandler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="BlurManager.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<FxCompile Include="PhongVSNormalMap.hlsl">
......
......@@ -5,7 +5,14 @@ void FrameCommander::Execute(DXGraphics& gfx, float dt) const noxnd
using namespace Bind;
Rasterizer::Resolve(gfx, true)->Bind(gfx); //backface culling is not needed, because there are literary no backfaces
Stencil::Resolve(gfx, Stencil::Mode::Default)->Bind(gfx);
passes[0].Execute(gfx); //most models
if (blurMod == 0.0f)
{
passes[0].Execute(gfx); //most models
}
else
{
//binding new targets
}
Stencil::Resolve(gfx, Stencil::Mode::ReadOnly)->Bind(gfx); //::HUD
passes[1].Execute(gfx); //models that generally have alpha, so they are supposed to be drawn after normal models
Stencil::Resolve(gfx, Stencil::Mode::HUD)->Bind(gfx); //::HUD
......@@ -20,4 +27,11 @@ void FrameCommander::Reset() noexcept
{
p.Reset();
}
}
\ No newline at end of file
}
void FrameCommander::SetBlurMod(float blur)
{
blurMod = blur;
}
float FrameCommander::blurMod = 0.0f;
\ No newline at end of file
......@@ -14,6 +14,17 @@ public:
}
void Execute(DXGraphics& gfx, float dt) const noxnd;
void Reset() noexcept;
static void SetBlurMod(float blur); //make friend of blur commander or something
static float blurMod; //0.0f - no blur; 1.0f - very dank blur
private:
std::array<Pass, 5> passes;
};
\ No newline at end of file
......@@ -118,7 +118,7 @@ int Game::Go()
wnd.DXGfx().SetCamera(ll.GetCameraMatrix());
ll.UpdateAndBindLight(dt, ll.GetCameraMatrix());
wnd.DXGfx().SetCamPos(ll.GetCameraPosition());
bm.UpdateBlur(dt);
hud.Submit();
......@@ -150,6 +150,18 @@ int Game::Go()
cm.UpdateCombatState(dt);
am.Update();
hud.Animate(dt);
TD::DrawString(std::to_wstring(FrameCommander::blurMod), Vec2{ 0.0f, 0.0f },Colors::Magenta,0.09f);
}
}
......
......@@ -28,6 +28,8 @@
#include "EffectHandler.h"
#include "AchievementManager.h"
#include "BlurManager.h"
class Game
{
public:
......@@ -61,4 +63,5 @@ private:
HUD hud;
EffectHandler eh;
AchievementManager am;
BlurManager bm;
};
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment