mirror of https://github.com/AxioDL/metaforce.git
Functioning XRay blur filter
This commit is contained in:
parent
9ca7f9c9e4
commit
25d808e2b9
|
@ -37,4 +37,5 @@ add_library(DNACommon
|
|||
Tweaks/ITweakPlayerControl.hpp
|
||||
Tweaks/ITweakPlayerGun.hpp
|
||||
Tweaks/ITweakGunRes.hpp
|
||||
Tweaks/ITweakPlayerRes.hpp)
|
||||
Tweaks/ITweakPlayerRes.hpp
|
||||
Tweaks/ITweakGui.hpp)
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#ifndef __DNACOMMON_ITWEAKGUI_HPP__
|
||||
#define __DNACOMMON_ITWEAKGUI_HPP__
|
||||
|
||||
#include "../DNACommon.hpp"
|
||||
#include "zeus/CVector2f.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
|
||||
struct ITweakGui : BigYAML
|
||||
{
|
||||
virtual float GetScanSpeed(int idx) const=0;
|
||||
virtual float GetXrayBlurScaleLinear() const=0;
|
||||
virtual float GetXrayBlurScaleQuadratic() const=0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __DNACOMMON_ITWEAKGUI_HPP__
|
|
@ -22,7 +22,8 @@ make_dnalist(liblist
|
|||
Tweaks/CTweakPlayerControl
|
||||
Tweaks/CTweakPlayerGun
|
||||
Tweaks/CTweakGunRes
|
||||
Tweaks/CTweakPlayerRes)
|
||||
Tweaks/CTweakPlayerRes
|
||||
Tweaks/CTweakGui)
|
||||
|
||||
add_library(DNAMP1
|
||||
DNAMP1.hpp DNAMP1.cpp
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
#ifndef _DNAMP1_CTWEAKGAME_HPP_
|
||||
#define _DNAMP1_CTWEAKGAME_HPP_
|
||||
|
||||
#include "../../DNACommon/Tweaks/ITweakGui.hpp"
|
||||
|
||||
namespace DataSpec
|
||||
{
|
||||
namespace DNAMP1
|
||||
{
|
||||
|
||||
struct CTweakGui : ITweakGui
|
||||
{
|
||||
DECL_YAML
|
||||
Value<bool> x4_;
|
||||
Value<float> x8_;
|
||||
Value<float> xc_;
|
||||
Value<float> x10_;
|
||||
Value<float> x14_;
|
||||
Value<float> x18_;
|
||||
Value<float> x1c_;
|
||||
Value<float> x20_;
|
||||
Value<float> x24_;
|
||||
Value<float> x28_;
|
||||
Value<atUint32> x2c_ = 0;
|
||||
Value<float> x30_;
|
||||
Value<float> x34_;
|
||||
Value<float> x38_;
|
||||
Value<float> x3c_;
|
||||
Value<bool> x40_;
|
||||
Value<float> x44_;
|
||||
Value<float> x48_;
|
||||
Value<float> x4c_;
|
||||
Value<float> x50_;
|
||||
Value<float> x54_;
|
||||
Value<float> x58_;
|
||||
Value<float> x5c_;
|
||||
Value<float> x60_;
|
||||
Value<atVec3f> x64_;
|
||||
Value<atVec3f> x70_;
|
||||
Value<float> x7c_;
|
||||
Value<float> x80_;
|
||||
Value<float> x84_;
|
||||
Value<float> x88_;
|
||||
Value<float> x8c_;
|
||||
Value<float> x90_;
|
||||
Value<float> x94_;
|
||||
Value<float> x98_;
|
||||
Value<float> x9c_;
|
||||
Value<float> xa0_;
|
||||
Value<float> xa4_;
|
||||
Value<atUint32> xa8_;
|
||||
Value<atUint32> xac_;
|
||||
Value<atUint32> xb0_;
|
||||
Value<float> xb4_;
|
||||
Value<float> xb8_;
|
||||
Value<float> xbc_;
|
||||
Value<float> xc0_;
|
||||
Value<float> xc4_;
|
||||
Value<float> xc8_;
|
||||
Value<float> xcc_;
|
||||
Value<float> xd0_;
|
||||
Value<atUint32> xd4_;
|
||||
Value<float> xd8_;
|
||||
Value<float> xdc_;
|
||||
Value<float> xe0_;
|
||||
Value<float> xe4_;
|
||||
Value<float> xe8_;
|
||||
Value<float> xec_;
|
||||
Value<float> xf0_;
|
||||
Value<float> xf4_;
|
||||
Value<atUint32> xf8_;
|
||||
Value<atUint32> xfc_;
|
||||
Value<atUint32> x100_;
|
||||
Value<atUint32> x104_;
|
||||
Value<atUint32> x108_;
|
||||
Value<atUint32> x10c_;
|
||||
Value<float> x110_;
|
||||
Value<float> x114_;
|
||||
Value<float> x118_;
|
||||
Value<float> x11c_;
|
||||
Value<float> x120_;
|
||||
Value<float> x124_;
|
||||
Value<float> x128_;
|
||||
Value<float> x12c_;
|
||||
Value<bool> x130_;
|
||||
Value<float> x134_;
|
||||
Value<float> x138_;
|
||||
Value<atUint32> x13c_;
|
||||
Value<atUint32> x140_;
|
||||
Value<atUint32> x144_;
|
||||
Value<atUint32> x148_;
|
||||
Value<atUint32> x14c_;
|
||||
String<-1> x150_;
|
||||
String<-1> x160_;
|
||||
String<-1> x170_;
|
||||
String<-1> x180_;
|
||||
String<-1> x190_;
|
||||
Value<float> x1a0_;
|
||||
Value<float> x1a4_;
|
||||
Value<float> x1a8_;
|
||||
Value<float> x1ac_;
|
||||
Value<float> x1b0_;
|
||||
Value<float> x1b4_;
|
||||
Value<float> x1b8_;
|
||||
Value<float> x1bc_;
|
||||
Value<float> x1c0_;
|
||||
Value<float> x1c4_;
|
||||
Value<float> x1c8_;
|
||||
Value<bool> x1cc_;
|
||||
Value<bool> x1cd_;
|
||||
Value<float> x1d0_;
|
||||
Value<float> x1d4_;
|
||||
Value<float> x1d8_;
|
||||
Value<float> x1dc_;
|
||||
Value<float> x1e0_;
|
||||
Value<float> x1e4_;
|
||||
Value<float> x1e8_;
|
||||
Value<float> x1ec_;
|
||||
Value<float> x1f0_;
|
||||
Value<float> x1f4_;
|
||||
Value<float> x1f8_;
|
||||
Value<float> x1fc_;
|
||||
atVec4f x200_;
|
||||
float x204_xrayBlurScaleLinear = 0.0014f;
|
||||
float x208_xrayBlurScaleQuadratic = 0.0000525f;
|
||||
Value<float> x20c_;
|
||||
Value<float> x210_;
|
||||
Value<float> x214_;
|
||||
Value<float> x218_;
|
||||
Value<float> x21c_;
|
||||
Value<float> x220_;
|
||||
Value<float> x224_;
|
||||
float x228_;
|
||||
Value<float> x22c_;
|
||||
Value<float> x230_;
|
||||
Value<float> x234_;
|
||||
Value<float> x238_;
|
||||
Value<float> x23c_;
|
||||
Value<float> x240_;
|
||||
Value<float> x244_;
|
||||
Value<float> x248_;
|
||||
Value<float> x24c_;
|
||||
Value<float> x250_;
|
||||
Value<float> x254_;
|
||||
Value<float> x258_;
|
||||
Value<float> x25c_;
|
||||
Value<float> x260_;
|
||||
Value<float> x264_;
|
||||
Value<float> x268_;
|
||||
Value<float> x26c_;
|
||||
Value<float> x270_;
|
||||
Value<bool> x274_;
|
||||
Value<bool> x275_ = true;
|
||||
Value<float> x278_;
|
||||
Value<atUint32> x27c_;
|
||||
Value<float> x280_;
|
||||
Value<float> x284_;
|
||||
Value<atVec4f> x288_;
|
||||
Value<float> x28c_;
|
||||
Value<atVec4f> x290_;
|
||||
Value<atVec4f> x294_;
|
||||
Value<atVec4f> x298_;
|
||||
Value<atVec4f> x29c_;
|
||||
Value<atVec4f> x2a0_;
|
||||
Value<atVec4f> x2a4_;
|
||||
Value<atVec4f> x2a8_;
|
||||
Value<atVec4f> x2ac_;
|
||||
Value<atVec4f> x2b0_;
|
||||
Value<atVec4f> x2b4_;
|
||||
Value<float> x2b8_;
|
||||
Value<float> x2bc_;
|
||||
Value<float> x2c0_;
|
||||
Value<atUint32> m_scanSpeedsCount;
|
||||
Vector<float, DNA_COUNT(m_scanSpeedsCount)> x2c4_scanSpeeds;
|
||||
String<-1> x2d0_;
|
||||
String<-1> x2e0_;
|
||||
String<-1> x2f0_;
|
||||
Value<atVec4f> x300_;
|
||||
Value<atVec4f> x304_;
|
||||
Value<float> x308_;
|
||||
Value<float> x30c_;
|
||||
Value<float> x310_;
|
||||
String<-1> x314_;
|
||||
String<-1> x324_;
|
||||
String<-1> x334_;
|
||||
Value<atVec4f> x344_;
|
||||
Value<atVec4f> x348_;
|
||||
Value<atVec4f> x34c_;
|
||||
Value<atVec4f> x350_;
|
||||
Value<atVec4f> x354_;
|
||||
Value<atVec4f> x358_;
|
||||
Value<float> x35c_;
|
||||
Value<float> x360_;
|
||||
Value<float> x364_;
|
||||
|
||||
float GetXrayBlurScaleLinear() const { return x204_xrayBlurScaleLinear; }
|
||||
float GetXrayBlurScaleQuadratic() const { return x208_xrayBlurScaleQuadratic; }
|
||||
|
||||
float GetScanSpeed(int idx) const
|
||||
{
|
||||
if (idx < 0 || idx >= x2c4_scanSpeeds.size())
|
||||
return 0.f;
|
||||
return x2c4_scanSpeeds[idx];
|
||||
}
|
||||
|
||||
void FixupValues()
|
||||
{
|
||||
xd8_ = zeus::degToRad(xd8_);
|
||||
xdc_ = zeus::degToRad(xdc_);
|
||||
|
||||
x200_.vec[0] = x1f4_ * 0.25f;
|
||||
x200_.vec[1] = x1f8_ * 0.25f;
|
||||
x200_.vec[2] = x1fc_ * 0.25f;
|
||||
x200_.vec[3] = 1.f;
|
||||
|
||||
x210_ = zeus::degToRad(x210_);
|
||||
x228_ = x220_ + x224_;
|
||||
|
||||
if (x27c_ == 1)
|
||||
x27c_ = 2;
|
||||
else if (x27c_ == 2)
|
||||
x27c_ = 4;
|
||||
else if (x27c_ == 3)
|
||||
x27c_ = 5;
|
||||
else
|
||||
x27c_ = 0;
|
||||
|
||||
x84_ *= 2.0f;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -24,12 +24,6 @@ using YAMLNode = athena::io::YAMLNode;
|
|||
namespace urde
|
||||
{
|
||||
|
||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||
URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
|
||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||
|
||||
void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
||||
{
|
||||
#if 0
|
||||
|
@ -49,18 +43,17 @@ void ViewManager::BuildTestPART(urde::IObjectStore& objStore)
|
|||
//m_modelTest = objStore.GetObj("gun_cmdl");
|
||||
m_modelTest = objStore.GetObj("MP1/Shared/CMDL_B2B41738.blend");
|
||||
//m_modelTest = objStore.GetObj("CMDL_GameCube");
|
||||
m_modelTest.Lock();
|
||||
|
||||
//m_partGenDesc = objStore.GetObj({hecl::FOURCC('PART'), 0x972A5CD2});
|
||||
//m_partGenDesc = objStore.GetObj("PowerCharge");
|
||||
//m_partGenDesc.Lock();
|
||||
//m_partGen.reset(new urde::CElementGen(m_partGenDesc,
|
||||
// urde::CElementGen::EModelOrientationType::Normal,
|
||||
// urde::CElementGen::EOptionalSystemFlags::None));
|
||||
//m_partGen->SetGlobalScale({5.f, 5.f, 5.f});
|
||||
m_lineRenderer.reset(new urde::CLineRenderer(urde::CLineRenderer::EPrimitiveMode::LineStrip, 4, nullptr, true));
|
||||
|
||||
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView));
|
||||
TLockedToken<CTexture> xrayPalette = objStore.GetObj("TXTR_XRayPalette");
|
||||
m_particleView.reset(new ParticleView(*this, m_viewResources, *m_rootView, xrayPalette));
|
||||
|
||||
//m_moviePlayer.reset(new CMoviePlayer("Video/SpecialEnding.thp", 1.f, false, true));
|
||||
//m_moviePlayer->SetFrame({-1.0f, 1.0f, 0.f}, {-1.0f, -1.0f, 0.f}, {1.0f, -1.0f, 0.f}, {1.0f, 1.0f, 0.f});
|
||||
|
@ -115,7 +108,7 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
|||
float aspect = windowRect.size[0] / float(windowRect.size[1]);
|
||||
|
||||
CGraphics::SetPerspective(55.0, aspect, 0.1f, 1000.f);
|
||||
CGraphics::SetFog(ERglFogMode::PerspExp, 7.f, 15.f, zeus::CColor::skRed);
|
||||
//CGraphics::SetFog(ERglFogMode::PerspExp, 7.f, 15.f, zeus::CColor::skRed);
|
||||
//CGraphics::SetFog(ERglFogMode::PerspExp, 10.f + std::sin(m_theta) * 5.f, 15.f + std::sin(m_theta) * 5.f, zeus::CColor::skRed);
|
||||
zeus::CFrustum frustum;
|
||||
frustum.updatePlanes(CGraphics::g_GXModelView, zeus::SProjPersp(55.0, aspect, 0.1f, 1000.f));
|
||||
|
@ -131,7 +124,9 @@ void ViewManager::ParticleView::draw(boo::IGraphicsCommandQueue *gfxQ)
|
|||
//g_Renderer->DoThermalBlendCold();
|
||||
//flags.m_extendedShaderIdx = 2;
|
||||
flags.m_extendedShaderIdx = 1;
|
||||
m_widescreen.draw(zeus::CColor::skBlack, std::sin(m_theta * 3.f) / 2.f + 0.5f);
|
||||
m_vm.m_modelTest->Draw(flags);
|
||||
m_xrayBlur.draw(25.f);
|
||||
//g_Renderer->DoThermalBlendHot();
|
||||
//m_spaceWarpFilter.setStrength(std::sin(m_theta * 5.f) * 0.5f + 0.5f);
|
||||
//m_spaceWarpFilter.draw(zeus::CVector2f{0.f, 0.f});
|
||||
|
@ -404,11 +399,6 @@ void ViewManager::stop()
|
|||
{
|
||||
m_videoVoice.reset();
|
||||
m_projManager.shutdown();
|
||||
TShader<CThermalColdFilter>::Shutdown();
|
||||
TShader<CThermalHotFilter>::Shutdown();
|
||||
TShader<CSpaceWarpFilter>::Shutdown();
|
||||
TMultiBlendShader<CColoredQuadFilter>::Shutdown();
|
||||
TMultiBlendShader<CTexturedQuadFilter>::Shutdown();
|
||||
CElementGen::Shutdown();
|
||||
CMoviePlayer::Shutdown();
|
||||
CLineRenderer::Shutdown();
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include "Runtime/Graphics/CModel.hpp"
|
||||
#include "Runtime/Particle/CGenDescription.hpp"
|
||||
#include "Runtime/Character/CAssetFactory.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CColoredQuadFilter.hpp"
|
||||
#include "Runtime/Graphics/Shaders/CXRayBlurFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -48,17 +50,20 @@ class ViewManager : public specter::IViewManager
|
|||
{
|
||||
ViewManager& m_vm;
|
||||
CSpaceWarpFilter m_spaceWarpFilter;
|
||||
CWideScreenFilter m_widescreen = { CCameraFilterPass::EFilterType::Blend };
|
||||
CXRayBlurFilter m_xrayBlur;
|
||||
CRandom16 m_random;
|
||||
float m_theta = 0.f;
|
||||
public:
|
||||
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent)
|
||||
: View(res, parent), m_vm(vm), m_random(20) {}
|
||||
ParticleView(ViewManager& vm, specter::ViewResources& res, specter::View& parent,
|
||||
TLockedToken<CTexture>& xrayPalette)
|
||||
: View(res, parent), m_vm(vm), m_xrayBlur(xrayPalette), m_random(20) {}
|
||||
void resized(const boo::SWindowRect& root, const boo::SWindowRect& sub);
|
||||
void draw(boo::IGraphicsCommandQueue* gfxQ);
|
||||
};
|
||||
std::unique_ptr<ParticleView> m_particleView;
|
||||
urde::TCachedToken<CModel> m_modelTest;
|
||||
urde::TCachedToken<CGenDescription> m_partGenDesc;
|
||||
urde::TLockedToken<CModel> m_modelTest;
|
||||
urde::TLockedToken<CGenDescription> m_partGenDesc;
|
||||
std::unique_ptr<CElementGen> m_partGen;
|
||||
std::unique_ptr<CLineRenderer> m_lineRenderer;
|
||||
std::unique_ptr<CMoviePlayer> m_moviePlayer;
|
||||
|
|
|
@ -308,8 +308,11 @@ class TLockedToken : public TCachedToken<T>
|
|||
{
|
||||
public:
|
||||
TLockedToken() = default;
|
||||
TLockedToken(const CToken& other) : TCachedToken<T>(other) {CToken::Lock();}
|
||||
TLockedToken(CToken&& other) : TCachedToken<T>(std::move(other)) {CToken::Lock();}
|
||||
TLockedToken(const TLockedToken& other) : TCachedToken<T>(other) { CToken::Lock(); }
|
||||
TLockedToken& operator=(const TLockedToken& other) { CToken::operator=(other); CToken::Lock(); return *this; }
|
||||
TLockedToken(const CToken& other) : TCachedToken<T>(other) { CToken::Lock(); }
|
||||
TLockedToken& operator=(const CToken& other) { CToken::operator=(other); CToken::Lock(); return *this; }
|
||||
TLockedToken(CToken&& other) : TCachedToken<T>(std::move(other)) { CToken::Lock(); }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "CCameraFilter.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
#include "CSimplePool.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -11,15 +12,15 @@ void CCameraFilterPass::DrawFilter(EFilterType type, EFilterShape shape, const z
|
|||
{
|
||||
switch (type)
|
||||
{
|
||||
case EFilterType::ColorMultiply:
|
||||
case EFilterType::InvertDst:
|
||||
case EFilterType::AdditiveAlpha:
|
||||
case EFilterType::Subtractive:
|
||||
case EFilterType::AlphaBlended:
|
||||
case EFilterType::AdditiveDestColor:
|
||||
case EFilterType::NoColorWrite:
|
||||
case EFilterType::None:
|
||||
case EFilterType::None2:
|
||||
case EFilterType::Multiply:
|
||||
case EFilterType::Invert:
|
||||
case EFilterType::Add:
|
||||
case EFilterType::Subtract:
|
||||
case EFilterType::Blend:
|
||||
case EFilterType::SceneAdd:
|
||||
case EFilterType::NoColor:
|
||||
case EFilterType::Passthru:
|
||||
case EFilterType::Widescreen:
|
||||
default: return;
|
||||
}
|
||||
DrawFilterShape(shape, color, tex, uvScale);
|
||||
|
@ -30,4 +31,88 @@ void CCameraFilterPass::DrawFilterShape(EFilterShape shape, const zeus::CColor&
|
|||
{
|
||||
}
|
||||
|
||||
void CCameraBlurPass::Draw()
|
||||
{
|
||||
if (x10_curType == EBlurType::NoBlur)
|
||||
return;
|
||||
|
||||
SClipScreenRect rect = {};
|
||||
rect.xc_width = CGraphics::g_ViewportResolution.x;
|
||||
rect.x10_height = CGraphics::g_ViewportResolution.y;
|
||||
CGraphics::ResolveSpareTexture(rect);
|
||||
|
||||
if (x10_curType == EBlurType::Xray)
|
||||
{
|
||||
float blurX = x1c_curValue * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
||||
float blurY = x1c_curValue * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
float iflt = i;
|
||||
float uvScale = (1.f - (blurX * iflt + blurY * iflt * iflt));
|
||||
float uvOffset = uvScale * -0.5f + 0.5f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraBlurPass::Update(float dt)
|
||||
{
|
||||
if (x28_remainingTime > 0.f)
|
||||
{
|
||||
x28_remainingTime = std::max(x28_remainingTime - dt, 0.f);
|
||||
x1c_curValue = x18_endValue + (x20_startValue - x18_endValue) * x28_remainingTime / x24_totalTime;
|
||||
|
||||
if (x28_remainingTime != 0.f)
|
||||
return;
|
||||
|
||||
x10_curType = x14_endType;
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraBlurPass::SetBlur(EBlurType type, float amount, float duration)
|
||||
{
|
||||
if (duration == 0.f)
|
||||
{
|
||||
x24_totalTime = 0.f;
|
||||
x28_remainingTime = 0.f;
|
||||
x18_endValue = amount;
|
||||
x1c_curValue = amount;
|
||||
x20_startValue = amount;
|
||||
|
||||
if (x10_curType == EBlurType::NoBlur)
|
||||
{
|
||||
if (type == EBlurType::Xray)
|
||||
x0_paletteTex = g_SimplePool->GetObj("TXTR_XRayPalette");
|
||||
}
|
||||
|
||||
x14_endType = type;
|
||||
x10_curType = type;
|
||||
//x2c_usePersistent = b1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//x2c_usePersistent = b1;
|
||||
x24_totalTime = duration;
|
||||
x28_remainingTime = duration;
|
||||
x18_endValue = x1c_curValue;
|
||||
x20_startValue = amount;
|
||||
|
||||
if (type != x14_endType)
|
||||
{
|
||||
if (x10_curType == EBlurType::NoBlur)
|
||||
{
|
||||
if (type == EBlurType::Xray)
|
||||
x0_paletteTex = g_SimplePool->GetObj("TXTR_XRayPalette");
|
||||
x10_curType = type;
|
||||
}
|
||||
x14_endType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCameraBlurPass::DisableBlur(float duration)
|
||||
{
|
||||
SetBlur(EBlurType::NoBlur, 0.f, duration);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "zeus/CColor.hpp"
|
||||
#include "RetroTypes.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -13,40 +14,66 @@ class CCameraFilterPass
|
|||
public:
|
||||
enum class EFilterType
|
||||
{
|
||||
None,
|
||||
ColorMultiply,
|
||||
InvertDst,
|
||||
AdditiveAlpha,
|
||||
Subtractive,
|
||||
AlphaBlended,
|
||||
None2,
|
||||
AdditiveDestColor,
|
||||
NoColorWrite
|
||||
Passthru,
|
||||
Multiply,
|
||||
Invert,
|
||||
Add,
|
||||
Subtract,
|
||||
Blend,
|
||||
Widescreen,
|
||||
SceneAdd,
|
||||
NoColor
|
||||
};
|
||||
enum class EFilterShape
|
||||
{
|
||||
QuadA,
|
||||
QuadB,
|
||||
QuadC,
|
||||
QuadQuarters,
|
||||
WideScreen,
|
||||
ScanLinesA,
|
||||
ScanLinesB,
|
||||
RandomStaticA,
|
||||
RandomStaticB
|
||||
Fullscreen,
|
||||
FullscreenHalvesLeftRight,
|
||||
FullscreenHalvesTopBottom,
|
||||
FullscreenQuarters,
|
||||
CinemaBars,
|
||||
ScanLinesEven,
|
||||
ScanLinesOdd,
|
||||
RandomStatic,
|
||||
CookieCutterDepthRandomStatic
|
||||
};
|
||||
private:
|
||||
public:
|
||||
void SetFilter(EFilterType type, EFilterShape shape, float, const zeus::CColor& color, u32) {}
|
||||
void DisableFilter(float) {}
|
||||
static void DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color,
|
||||
const CTexture* tex, float uvScale);
|
||||
static void DrawFilterShape(EFilterShape shape, const zeus::CColor& color,
|
||||
const CTexture* tex, float uvScale);
|
||||
public:
|
||||
void SetFilter(EFilterType type, EFilterShape shape, float, const zeus::CColor& color, u32) {}
|
||||
void DisableFilter(float) {}
|
||||
|
||||
};
|
||||
|
||||
class CCameraBlurPass
|
||||
{
|
||||
public:
|
||||
enum class EBlurType
|
||||
{
|
||||
NoBlur,
|
||||
LoBlur,
|
||||
HiBlur,
|
||||
Xray
|
||||
};
|
||||
private:
|
||||
TLockedToken<CTexture> x0_paletteTex;
|
||||
EBlurType x10_curType = EBlurType::NoBlur;
|
||||
EBlurType x14_endType = EBlurType::NoBlur;
|
||||
float x18_endValue = 0.f;
|
||||
float x1c_curValue = 0.f;
|
||||
float x20_startValue = 0.f;
|
||||
float x24_totalTime = 0.f;
|
||||
float x28_remainingTime = 0.f;
|
||||
//bool x2c_usePersistent = false;
|
||||
//bool x2d_noPersistentCopy = false;
|
||||
//u32 x30_persistentBuf = 0;
|
||||
|
||||
void Draw();
|
||||
void Update(float dt);
|
||||
void SetBlur(EBlurType type, float amount, float duration);
|
||||
void DisableBlur(float duration);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -109,8 +109,8 @@ void CCameraManager::Update(float dt, CStateManager& stateMgr)
|
|||
zeus::CColor tmpColor; // Get from water
|
||||
zeus::CVector2f tmpVector; // Get from camera
|
||||
x3c_fog.SetFogExplicit(ERglFogMode::PerspExp, tmpColor, tmpVector);
|
||||
stateMgr.GetCameraFilterPass(4).SetFilter(CCameraFilterPass::EFilterType::ColorMultiply,
|
||||
CCameraFilterPass::EFilterShape::QuadA,
|
||||
stateMgr.GetCameraFilterPass(4).SetFilter(CCameraFilterPass::EFilterType::Multiply,
|
||||
CCameraFilterPass::EFilterShape::Fullscreen,
|
||||
0.f, tmpColor, -1);
|
||||
}
|
||||
x86_26_inWater = true;
|
||||
|
|
|
@ -22,5 +22,6 @@ DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr;
|
|||
DataSpec::ITweakPlayerGun* g_tweakPlayerGun = nullptr;
|
||||
DataSpec::ITweakGunRes* g_tweakGunRes = nullptr;
|
||||
DataSpec::ITweakPlayerRes* g_tweakPlayerRes = nullptr;
|
||||
DataSpec::ITweakGui* g_tweakGui = nullptr;
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerGun.hpp"
|
||||
#include "../DataSpec/DNACommon/Tweaks/ITweakGunRes.hpp"
|
||||
#include "../DataSpec/DNACommon/Tweaks/ITweakPlayerRes.hpp"
|
||||
#include "../DataSpec/DNACommon/Tweaks/ITweakGui.hpp"
|
||||
#include "AutoMapper/ITweakAutoMapper.hpp"
|
||||
#include "GuiSys/ITweakGui.hpp"
|
||||
|
||||
|
@ -32,7 +33,7 @@ extern DataSpec::ITweakPlayerGun* g_tweakPlayerGun;
|
|||
extern DataSpec::ITweakGunRes* g_tweakGunRes;
|
||||
extern DataSpec::ITweakPlayerRes* g_tweakPlayerRes;
|
||||
extern ITweakAutoMapper* g_tweakAutoMapper;
|
||||
extern ITweakGui* g_tweakGui;
|
||||
extern DataSpec::ITweakGui* g_tweakGui;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
class CBooRenderer : public IRenderer
|
||||
{
|
||||
friend class CBooModel;
|
||||
friend class CWorldTransManager;
|
||||
|
||||
struct CAreaListItem
|
||||
{
|
||||
|
|
|
@ -6,7 +6,9 @@ if(WIN32)
|
|||
Shaders/CModelShadersHLSL.cpp
|
||||
Shaders/CThermalColdFilterHLSL.cpp
|
||||
Shaders/CThermalHotFilterHLSL.cpp
|
||||
Shaders/CSpaceWarpFilterHLSL.cpp)
|
||||
Shaders/CSpaceWarpFilterHLSL.cpp
|
||||
Shaders/CCameraBlurFilterHLSL.cpp
|
||||
Shaders/CXRayBlurFilterHLSL.cpp)
|
||||
elseif(APPLE)
|
||||
set(PLAT_SRCS
|
||||
Shaders/CLineRendererShadersMetal.cpp
|
||||
|
@ -15,7 +17,9 @@ elseif(APPLE)
|
|||
Shaders/CModelShadersMetal.cpp
|
||||
Shaders/CThermalColdFilterMetal.cpp
|
||||
Shaders/CThermalHotFilterMetal.cpp
|
||||
Shaders/CSpaceWarpFilterMetal.cpp)
|
||||
Shaders/CSpaceWarpFilterMetal.cpp
|
||||
Shaders/CCameraBlurFilterMetal.cpp
|
||||
Shaders/CXRayBlurFilterMetal.cpp)
|
||||
endif()
|
||||
|
||||
set(GRAPHICS_SOURCES
|
||||
|
@ -48,6 +52,8 @@ set(GRAPHICS_SOURCES
|
|||
Shaders/CThermalColdFilter.hpp Shaders/CThermalColdFilter.cpp Shaders/CThermalColdFilterGLSL.cpp
|
||||
Shaders/CThermalHotFilter.hpp Shaders/CThermalHotFilter.cpp Shaders/CThermalHotFilterGLSL.cpp
|
||||
Shaders/CSpaceWarpFilter.hpp Shaders/CSpaceWarpFilter.cpp Shaders/CSpaceWarpFilterGLSL.cpp
|
||||
Shaders/CCameraBlurFilter.hpp Shaders/CCameraBlurFilter.cpp Shaders/CCameraBlurFilterGLSL.cpp
|
||||
Shaders/CXRayBlurFilter.hpp Shaders/CXRayBlurFilter.cpp Shaders/CXRayBlurFilterGLSL.cpp
|
||||
${PLAT_SRCS})
|
||||
|
||||
runtime_add_list(Graphics GRAPHICS_SOURCES)
|
||||
|
|
|
@ -39,6 +39,10 @@ class CTexture
|
|||
void BuildC8(const void* data);
|
||||
|
||||
public:
|
||||
~CTexture()
|
||||
{
|
||||
printf("");
|
||||
}
|
||||
CTexture(std::unique_ptr<u8[]>&& in, u32 length);
|
||||
enum class EClampMode
|
||||
{
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
#include "CCameraBlurFilter.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CCameraBlurFilter::CCameraBlurFilter()
|
||||
{
|
||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
struct Vert
|
||||
{
|
||||
zeus::CVector2f m_pos;
|
||||
zeus::CVector2f m_uv;
|
||||
} verts[4] =
|
||||
{
|
||||
{{-1.0, -1.0}, {0.0, 0.0}},
|
||||
{{-1.0, 1.0}, {0.0, 1.0}},
|
||||
{{ 1.0, -1.0}, {1.0, 0.0}},
|
||||
{{ 1.0, 1.0}, {1.0, 1.0}},
|
||||
};
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, 32, 4);
|
||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
m_dataBind = TShader<CCameraBlurFilter>::BuildShaderDataBinding(ctx, *this);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void CCameraBlurFilter::draw()
|
||||
{
|
||||
SClipScreenRect clipRect = {};
|
||||
clipRect.xc_width = CGraphics::g_ViewportResolution.x;
|
||||
clipRect.x10_height = CGraphics::g_ViewportResolution.y;
|
||||
CGraphics::ResolveSpareTexture(clipRect);
|
||||
|
||||
//m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
||||
}
|
||||
|
||||
URDE_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef __URDE_CCAMERABLURFILTER_HPP__
|
||||
#define __URDE_CCAMERABLURFILTER_HPP__
|
||||
|
||||
#include "TShader.hpp"
|
||||
#include "zeus/CMatrix4f.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
class CCameraBlurFilter
|
||||
{
|
||||
friend struct CCameraBlurFilterGLDataBindingFactory;
|
||||
friend struct CCameraBlurFilterVulkanDataBindingFactory;
|
||||
friend struct CCameraBlurFilterMetalDataBindingFactory;
|
||||
friend struct CCameraBlurFilterD3DDataBindingFactory;
|
||||
|
||||
struct Uniform
|
||||
{
|
||||
};
|
||||
boo::GraphicsDataToken m_token;
|
||||
boo::IGraphicsBufferS* m_vbo;
|
||||
boo::IGraphicsBufferD* m_uniBuf;
|
||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
||||
Uniform m_uniform;
|
||||
|
||||
public:
|
||||
CCameraBlurFilter();
|
||||
void draw();
|
||||
|
||||
using _CLS = CCameraBlurFilter;
|
||||
#include "TShaderDecl.hpp"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CCAMERABLURFILTER_HPP__
|
|
@ -0,0 +1,124 @@
|
|||
#include "CCameraBlurFilter.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
static const char* VS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"layout(location=0) in vec4 posIn;\n"
|
||||
"layout(location=1) in vec4 uvIn;\n"
|
||||
"\n"
|
||||
"UBINDING0 uniform ThermalHotUniform\n"
|
||||
"{\n"
|
||||
" vec4 colorReg0;\n"
|
||||
" vec4 colorReg1;\n"
|
||||
" vec4 colorReg2;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct VertToFrag\n"
|
||||
"{\n"
|
||||
" vec2 sceneUv;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SBINDING(0) out VertToFrag vtf;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vtf.sceneUv = uvIn.xy;\n"
|
||||
" gl_Position = vec4(posIn.xyz, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"struct VertToFrag\n"
|
||||
"{\n"
|
||||
" vec2 sceneUv;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SBINDING(0) in VertToFrag vtf;\n"
|
||||
"layout(location=0) out vec4 colorOut;\n"
|
||||
"TBINDING0 uniform sampler2D sceneTex;\n"
|
||||
"TBINDING1 uniform sampler2D paletteTex;\n"
|
||||
"const vec4 kRGBToYPrime = vec4(0.299, 0.587, 0.114, 0.0);\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" float sceneSample = dot(texture(sceneTex, vtf.sceneUv), kRGBToYPrime);\n"
|
||||
" vec4 colorSample = texture(paletteTex, vec2(sceneSample / 17.0, 0.5));\n"
|
||||
" colorOut = colorSample * sceneSample;\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_SHADER(CCameraBlurFilter)
|
||||
|
||||
struct CCameraBlurFilterGLDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
||||
{
|
||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline* pipeline,
|
||||
boo::IVertexFormat*,
|
||||
CCameraBlurFilter& filter)
|
||||
{
|
||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||
|
||||
const boo::VertexElementDescriptor VtxVmt[] =
|
||||
{
|
||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
||||
};
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
|
||||
return cctx.newShaderDataBinding(pipeline,
|
||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
||||
1, bufs, stages, nullptr, nullptr, 2, texs);
|
||||
}
|
||||
};
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
struct CCameraBlurFilterVulkanDataBindingFactory : TShader<CCameraBlurFilter>::IDataBindingFactory
|
||||
{
|
||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline* pipeline,
|
||||
boo::IVertexFormat* vtxFmt,
|
||||
CCameraBlurFilter& filter)
|
||||
{
|
||||
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
||||
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, g_Renderer->GetThermoPalette()};
|
||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||
nullptr, nullptr, nullptr, 2, texs);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(boo::GLDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut)
|
||||
{
|
||||
const char* texNames[] = {"sceneTex", "paletteTex"};
|
||||
const char* uniNames[] = {"ThermalHotUniform"};
|
||||
pipeOut = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::DstAlpha,
|
||||
boo::BlendFactor::InvDstAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||
return new CCameraBlurFilterGLDataBindingFactory;
|
||||
}
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(boo::VulkanDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut)
|
||||
{
|
||||
const boo::VertexElementDescriptor VtxVmt[] =
|
||||
{
|
||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||
};
|
||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
||||
pipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::DstAlpha,
|
||||
boo::BlendFactor::InvDstAlpha, boo::Primitive::TriStrips, false, false, false);
|
||||
return new CCameraBlurFilterVulkanDataBindingFactory;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
|
@ -12,10 +12,10 @@ CColoredQuadFilter::CColoredQuadFilter(CCameraFilterPass::EFilterType type)
|
|||
zeus::CVector2f m_pos;
|
||||
} verts[4] =
|
||||
{
|
||||
{{-1.0, -1.0}},
|
||||
{{-1.0, 1.0}},
|
||||
{{ 1.0, -1.0}},
|
||||
{{ 1.0, 1.0}},
|
||||
{{0.0, 0.0}},
|
||||
{{0.0, 1.0}},
|
||||
{{1.0, 0.0}},
|
||||
{{1.0, 1.0}},
|
||||
};
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, 16, 4);
|
||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
|
@ -24,8 +24,12 @@ CColoredQuadFilter::CColoredQuadFilter(CCameraFilterPass::EFilterType type)
|
|||
});
|
||||
}
|
||||
|
||||
void CColoredQuadFilter::draw(const zeus::CColor& color)
|
||||
void CColoredQuadFilter::draw(const zeus::CColor& color, const zeus::CRectangle& rect)
|
||||
{
|
||||
m_uniform.m_matrix[0][0] = rect.size.x * 2.f;
|
||||
m_uniform.m_matrix[1][1] = rect.size.y * 2.f;
|
||||
m_uniform.m_matrix[3][0] = rect.position.x * 2.f - 1.f;
|
||||
m_uniform.m_matrix[3][1] = rect.position.y * 2.f - 1.f;
|
||||
m_uniform.m_color = color;
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
|
@ -33,6 +37,23 @@ void CColoredQuadFilter::draw(const zeus::CColor& color)
|
|||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
||||
}
|
||||
|
||||
void CWideScreenFilter::draw(const zeus::CColor& color, float t)
|
||||
{
|
||||
float aspect = CGraphics::g_ViewportResolution.x / float(CGraphics::g_ViewportResolution.y);
|
||||
if (aspect < 1.7777f)
|
||||
{
|
||||
float targetHeight = CGraphics::g_ViewportResolution.x / 1.7777f;
|
||||
float delta = (CGraphics::g_ViewportResolution.y - targetHeight) * t / 2.f;
|
||||
delta /= float(CGraphics::g_ViewportResolution.y);
|
||||
zeus::CRectangle rect(0.f, 0.f, 1.f, delta);
|
||||
m_bottom.draw(color, rect);
|
||||
rect.position.y = 1.f - delta;
|
||||
m_top.draw(color, rect);
|
||||
}
|
||||
}
|
||||
|
||||
const zeus::CRectangle CColoredQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
|
||||
|
||||
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "TMultiBlendShader.hpp"
|
||||
#include "zeus/CMatrix4f.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
#include "zeus/CRectangle.hpp"
|
||||
#include "Camera/CCameraFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
|
@ -18,6 +19,7 @@ class CColoredQuadFilter
|
|||
|
||||
struct Uniform
|
||||
{
|
||||
zeus::CMatrix4f m_matrix;
|
||||
zeus::CColor m_color;
|
||||
};
|
||||
boo::GraphicsDataToken m_token;
|
||||
|
@ -27,13 +29,24 @@ class CColoredQuadFilter
|
|||
Uniform m_uniform;
|
||||
|
||||
public:
|
||||
static const zeus::CRectangle DefaultRect;
|
||||
CColoredQuadFilter(CCameraFilterPass::EFilterType type);
|
||||
void draw(const zeus::CColor& color);
|
||||
void draw(const zeus::CColor& color, const zeus::CRectangle& rect=DefaultRect);
|
||||
|
||||
using _CLS = CColoredQuadFilter;
|
||||
#include "TMultiBlendShaderDecl.hpp"
|
||||
};
|
||||
|
||||
class CWideScreenFilter
|
||||
{
|
||||
CColoredQuadFilter m_top;
|
||||
CColoredQuadFilter m_bottom;
|
||||
public:
|
||||
CWideScreenFilter(CCameraFilterPass::EFilterType type)
|
||||
: m_top(type), m_bottom(type) {}
|
||||
void draw(const zeus::CColor& color, float t);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CCOLOREDQUADFILTER_HPP__
|
||||
|
|
|
@ -12,6 +12,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"\n"
|
||||
"UBINDING0 uniform ColoredQuadUniform\n"
|
||||
"{\n"
|
||||
" mat4 xf;\n"
|
||||
" vec4 color;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
|
@ -24,7 +25,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"void main()\n"
|
||||
"{\n"
|
||||
" vtf.color = color;\n"
|
||||
" gl_Position = vec4(posIn.xyz, 1.0);\n"
|
||||
" gl_Position = xf * vec4(posIn.xyz, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
|
|
|
@ -51,7 +51,7 @@ static const char* LightingHLSL =
|
|||
"}\n";
|
||||
|
||||
static const char* MainPostHLSL =
|
||||
"float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
||||
"static float4 MainPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
||||
"{\n"
|
||||
" float fogZ = (-vtf.mvPos.z - fog.start) * fog.rangeScale;\n"
|
||||
" return lerp(fog.color, colorIn, saturate(exp2(-8.0 * fogZ)));\n"
|
||||
|
@ -64,7 +64,7 @@ static const char* ThermalPostHLSL =
|
|||
" float4 mulColor;\n"
|
||||
" float4 addColor;\n"
|
||||
"};\n"
|
||||
"float4 ThermalPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
||||
"static float4 ThermalPostFunc(in VertToFrag vtf, float4 colorIn)\n"
|
||||
"{\n"
|
||||
" return float4(extTex7.Sample(samp, vtf.extTcgs[0]).rrr * mulColor.rgb + addColor.rgb, 1.0);\n"
|
||||
"}\n"
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
#include "CTexturedQuadFilter.hpp"
|
||||
#include "Graphics/CTexture.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, const TToken<CTexture>& tex)
|
||||
: m_tex(tex)
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, boo::ITexture* tex)
|
||||
: m_booTex(tex)
|
||||
{
|
||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
|
@ -26,6 +27,13 @@ CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, co
|
|||
});
|
||||
}
|
||||
|
||||
CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type,
|
||||
TLockedToken<CTexture>& tex)
|
||||
: CTexturedQuadFilter(type, tex->GetBooTexture())
|
||||
{
|
||||
m_tex = tex;
|
||||
}
|
||||
|
||||
void CTexturedQuadFilter::draw(const zeus::CColor& color, float uvScale)
|
||||
{
|
||||
m_uniform.m_color = color;
|
||||
|
|
|
@ -23,6 +23,7 @@ class CTexturedQuadFilter
|
|||
float m_uvScale;
|
||||
};
|
||||
TLockedToken<CTexture> m_tex;
|
||||
boo::ITexture* m_booTex;
|
||||
boo::GraphicsDataToken m_token;
|
||||
boo::IGraphicsBufferS* m_vbo;
|
||||
boo::IGraphicsBufferD* m_uniBuf;
|
||||
|
@ -30,7 +31,8 @@ class CTexturedQuadFilter
|
|||
Uniform m_uniform;
|
||||
|
||||
public:
|
||||
CTexturedQuadFilter(CCameraFilterPass::EFilterType type, const TToken<CTexture>& tex);
|
||||
CTexturedQuadFilter(CCameraFilterPass::EFilterType type, TLockedToken<CTexture>& tex);
|
||||
CTexturedQuadFilter(CCameraFilterPass::EFilterType type, boo::ITexture* tex);
|
||||
void draw(const zeus::CColor& color, float uvScale);
|
||||
|
||||
using _CLS = CTexturedQuadFilter;
|
||||
|
|
|
@ -14,6 +14,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"UBINDING0 uniform TexuredQuadUniform\n"
|
||||
"{\n"
|
||||
" vec4 color;\n"
|
||||
" float uvScale;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct VertToFrag\n"
|
||||
|
@ -26,7 +27,7 @@ BOO_GLSL_BINDING_HEAD
|
|||
"void main()\n"
|
||||
"{\n"
|
||||
" vtf.color = color;\n"
|
||||
" vtf.uv = uvIn.xy;\n"
|
||||
" vtf.uv = uvIn.xy * uvScale;\n"
|
||||
" gl_Position = vec4(posIn.xyz, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
|
@ -65,7 +66,7 @@ struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuad
|
|||
};
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
||||
boo::ITexture* texs[] = {filter.m_booTex};
|
||||
return cctx.newShaderDataBinding(pipeline,
|
||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
||||
1, bufs, stages, nullptr, nullptr, 1, texs);
|
||||
|
@ -83,7 +84,7 @@ struct CTexturedQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CTextured
|
|||
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
||||
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
||||
boo::ITexture* texs[] = {filter.m_booTex};
|
||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||
nullptr, nullptr, nullptr, 1, texs);
|
||||
|
|
|
@ -61,7 +61,7 @@ struct CTexturedQuadFilterD3DDataBindingFactory : TMultiBlendShader<CTexturedQua
|
|||
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
|
||||
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
||||
boo::ITexture* texs[] = {filter.m_booTex};
|
||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||
nullptr, nullptr, nullptr, 1, texs);
|
||||
|
|
|
@ -63,7 +63,7 @@ struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQ
|
|||
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
|
||||
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::ITexture* texs[] = {filter.m_tex->GetBooTexture()};
|
||||
boo::ITexture* texs[] = {filter.m_booTex};
|
||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||
nullptr, nullptr, nullptr, 1, texs);
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
#include "CXRayBlurFilter.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
#include "Graphics/CTexture.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
CXRayBlurFilter::CXRayBlurFilter(TLockedToken<CTexture>& tex)
|
||||
: m_paletteTex(tex), m_booTex(tex->GetPaletteTexture())
|
||||
{
|
||||
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
|
||||
{
|
||||
struct Vert
|
||||
{
|
||||
zeus::CVector2f m_pos;
|
||||
zeus::CVector2f m_uv;
|
||||
} verts[4] =
|
||||
{
|
||||
{{-1.0, -1.0}, {0.0, 0.0}},
|
||||
{{-1.0, 1.0}, {0.0, 1.0}},
|
||||
{{ 1.0, -1.0}, {1.0, 0.0}},
|
||||
{{ 1.0, 1.0}, {1.0, 1.0}},
|
||||
};
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, 32, 4);
|
||||
m_uniBuf = ctx.newDynamicBuffer(boo::BufferUse::Uniform, sizeof(Uniform), 1);
|
||||
m_dataBind = TShader<CXRayBlurFilter>::BuildShaderDataBinding(ctx, *this);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void CXRayBlurFilter::draw(float amount)
|
||||
{
|
||||
SClipScreenRect clipRect = {};
|
||||
clipRect.xc_width = CGraphics::g_ViewportResolution.x;
|
||||
clipRect.x10_height = CGraphics::g_ViewportResolution.y;
|
||||
CGraphics::ResolveSpareTexture(clipRect);
|
||||
|
||||
float blurL = amount * 0.0014f * 0.25f;
|
||||
float blurQ = amount * 0.0000525f * 0.25f;
|
||||
//float blurL = amount * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
||||
//float blurQ = amount * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
||||
|
||||
for (int i=0 ; i<4 ; ++i)
|
||||
{
|
||||
float iflt = i;
|
||||
float uvScale = (1.f - (blurL * iflt + blurQ * iflt * iflt));
|
||||
float uvOffset = uvScale * -0.5f + 0.5f;
|
||||
m_uniform.m_uv[i][0][0] = uvScale;
|
||||
m_uniform.m_uv[i][1][1] = uvScale;
|
||||
m_uniform.m_uv[i][3][0] = uvOffset;
|
||||
m_uniform.m_uv[i][3][1] = uvOffset;
|
||||
}
|
||||
m_uniBuf->load(&m_uniform, sizeof(m_uniform));
|
||||
|
||||
CGraphics::g_BooMainCommandQueue->setShaderDataBinding(m_dataBind);
|
||||
CGraphics::g_BooMainCommandQueue->draw(0, 4);
|
||||
}
|
||||
|
||||
URDE_SPECIALIZE_SHADER(CXRayBlurFilter)
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
#ifndef __URDE_CCAMERABLURFILTER_HPP__
|
||||
#define __URDE_CCAMERABLURFILTER_HPP__
|
||||
|
||||
#include "TShader.hpp"
|
||||
#include "zeus/CMatrix4f.hpp"
|
||||
#include "zeus/CColor.hpp"
|
||||
#include "CToken.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
class CTexture;
|
||||
|
||||
class CXRayBlurFilter
|
||||
{
|
||||
friend struct CXRayBlurFilterGLDataBindingFactory;
|
||||
friend struct CXRayBlurFilterVulkanDataBindingFactory;
|
||||
friend struct CXRayBlurFilterMetalDataBindingFactory;
|
||||
friend struct CXRayBlurFilterD3DDataBindingFactory;
|
||||
|
||||
struct Uniform
|
||||
{
|
||||
zeus::CMatrix4f m_uv[4];
|
||||
};
|
||||
TLockedToken<CTexture> m_paletteTex;
|
||||
boo::ITexture* m_booTex = nullptr;
|
||||
boo::GraphicsDataToken m_token;
|
||||
boo::IGraphicsBufferS* m_vbo;
|
||||
boo::IGraphicsBufferD* m_uniBuf;
|
||||
boo::IShaderDataBinding* m_dataBind = nullptr;
|
||||
Uniform m_uniform;
|
||||
|
||||
public:
|
||||
CXRayBlurFilter(TLockedToken<CTexture>& tex);
|
||||
void draw(float amount);
|
||||
|
||||
using _CLS = CXRayBlurFilter;
|
||||
#include "TShaderDecl.hpp"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // __URDE_CCAMERABLURFILTER_HPP__
|
|
@ -0,0 +1,136 @@
|
|||
#include "CXRayBlurFilter.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
static const char* VS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"layout(location=0) in vec4 posIn;\n"
|
||||
"layout(location=1) in vec4 uvIn;\n"
|
||||
"\n"
|
||||
"UBINDING0 uniform XRayBlurUniform\n"
|
||||
"{\n"
|
||||
" mat4 uv0;\n"
|
||||
" mat4 uv1;\n"
|
||||
" mat4 uv2;\n"
|
||||
" mat4 uv3;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"struct VertToFrag\n"
|
||||
"{\n"
|
||||
" vec2 uv0;\n"
|
||||
" vec2 uv1;\n"
|
||||
" vec2 uv2;\n"
|
||||
" vec2 uv3;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SBINDING(0) out VertToFrag vtf;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vtf.uv0 = (uv0 * vec4(uvIn.xy, 0.0, 1.0)).xy;\n"
|
||||
" vtf.uv1 = (uv1 * vec4(uvIn.xy, 0.0, 1.0)).xy;\n"
|
||||
" vtf.uv2 = (uv2 * vec4(uvIn.xy, 0.0, 1.0)).xy;\n"
|
||||
" vtf.uv3 = (uv3 * vec4(uvIn.xy, 0.0, 1.0)).xy;\n"
|
||||
" gl_Position = vec4(posIn.xyz, 1.0);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
"#version 330\n"
|
||||
BOO_GLSL_BINDING_HEAD
|
||||
"struct VertToFrag\n"
|
||||
"{\n"
|
||||
" vec2 uv0;\n"
|
||||
" vec2 uv1;\n"
|
||||
" vec2 uv2;\n"
|
||||
" vec2 uv3;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SBINDING(0) in VertToFrag vtf;\n"
|
||||
"layout(location=0) out vec4 colorOut;\n"
|
||||
"TBINDING0 uniform sampler2D sceneTex;\n"
|
||||
"TBINDING1 uniform sampler2D paletteTex;\n"
|
||||
"const vec4 kRGBToYPrime = vec4(0.299, 0.587, 0.114, 0.0);\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec4 colorSample = texture(paletteTex, vec2(dot(texture(sceneTex, vtf.uv0), kRGBToYPrime) * 0.98 + 0.01, 0.5)) * 0.25;\n"
|
||||
" colorSample += texture(paletteTex, vec2(dot(texture(sceneTex, vtf.uv1), kRGBToYPrime) * 0.98 + 0.01, 0.5)) * 0.25;\n"
|
||||
" colorSample += texture(paletteTex, vec2(dot(texture(sceneTex, vtf.uv2), kRGBToYPrime) * 0.98 + 0.01, 0.5)) * 0.25;\n"
|
||||
" colorSample += texture(paletteTex, vec2(dot(texture(sceneTex, vtf.uv3), kRGBToYPrime) * 0.98 + 0.01, 0.5)) * 0.25;\n"
|
||||
" colorOut = colorSample;\n"
|
||||
"}\n";
|
||||
|
||||
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
|
||||
|
||||
struct CXRayBlurFilterGLDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
|
||||
{
|
||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline* pipeline,
|
||||
boo::IVertexFormat*,
|
||||
CXRayBlurFilter& filter)
|
||||
{
|
||||
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
|
||||
|
||||
const boo::VertexElementDescriptor VtxVmt[] =
|
||||
{
|
||||
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4},
|
||||
{filter.m_vbo, nullptr, boo::VertexSemantic::UV4}
|
||||
};
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
|
||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
|
||||
return cctx.newShaderDataBinding(pipeline,
|
||||
ctx.newVertexFormat(2, VtxVmt), filter.m_vbo, nullptr, nullptr,
|
||||
1, bufs, stages, nullptr, nullptr, 2, texs);
|
||||
}
|
||||
};
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
struct CXRayBlurFilterVulkanDataBindingFactory : TShader<CXRayBlurFilter>::IDataBindingFactory
|
||||
{
|
||||
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline* pipeline,
|
||||
boo::IVertexFormat* vtxFmt,
|
||||
CXRayBlurFilter& filter)
|
||||
{
|
||||
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
|
||||
|
||||
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
|
||||
boo::ITexture* texs[] = {CGraphics::g_SpareTexture, filter.m_booTex};
|
||||
return cctx.newShaderDataBinding(pipeline, vtxFmt,
|
||||
filter.m_vbo, nullptr, nullptr, 1, bufs,
|
||||
nullptr, nullptr, nullptr, 2, texs);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::GLDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut)
|
||||
{
|
||||
const char* texNames[] = {"sceneTex", "paletteTex"};
|
||||
const char* uniNames[] = {"XRayBlurUniform"};
|
||||
pipeOut = ctx.newShaderPipeline(VS, FS, 2, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||
return new CXRayBlurFilterGLDataBindingFactory;
|
||||
}
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::VulkanDataFactory::Context& ctx,
|
||||
boo::IShaderPipeline*& pipeOut,
|
||||
boo::IVertexFormat*& vtxFmtOut)
|
||||
{
|
||||
const boo::VertexElementDescriptor VtxVmt[] =
|
||||
{
|
||||
{nullptr, nullptr, boo::VertexSemantic::Position4},
|
||||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||
};
|
||||
vtxFmtOut = ctx.newVertexFormat(2, VtxVmt);
|
||||
pipeOut = ctx.newShaderPipeline(VS, FS, vtxFmtOut, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, false, false, false);
|
||||
return new CXRayBlurFilterVulkanDataBindingFactory;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
|
@ -82,9 +82,9 @@ public:
|
|||
CCameraFilterPass::EFilterType type,
|
||||
FilterImp& filter)
|
||||
{
|
||||
if (type == CCameraFilterPass::EFilterType::AdditiveAlpha)
|
||||
if (type == CCameraFilterPass::EFilterType::Add)
|
||||
return m_bindFactory->BuildShaderDataBinding(ctx, m_additiveAlphaPipeline, m_vtxFmt, filter);
|
||||
else if (type == CCameraFilterPass::EFilterType::ColorMultiply)
|
||||
else if (type == CCameraFilterPass::EFilterType::Multiply)
|
||||
return m_bindFactory->BuildShaderDataBinding(ctx, m_colorMultiplyPipeline, m_vtxFmt, filter);
|
||||
else
|
||||
return m_bindFactory->BuildShaderDataBinding(ctx, m_alphaBlendPipeline, m_vtxFmt, filter);
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
#include "Graphics/Shaders/CSpaceWarpFilter.hpp"
|
||||
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
|
||||
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
|
||||
#include "Graphics/Shaders/CXRayBlurFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
URDE_DECL_SPECIALIZE_SHADER(CThermalColdFilter)
|
||||
URDE_DECL_SPECIALIZE_SHADER(CThermalHotFilter)
|
||||
URDE_DECL_SPECIALIZE_SHADER(CSpaceWarpFilter)
|
||||
URDE_DECL_SPECIALIZE_SHADER(CXRayBlurFilter)
|
||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
|
||||
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
|
||||
|
||||
|
@ -35,6 +37,7 @@ CMain::BooSetter::BooSetter(boo::IGraphicsDataFactory* factory,
|
|||
TShader<CThermalColdFilter>::Initialize();
|
||||
TShader<CThermalHotFilter>::Initialize();
|
||||
TShader<CSpaceWarpFilter>::Initialize();
|
||||
TShader<CXRayBlurFilter>::Initialize();
|
||||
TMultiBlendShader<CColoredQuadFilter>::Initialize();
|
||||
TMultiBlendShader<CTexturedQuadFilter>::Initialize();
|
||||
}
|
||||
|
@ -82,6 +85,12 @@ bool CMain::Proc()
|
|||
|
||||
void CMain::Shutdown()
|
||||
{
|
||||
TShader<CThermalColdFilter>::Shutdown();
|
||||
TShader<CThermalHotFilter>::Shutdown();
|
||||
TShader<CSpaceWarpFilter>::Shutdown();
|
||||
TShader<CXRayBlurFilter>::Shutdown();
|
||||
TMultiBlendShader<CColoredQuadFilter>::Shutdown();
|
||||
TMultiBlendShader<CTexturedQuadFilter>::Shutdown();
|
||||
}
|
||||
|
||||
#if MP1_USE_BOO
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
#include "Character/IAnimReader.hpp"
|
||||
#include "Character/CSkinRules.hpp"
|
||||
#include "Graphics/CModel.hpp"
|
||||
#include "Graphics/CBooRenderer.hpp"
|
||||
#include "Camera/CCameraManager.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
int CWorldTransManager::GetSuitCharSet()
|
||||
int CWorldTransManager::GetSuitCharIdx()
|
||||
{
|
||||
CPlayerState& state = *g_GameState->GetPlayerState();
|
||||
if (state.GetFusion())
|
||||
|
@ -77,7 +79,7 @@ void CWorldTransManager::UpdateDisabled(float)
|
|||
{
|
||||
if (x0_curTime <= 2.f)
|
||||
return;
|
||||
x44_24_dissolveComplete = true;
|
||||
x44_24_transFinished = true;
|
||||
}
|
||||
|
||||
void CWorldTransManager::UpdateEnabled(float dt)
|
||||
|
@ -88,12 +90,12 @@ void CWorldTransManager::UpdateEnabled(float dt)
|
|||
{
|
||||
x4_modelData->x1dc_dissolveStarted = true;
|
||||
x4_modelData->x1d0_dissolveStartTime = x0_curTime;
|
||||
x4_modelData->x1d4_relativeDissolveStartTime = 4.f + x0_curTime - 2.f;
|
||||
x4_modelData->x1d8_relativeDissolveEndTime = 5.f + x0_curTime - 2.f;
|
||||
x4_modelData->x1d4_dissolveEndTime = 4.f + x0_curTime - 2.f;
|
||||
x4_modelData->x1d8_transCompleteTime = 5.f + x0_curTime - 2.f;
|
||||
}
|
||||
|
||||
if (x0_curTime > x4_modelData->x1d8_relativeDissolveEndTime && x4_modelData->x1dc_dissolveStarted)
|
||||
x44_24_dissolveComplete = true;
|
||||
if (x0_curTime > x4_modelData->x1d8_transCompleteTime && x4_modelData->x1dc_dissolveStarted)
|
||||
x44_24_transFinished = true;
|
||||
|
||||
x4_modelData->x1c_samusModelData.AdvanceAnimationIgnoreParticles(dt, x20_random, true);
|
||||
x4_modelData->x170_gunXf = x4_modelData->x1c_samusModelData.GetScaledLocatorTransform("GUN_LCTR");
|
||||
|
@ -146,8 +148,63 @@ void CWorldTransManager::Update(float dt)
|
|||
}
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawAllModels()
|
||||
{
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawFirstPass()
|
||||
{
|
||||
zeus::CTransform translateXf =
|
||||
zeus::CTransform::Translate(x4_modelData->x1b4_shakeResult.x,
|
||||
-3.5f * (1.f - zeus::clamp(0.f, x0_curTime / 10.f, 1.f)) - 3.5f,
|
||||
x4_modelData->x1b4_shakeResult.y + 2.f);
|
||||
zeus::CTransform rotateXf =
|
||||
zeus::CTransform::RotateZ(zeus::degToRad(zeus::clamp(0.f, x0_curTime / 25.f, 100.f) *
|
||||
360.f + 180.f - 90.f));
|
||||
CGraphics::SetViewPointMatrix(rotateXf * translateXf);
|
||||
DrawAllModels();
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawSecondPass()
|
||||
{
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawEnabled()
|
||||
{
|
||||
g_Renderer->SetPerspective(CCameraManager::DefaultFirstPersonFOV(),
|
||||
CGraphics::g_ViewportResolution.x /
|
||||
float(CGraphics::g_ViewportResolution.y),
|
||||
CCameraManager::DefaultNearPlane(),
|
||||
CCameraManager::DefaultFarPlane());
|
||||
g_Renderer->x318_26_ = true;
|
||||
|
||||
if (x0_curTime <= x4_modelData->x1d0_dissolveStartTime)
|
||||
DrawFirstPass();
|
||||
else if (x0_curTime >= x4_modelData->x1d4_dissolveEndTime)
|
||||
DrawSecondPass();
|
||||
else
|
||||
{
|
||||
float t = zeus::clamp(0.f, (x0_curTime - x4_modelData->x1d0_dissolveStartTime) / 2.f, 1.f);
|
||||
DrawFirstPass();
|
||||
SClipScreenRect rect = {};
|
||||
rect.xc_width = CGraphics::g_ViewportResolution.x;
|
||||
rect.x10_height = CGraphics::g_ViewportResolution.y;
|
||||
CGraphics::ResolveSpareTexture(rect);
|
||||
DrawSecondPass();
|
||||
m_dissolve.draw(zeus::CColor{1.f, 1.f, 1.f, t}, 1.f);
|
||||
}
|
||||
|
||||
m_widescreen.draw(zeus::CColor::skBlack, 1.f);
|
||||
|
||||
float ftbT = 0.f;
|
||||
if (x0_curTime < 0.25f)
|
||||
ftbT = 1.f - x0_curTime / 0.25f;
|
||||
else if (x0_curTime > x4_modelData->x1d8_transCompleteTime)
|
||||
ftbT = 1.f;
|
||||
else if (x0_curTime > x4_modelData->x1d8_transCompleteTime - 0.25f)
|
||||
ftbT = 1.f - (x4_modelData->x1d8_transCompleteTime - x0_curTime) / 0.25f;
|
||||
if (ftbT > 0.f)
|
||||
m_fadeToBlack.draw(zeus::CColor{0.f, 0.f, 0.f, ftbT});
|
||||
}
|
||||
|
||||
void CWorldTransManager::DrawDisabled()
|
||||
|
@ -187,7 +244,7 @@ void CWorldTransManager::TouchModels()
|
|||
x4_modelData->x164_suitSkin.IsLoaded() &&
|
||||
x4_modelData->x164_suitSkin.GetObj())
|
||||
{
|
||||
CAnimRes animRes(x4_modelData->x0_samusRes.GetId(), GetSuitCharSet(),
|
||||
CAnimRes animRes(x4_modelData->x0_samusRes.GetId(), GetSuitCharIdx(),
|
||||
x4_modelData->x0_samusRes.GetScale(), x4_modelData->x0_samusRes.GetDefaultAnim(),
|
||||
true);
|
||||
x4_modelData->x1c_samusModelData = animRes;
|
||||
|
@ -232,7 +289,7 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes,
|
|||
x4_modelData->x14c_beamModel = g_SimplePool->GetObj(modelName.c_str());
|
||||
|
||||
TToken<CCharacterFactory> fac = g_CharFactoryBuilder->GetFactory(samusRes);
|
||||
const CCharacterInfo& info = fac.GetObj()->GetCharInfo(GetSuitCharSet());
|
||||
const CCharacterInfo& info = fac.GetObj()->GetCharInfo(GetSuitCharIdx());
|
||||
x4_modelData->x158_suitModel = g_SimplePool->GetObj(SObjectTag{FOURCC('CMDL'), info.GetModelId()});
|
||||
x4_modelData->x164_suitSkin = g_SimplePool->GetObj(SObjectTag{FOURCC('CSKR'), info.GetSkinRulesId()});
|
||||
|
||||
|
@ -290,7 +347,7 @@ void CWorldTransManager::StartTransition()
|
|||
{
|
||||
x0_curTime = 0.f;
|
||||
x18_bgOffset = 0.f;
|
||||
x44_24_dissolveComplete = false;
|
||||
x44_24_transFinished = false;
|
||||
x44_28_ = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "GuiSys/CGuiTextSupport.hpp"
|
||||
#include "Graphics/CLight.hpp"
|
||||
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
|
||||
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -42,8 +43,8 @@ public:
|
|||
float x1c8_blurResult = 0.f;
|
||||
float x1cc_blurDelta = 0.f;
|
||||
float x1d0_dissolveStartTime = 99999.f;
|
||||
float x1d4_relativeDissolveStartTime = 99999.f;
|
||||
float x1d8_relativeDissolveEndTime = 99999.f;
|
||||
float x1d4_dissolveEndTime = 99999.f;
|
||||
float x1d8_transCompleteTime = 99999.f;
|
||||
bool x1dc_dissolveStarted = false;
|
||||
|
||||
SModelDatas(const CAnimRes& samusRes);
|
||||
|
@ -69,7 +70,7 @@ private:
|
|||
{
|
||||
struct
|
||||
{
|
||||
bool x44_24_dissolveComplete : 1;
|
||||
bool x44_24_transFinished : 1;
|
||||
bool x44_25_stopSoon : 1;
|
||||
bool x44_26_goingUp : 1;
|
||||
bool x44_27_ : 1;
|
||||
|
@ -78,24 +79,28 @@ private:
|
|||
u8 dummy = 0;
|
||||
};
|
||||
|
||||
CColoredQuadFilter m_fadeToBlack = { CCameraFilterPass::EFilterType::AlphaBlended };
|
||||
CColoredQuadFilter m_fadeToBlack = { CCameraFilterPass::EFilterType::Blend };
|
||||
CTexturedQuadFilter m_dissolve = { CCameraFilterPass::EFilterType::Blend,
|
||||
CGraphics::g_SpareTexture };
|
||||
CWideScreenFilter m_widescreen = { CCameraFilterPass::EFilterType::Blend };
|
||||
|
||||
static int GetSuitCharSet();
|
||||
|
||||
public:
|
||||
CWorldTransManager() : x44_24_dissolveComplete(true) {}
|
||||
|
||||
void DrawFirstPass() const {}
|
||||
void DrawSecondPass() const {}
|
||||
void DrawAllModels() const {}
|
||||
static int GetSuitCharIdx();
|
||||
void DrawFirstPass();
|
||||
void DrawSecondPass();
|
||||
void DrawAllModels();
|
||||
void UpdateLights(float dt);
|
||||
void UpdateEnabled(float);
|
||||
void UpdateDisabled(float);
|
||||
void UpdateText(float);
|
||||
void Update(float);
|
||||
void DrawEnabled();
|
||||
void DrawDisabled();
|
||||
void DrawText();
|
||||
|
||||
public:
|
||||
CWorldTransManager() : x44_24_transFinished(true) {}
|
||||
|
||||
|
||||
void Update(float);
|
||||
void Draw();
|
||||
|
||||
void EnableTransition(const CAnimRes& samusRes,
|
||||
|
@ -106,6 +111,7 @@ public:
|
|||
|
||||
void StartTransition();
|
||||
void EndTransition();
|
||||
bool IsTransitionFinished() const { return x44_24_transFinished; }
|
||||
void PleaseStopSoon() { x44_25_stopSoon = true; }
|
||||
bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; }
|
||||
void DisableTransition();
|
||||
|
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit 4efe7e48480f99f74da4fc8f546a09c7cb529485
|
||||
Subproject commit d8186d24b70a8ca885b4bd3e19e1f5402c076191
|
Loading…
Reference in New Issue