Camera filter refactor

This commit is contained in:
Jack Andersen 2017-05-31 19:34:24 -10:00
parent a550ce1959
commit ca69a54faf
56 changed files with 1201 additions and 260 deletions

View File

@ -161,7 +161,7 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x130_ = __dna_reader.readFloatBig();
/* x134_ */
x134_ = __dna_reader.readFloatBig();
/* x138_ */
/* x138_hudLagAmount */
x138_hudLagAmount = __dna_reader.readFloatBig();
/* x13c_ */
x13c_ = __dna_reader.readFloatBig();
@ -291,33 +291,33 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x1a0_ = __dna_reader.readFloatBig();
/* x1a4_ */
x1a4_ = __dna_reader.readFloatBig();
/* x1a8_[0] */
/* x1a8_orbitScreenBoxHalfExtentX[0] */
x1a8_orbitScreenBoxHalfExtentX[0] = __dna_reader.readUint32Big();
/* x1b0_[0] */
/* x1b0_orbitScreenBoxHalfExtentY[0] */
x1b0_orbitScreenBoxHalfExtentY[0] = __dna_reader.readUint32Big();
/* x1b8_[0] */
/* x1b8_orbitScreenBoxCenterX[0] */
x1b8_orbitScreenBoxCenterX[0] = __dna_reader.readUint32Big();
/* x1c0_[0] */
/* x1c0_orbitScreenBoxCenterY[0] */
x1c0_orbitScreenBoxCenterY[0] = __dna_reader.readUint32Big();
/* x1c8_[0] */
/* x1c8_enemyScreenBoxCenterX[0] */
x1c8_enemyScreenBoxCenterX[0] = __dna_reader.readUint32Big();
/* x1d0_[0] */
/* x1d0_enemyScreenBoxCenterY[0] */
x1d0_enemyScreenBoxCenterY[0] = __dna_reader.readUint32Big();
/* x1a8_[1] */
/* x1a8_orbitScreenBoxHalfExtentX[1] */
x1a8_orbitScreenBoxHalfExtentX[1] = __dna_reader.readUint32Big();
/* x1b0_[1] */
/* x1b0_orbitScreenBoxHalfExtentY[1] */
x1b0_orbitScreenBoxHalfExtentY[1] = __dna_reader.readUint32Big();
/* x1b8_[1] */
/* x1b8_orbitScreenBoxCenterX[1] */
x1b8_orbitScreenBoxCenterX[1] = __dna_reader.readUint32Big();
/* x1c0_[1] */
/* x1c0_orbitScreenBoxCenterY[1] */
x1c0_orbitScreenBoxCenterY[1] = __dna_reader.readUint32Big();
/* x1c8_[1] */
/* x1c8_enemyScreenBoxCenterX[1] */
x1c8_enemyScreenBoxCenterX[1] = __dna_reader.readUint32Big();
/* x1d0_[1] */
/* x1d0_enemyScreenBoxCenterY[1] */
x1d0_enemyScreenBoxCenterY[1] = __dna_reader.readUint32Big();
/* x1d8_ */
/* x1d8_orbitNearX */
x1d8_orbitNearX = __dna_reader.readFloatBig();
/* x1dc_ */
/* x1dc_orbitNearZ */
x1dc_orbitNearZ = __dna_reader.readFloatBig();
/* x1e0_ */
x1e0_ = __dna_reader.readFloatBig();
@ -349,17 +349,17 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x210_ = __dna_reader.readFloatBig();
/* x214_ */
x214_ = __dna_reader.readFloatBig();
/* x218_ */
/* x218_scanningRange */
x218_scanningRange = __dna_reader.readFloatBig();
/* x21c_24_ */
x21c_24_ = __dna_reader.readBool();
/* x21c_25_ */
/* x21c_25_scanFreezesGame */
x21c_25_scanFreezesGame = __dna_reader.readBool();
/* x21c_26_ */
x21c_26_ = __dna_reader.readBool();
/* x220_ */
x220_ = __dna_reader.readFloatBig();
/* x224_ */
/* x224_scanningFrameSenseRange */
x224_scanningFrameSenseRange = __dna_reader.readFloatBig();
/* x2a0_ */
x2a0_ = __dna_reader.readFloatBig();
@ -437,11 +437,11 @@ void CTweakPlayer::read(athena::io::IStreamReader& __dna_reader)
x2f8_ = __dna_reader.readFloatBig();
/* x2fc_ */
x2fc_ = __dna_reader.readUint32Big();
/* x300_ */
/* x300_variaDamageReduction */
x300_variaDamageReduction = __dna_reader.readFloatBig();
/* x304_ */
/* x304_gravityDamageReduction */
x304_gravityDamageReduction = __dna_reader.readFloatBig();
/* x308_ */
/* x308_phazonDamageReduction */
x308_phazonDamageReduction = __dna_reader.readFloatBig();
}
@ -731,33 +731,33 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x1a0_);
/* x1a4_ */
__dna_writer.writeFloatBig(x1a4_);
/* x1a8_[0] */
/* x1a8_orbitScreenBoxHalfExtentX[0] */
__dna_writer.writeUint32Big(x1a8_orbitScreenBoxHalfExtentX[0]);
/* x1b0_[0] */
/* x1b0_orbitScreenBoxHalfExtentY[0] */
__dna_writer.writeUint32Big(x1b0_orbitScreenBoxHalfExtentY[0]);
/* x1b8_[0] */
/* x1b8_orbitScreenBoxCenterX[0] */
__dna_writer.writeUint32Big(x1b8_orbitScreenBoxCenterX[0]);
/* x1c0_[0] */
/* x1c0_orbitScreenBoxCenterY[0] */
__dna_writer.writeUint32Big(x1c0_orbitScreenBoxCenterY[0]);
/* x1c8_[0] */
/* x1c8_enemyScreenBoxCenterX[0] */
__dna_writer.writeUint32Big(x1c8_enemyScreenBoxCenterX[0]);
/* x1d0_[0] */
/* x1d0_enemyScreenBoxCenterY[0] */
__dna_writer.writeUint32Big(x1d0_enemyScreenBoxCenterY[0]);
/* x1a8_[1] */
/* x1a8_orbitScreenBoxHalfExtentX[1] */
__dna_writer.writeUint32Big(x1a8_orbitScreenBoxHalfExtentX[1]);
/* x1b0_[1] */
/* x1b0_orbitScreenBoxHalfExtentY[1] */
__dna_writer.writeUint32Big(x1b0_orbitScreenBoxHalfExtentY[1]);
/* x1b8_[1] */
/* x1b8_orbitScreenBoxCenterX[1] */
__dna_writer.writeUint32Big(x1b8_orbitScreenBoxCenterX[1]);
/* x1c0_[1] */
/* x1c0_orbitScreenBoxCenterY[1] */
__dna_writer.writeUint32Big(x1c0_orbitScreenBoxCenterY[1]);
/* x1c8_[1] */
/* x1c8_enemyScreenBoxCenterX[1] */
__dna_writer.writeUint32Big(x1c8_enemyScreenBoxCenterX[1]);
/* x1d0_[1] */
/* x1d0_enemyScreenBoxCenterY[1] */
__dna_writer.writeUint32Big(x1d0_enemyScreenBoxCenterY[1]);
/* x1d8_ */
/* x1d8_orbitNearX */
__dna_writer.writeFloatBig(x1d8_orbitNearX);
/* x1dc_ */
/* x1dc_orbitNearZ */
__dna_writer.writeFloatBig(x1dc_orbitNearZ);
/* x1e0_ */
__dna_writer.writeFloatBig(x1e0_);
@ -789,17 +789,17 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x210_);
/* x214_ */
__dna_writer.writeFloatBig(x214_);
/* x218_ */
/* x218_scanningRange */
__dna_writer.writeFloatBig(x218_scanningRange);
/* x21c_24_ */
__dna_writer.writeBool(x21c_24_);
/* x21c_25_ */
/* x21c_25_scanFreezesGame */
__dna_writer.writeBool(x21c_25_scanFreezesGame);
/* x21c_26_ */
__dna_writer.writeBool(x21c_26_);
/* x220_ */
__dna_writer.writeFloatBig(x220_);
/* x224_ */
/* x224_scanningFrameSenseRange */
__dna_writer.writeFloatBig(x224_scanningFrameSenseRange);
/* x2a0_ */
__dna_writer.writeFloatBig(x2a0_);
@ -877,11 +877,11 @@ void CTweakPlayer::write(athena::io::IStreamWriter& __dna_writer) const
__dna_writer.writeFloatBig(x2f8_);
/* x2fc_ */
__dna_writer.writeUint32Big(x2fc_);
/* x300_ */
/* x300_variaDamageReduction */
__dna_writer.writeFloatBig(x300_variaDamageReduction);
/* x304_ */
/* x304_gravityDamageReduction */
__dna_writer.writeFloatBig(x304_gravityDamageReduction);
/* x308_ */
/* x308_phazonDamageReduction */
__dna_writer.writeFloatBig(x308_phazonDamageReduction);
}

View File

@ -10,6 +10,7 @@
#include "DNACommon/TXTR.hpp"
#include <time.h>
#include <png.h>
namespace DataSpec
{
@ -402,4 +403,70 @@ void SpecBase::doPackage(const PackagePassInfo& info)
{
}
static void PNGErr(png_structp png, png_const_charp msg)
{
Log.report(logvisor::Error, msg);
}
static void PNGWarn(png_structp png, png_const_charp msg)
{
Log.report(logvisor::Warning, msg);
}
static inline uint8_t Convert4To8(uint8_t v)
{
/* Swizzle bits: 00001234 -> 12341234 */
return (v << 4) | v;
}
void SpecBase::ExtractRandomStaticEntropy(const uint8_t* buf, const hecl::ProjectPath& noAramPath)
{
hecl::ProjectPath entropyPath(noAramPath, _S("RandomStaticEntropy.png"));
hecl::ProjectPath catalogPath(noAramPath, _S("!catalog.yaml"));
if (FILE* fp = hecl::Fopen(catalogPath.getAbsolutePath().c_str(), _S("a")))
{
fprintf(fp, "RandomStaticEntropy: %s\n", entropyPath.getRelativePathUTF8().c_str());
fclose(fp);
}
FILE* fp = hecl::Fopen(entropyPath.getAbsolutePath().c_str(), _S("wb"));
if (!fp)
{
Log.report(logvisor::Error,
_S("Unable to open '%s' for writing"),
entropyPath.getAbsolutePath().c_str());
return;
}
png_structp png = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, PNGErr, PNGWarn);
png_init_io(png, fp);
png_infop info = png_create_info_struct(png);
png_text textStruct = {};
textStruct.key = png_charp("urde_nomip");
png_set_text(png, info, &textStruct, 1);
png_set_IHDR(png, info, 1024, 512, 8,
PNG_COLOR_TYPE_GRAY_ALPHA, PNG_INTERLACE_NONE,
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_write_info(png, info);
std::unique_ptr<uint8_t[]> rowbuf(new uint8_t[1024*2]);
for (int y=0 ; y<512 ; ++y)
{
for (int x=0 ; x<1024 ; ++x)
{
uint8_t texel = buf[y*1024+x];
rowbuf[x*2] = Convert4To8(texel >> 4 & 0xf);
rowbuf[x*2+1] = Convert4To8(texel & 0xf);
}
png_write_row(png, rowbuf.get());
}
png_write_end(png, info);
png_write_flush(png);
png_destroy_write_struct(&png, &info);
fclose(fp);
}
}

View File

@ -113,6 +113,9 @@ struct SpecBase : hecl::Database::IDataSpec
/* Project accessor */
hecl::Database::Project& getProject() const {return m_project;}
/* Extract RandomStatic entropy */
void ExtractRandomStaticEntropy(const uint8_t* buf, const hecl::ProjectPath& noAramPath);
SpecBase(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc);
protected:
hecl::Database::Project& m_project;

View File

@ -169,6 +169,8 @@ struct SpecMP1 : SpecBase
hecl::ProjectPath m_cookPath;
PAKRouter<DNAMP1::PAKBridge> m_pakRouter;
std::unique_ptr<uint8_t[]> m_dolBuf;
SpecMP1(const hecl::Database::DataSpecEntry* specEntry, hecl::Database::Project& project, bool pc)
: SpecBase(specEntry, project, pc)
, m_workPath(project.getProjectWorkingPath(), _S("MP1"))
@ -257,8 +259,8 @@ struct SpecMP1 : SpecBase
const std::vector<hecl::SystemString>& args, std::vector<ExtractReport>& reps)
{
nod::Partition* partition = disc.getDataPartition();
std::unique_ptr<uint8_t[]> dolBuf = partition->getDOLBuf();
const char* buildInfo = (char*)memmem(dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
m_dolBuf = partition->getDOLBuf();
const char* buildInfo = (char*)memmem(m_dolBuf.get(), partition->getDOLSize(), "MetroidBuildInfo", 16) + 19;
if (!buildInfo)
return false;
@ -318,8 +320,8 @@ struct SpecMP1 : SpecBase
if (dolIt == root.end())
return false;
std::unique_ptr<uint8_t[]> dolBuf = dolIt->getBuf();
const char* buildInfo = (char*)memmem(dolBuf.get(), dolIt->size(), "MetroidBuildInfo", 16) + 19;
m_dolBuf = dolIt->getBuf();
const char* buildInfo = (char*)memmem(m_dolBuf.get(), dolIt->size(), "MetroidBuildInfo", 16) + 19;
/* Root Report */
reps.emplace_back();
@ -342,7 +344,7 @@ struct SpecMP1 : SpecBase
return true;
}
bool extractFromDisc(nod::DiscBase&, bool force, FProgress progress)
bool extractFromDisc(nod::DiscBase& disc, bool force, FProgress progress)
{
m_project.enableDataSpecs({_S("MP1-PC")});
@ -419,6 +421,10 @@ struct SpecMP1 : SpecBase
process.waitUntilComplete();
/* Extract part of .dol for RandomStatic entropy */
hecl::ProjectPath noAramPath(m_project.getProjectWorkingPath(), _S("MP1/NoARAM"));
ExtractRandomStaticEntropy(m_dolBuf.get() + 0x4f60, noAramPath);
return true;
}

View File

@ -54,7 +54,7 @@ class ViewManager : public specter::IViewManager
{
ViewManager& m_vm;
CSpaceWarpFilter m_spaceWarpFilter;
CWideScreenFilter m_widescreen = { CCameraFilterPass::EFilterType::Blend };
CWideScreenFilter m_widescreen = { EFilterType::Blend };
CXRayBlurFilter m_xrayBlur;
CCameraBlurFilter m_camBlur;
CRandom16 m_random;

View File

@ -1568,7 +1568,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
{
hintBeaconFilters.reserve(x1f8_hintLocations.size());
for (int i=hintBeaconFilters.size() ; i<x1f8_hintLocations.size() ; ++i)
hintBeaconFilters.emplace_back(CCameraFilterPass::EFilterType::Add, x3c_hintBeacon);
hintBeaconFilters.emplace_back(EFilterType::Add, x3c_hintBeacon);
}
auto locIt = x1f8_hintLocations.cbegin();
auto filterIt = hintBeaconFilters.begin();

View File

@ -205,7 +205,7 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo,
TLockedToken<CTexture> tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), iconRes});
if (!m_texQuadFilter || m_texQuadFilter->GetTex().GetObj() != tex.GetObj())
const_cast<CMappableObject*>(this)->m_texQuadFilter.emplace(CCameraFilterPass::EFilterType::Blend, tex);
const_cast<CMappableObject*>(this)->m_texQuadFilter.emplace(EFilterType::Blend, tex);
CTexturedQuadFilter::Vert verts[4] =
{

View File

@ -536,7 +536,7 @@ void CStateManager::DrawDebugStuff() const {}
void CStateManager::RenderCamerasAndAreaLights() const
{
x870_cameraManager->RenderCameras(*this);
for (const CCameraFilterPass& filter : xb84_camFilterPasses)
for (const CCameraFilterPassPoly& filter : xb84_camFilterPasses)
filter.Draw();
}
@ -551,16 +551,14 @@ void CStateManager::DrawE3DeathEffect() const
if (blurAmt > 0.f)
{
CCameraBlurPass blur;
blur.SetBlur(CCameraBlurPass::EBlurType::HiBlur, 7.f * blurAmt, 0.f);
blur.SetBlur(EBlurType::HiBlur, 7.f * blurAmt, 0.f);
blur.Draw();
}
}
float whiteAmt = zeus::clamp(0.f, 1.f - player.x9f4_deathTime / (0.05f * 6.f), 1.f);
zeus::CColor color = zeus::CColor::skWhite;
color.a = whiteAmt;
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Add,
CCameraFilterPass::EFilterShape::Fullscreen,
color, nullptr, 1.f);
const_cast<CColoredQuadFilter&>(m_deathWhiteout).draw(color);
}
}
@ -571,9 +569,7 @@ void CStateManager::DrawAdditionalFilters() const
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = 1.f - xf0c_escapeTimer;
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Add,
CCameraFilterPass::EFilterShape::Fullscreen,
color, nullptr, 1.f);
const_cast<CColoredQuadFilter&>(m_escapeWhiteout).draw(color);
}
}

View File

@ -21,6 +21,7 @@
#include "World/CActorModelParticles.hpp"
#include "Input/CRumbleManager.hpp"
#include "Camera/CCameraShakeData.hpp"
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
namespace urde
{
@ -176,7 +177,7 @@ private:
std::set<std::string> xb40_uniqueInstanceNames;
CFinalInput xb54_finalInput;
CCameraFilterPass xb84_camFilterPasses[9];
CCameraFilterPassPoly xb84_camFilterPasses[9];
CCameraBlurPass xd14_camBlurPasses[9];
s32 xe60_ = -1;
@ -251,6 +252,9 @@ private:
u32 xf94_ = 0;
};
CColoredQuadFilter m_deathWhiteout = { EFilterType::Add };
CColoredQuadFilter m_escapeWhiteout = { EFilterType::Add };
void UpdateThermalVisor();
static void RendererDrawCallback(const void*, const void*, int);
@ -412,7 +416,7 @@ public:
void SetActiveRandomToDefault() { x900_activeRandom = &x8fc_random; }
void ClearActiveRandom() { x900_activeRandom = nullptr; }
CRumbleManager& GetRumbleManager() {return *x88c_rumbleManager;}
CCameraFilterPass& GetCameraFilterPass(int idx) {return xb84_camFilterPasses[idx];}
CCameraFilterPassPoly& GetCameraFilterPass(int idx) {return xb84_camFilterPasses[idx];}
CEnvFxManager* GetEnvFxManager() { return x880_envFxManager; }
CWorld* WorldNC() {return x850_world.get();}

View File

@ -3,37 +3,173 @@
#include "GameGlobalObjects.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "CSimplePool.hpp"
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Graphics/Shaders/CScanLinesFilter.hpp"
#include "Graphics/Shaders/CRandomStaticFilter.hpp"
namespace urde
{
void CCameraFilterPass::Update(float dt)
template <class S>
void CCameraFilterPass<S>::Update(float dt)
{
if (x10_remTime <= 0.f)
return;
EFilterType origType = x0_curType;
x10_remTime = std::max(0.f, x10_remTime - dt);
x18_curColor = zeus::CColor::lerp(x1c_nextColor, x14_prevColor, x10_remTime / xc_duration);
if (x10_remTime == 0.f)
{
x0_curType = x4_nextType;
if (x0_curType == EFilterType::Passthru)
{
x24_texObj = TLockedToken<CTexture>();
x20_nextTxtr = -1;
}
}
void CCameraFilterPass::DrawFilter(EFilterType type, EFilterShape shape, const zeus::CColor& color,
const CTexture* tex, float uvScale)
{
switch (type)
{
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);
if (x0_curType == EFilterType::Passthru)
m_shader = std::experimental::nullopt;
else if (x0_curType != origType)
m_shader.emplace(x0_curType, x24_texObj);
}
void CCameraFilterPass::DrawFilterShape(EFilterShape shape, const zeus::CColor& color,
const CTexture* tex, float uvScale)
template <class S>
void CCameraFilterPass<S>::SetFilter(EFilterType type, EFilterShape shape,
float time, const zeus::CColor& color, ResId txtr)
{
if (time == 0.f)
{
xc_duration = 0.f;
x10_remTime = 0.f;
if (txtr != -1)
x24_texObj = g_SimplePool->GetObj({FOURCC('TXTR'), txtr});
if (type == EFilterType::Passthru)
m_shader = std::experimental::nullopt;
else if (x0_curType != type || (x20_nextTxtr != txtr && txtr != -1))
m_shader.emplace(type, x24_texObj);
x4_nextType = type;
x0_curType = type;
x8_shape = shape;
x1c_nextColor = color;
x18_curColor = color;
x14_prevColor = color;
x20_nextTxtr = txtr;
}
else
{
EFilterType origType = x0_curType;
ResId origTxtr = x20_nextTxtr;
x1c_nextColor = color;
x14_prevColor = x18_curColor;
x8_shape = shape;
x20_nextTxtr = txtr;
if (txtr != -1)
x24_texObj = g_SimplePool->GetObj({FOURCC('TXTR'), txtr});
x10_remTime = time;
xc_duration = time;
x0_curType = x4_nextType;
x4_nextType = type;
if (type == EFilterType::Passthru)
{
if (x0_curType == EFilterType::Multiply)
x1c_nextColor = zeus::CColor::skWhite;
else if (x0_curType == EFilterType::Add || x0_curType == EFilterType::Blend)
x1c_nextColor.a = 0.f;
}
else
{
if (x0_curType == EFilterType::Passthru)
{
if (type == EFilterType::Multiply)
{
x18_curColor = zeus::CColor::skWhite;
}
else if (type == EFilterType::Add || type == EFilterType::Blend)
{
x18_curColor = x1c_nextColor;
x18_curColor.a = 0.f;
x14_prevColor = x18_curColor;
}
}
x0_curType = x4_nextType;
}
if (x0_curType == EFilterType::Passthru)
m_shader = std::experimental::nullopt;
else if (x0_curType != origType || (x20_nextTxtr != origTxtr && x20_nextTxtr != -1))
m_shader.emplace(x0_curType, x24_texObj);
}
}
template <class S>
void CCameraFilterPass<S>::DisableFilter(float time)
{
SetFilter(EFilterType::Passthru, x8_shape, time, zeus::CColor::skWhite, -1);
}
template <class S>
void CCameraFilterPass<S>::Draw() const
{
if (m_shader)
const_cast<S&>(*m_shader).DrawFilter(x8_shape, x18_curColor,
GetT(x4_nextType == EFilterType::Passthru));
}
float CCameraFilterPassBase::GetT(bool invert) const
{
float tmp;
if (xc_duration == 0.f)
tmp = 1.f;
else
tmp = 1.f - x10_remTime / xc_duration;
if (invert)
return 1.f - tmp;
return tmp;
}
void CCameraFilterPassPoly::SetFilter(EFilterType type, EFilterShape shape,
float time, const zeus::CColor& color, ResId txtr)
{
if (!m_filter || m_shape != shape)
{
m_shape = shape;
switch (shape)
{
case EFilterShape::Fullscreen:
case EFilterShape::FullscreenHalvesLeftRight:
case EFilterShape::FullscreenHalvesTopBottom:
case EFilterShape::FullscreenQuarters:
if (txtr != -1)
m_filter = std::make_unique<CCameraFilterPass<CTexturedQuadFilterAlpha>>();
else
m_filter = std::make_unique<CCameraFilterPass<CColoredQuadFilter>>();
break;
case EFilterShape::CinemaBars:
m_filter = std::make_unique<CCameraFilterPass<CWideScreenFilter>>();
break;
case EFilterShape::ScanLinesEven:
case EFilterShape::ScanLinesOdd:
m_filter = std::make_unique<CCameraFilterPass<CScanLinesFilter>>();
break;
case EFilterShape::RandomStatic:
m_filter = std::make_unique<CCameraFilterPass<CRandomStaticFilter>>();
break;
case EFilterShape::CookieCutterDepthRandomStatic:
m_filter = std::make_unique<CCameraFilterPass<CCookieCutterDepthRandomStaticFilter>>();
break;
default: break;
}
}
if (m_filter)
m_filter->SetFilter(type, shape, time, color, txtr);
}
void CCameraBlurPass::Draw()

View File

@ -9,9 +9,6 @@ namespace urde
{
class CTexture;
class CCameraFilterPass
{
public:
enum class EFilterType
{
Passthru,
@ -24,6 +21,7 @@ public:
SceneAdd,
NoColor
};
enum class EFilterShape
{
Fullscreen,
@ -36,19 +34,53 @@ public:
RandomStatic,
CookieCutterDepthRandomStatic
};
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);
void Update(float dt);
void SetFilter(EFilterType type, EFilterShape shape, float, const zeus::CColor& color, u32) {}
void DisableFilter(float) {}
void Draw() const {}
class CCameraFilterPassBase
{
protected:
EFilterType x0_curType = EFilterType::Passthru;
EFilterType x4_nextType = EFilterType::Passthru;
EFilterShape x8_shape = EFilterShape::Fullscreen;
float xc_duration = 0.f;
float x10_remTime = 0.f;
zeus::CColor x14_prevColor;
zeus::CColor x18_curColor;
zeus::CColor x1c_nextColor;
ResId x20_nextTxtr = -1;
TLockedToken<CTexture> x24_texObj; // Used to be auto_ptr
float GetT(bool invert) const;
public:
virtual void Update(float dt)=0;
virtual void SetFilter(EFilterType type, EFilterShape shape,
float time, const zeus::CColor& color, ResId txtr)=0;
virtual void DisableFilter(float time)=0;
virtual void Draw() const=0;
};
class CCameraBlurPass
template <class S>
class CCameraFilterPass final : public CCameraFilterPassBase
{
std::experimental::optional<S> m_shader;
public:
void Update(float dt);
void SetFilter(EFilterType type, EFilterShape shape,
float time, const zeus::CColor& color, ResId txtr);
void DisableFilter(float time);
void Draw() const;
};
class CCameraFilterPassPoly
{
EFilterShape m_shape;
std::unique_ptr<CCameraFilterPassBase> m_filter;
public:
void Update(float dt) { if (m_filter) m_filter->Update(dt); }
void SetFilter(EFilterType type, EFilterShape shape,
float time, const zeus::CColor& color, ResId txtr);
void DisableFilter(float time) { if (m_filter) m_filter->DisableFilter(time); }
void Draw() const { if (m_filter) m_filter->Draw(); }
};
enum class EBlurType
{
NoBlur,
@ -56,7 +88,9 @@ public:
HiBlur,
Xray
};
private:
class CCameraBlurPass
{
TLockedToken<CTexture> x0_paletteTex;
EBlurType x10_curType = EBlurType::NoBlur;
EBlurType x14_endType = EBlurType::NoBlur;

View File

@ -144,7 +144,7 @@ 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::Multiply,
stateMgr.GetCameraFilterPass(4).SetFilter(EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen, 0.f, tmpColor, -1);
}
xa0_26_inWater = true;

View File

@ -948,18 +948,19 @@ void CBooRenderer::SetPerspective(float fovy, float aspect, float znear, float z
CGraphics::SetPerspective(fovy, aspect, znear, zfar);
}
zeus::CRectangle CBooRenderer::SetViewportOrtho(bool centered, float znear, float zfar)
std::pair<zeus::CVector2f, zeus::CVector2f>
CBooRenderer::SetViewportOrtho(bool centered, float znear, float zfar)
{
float left = centered ? g_Viewport.x10_halfWidth : 0;
float bottom = centered ? g_Viewport.x14_halfHeight : 0;
float top = centered ? g_Viewport.x14_halfHeight : g_Viewport.xc_height;
float right = centered ? g_Viewport.x10_halfWidth : g_Viewport.x8_width;
float left = centered ? g_Viewport.x0_left - g_Viewport.x10_halfWidth : 0.f;
float bottom = centered ? g_Viewport.x4_top - g_Viewport.x14_halfHeight : 0.f;
float top = centered ? g_Viewport.x0_left + g_Viewport.x14_halfHeight : g_Viewport.xc_height;
float right = centered ? g_Viewport.x4_top + g_Viewport.x10_halfWidth : g_Viewport.x8_width;
CGraphics::SetOrtho(left, right, top, bottom, znear, zfar);
CGraphics::SetViewPointMatrix(zeus::CTransform::Identity());
CGraphics::SetModelMatrix(zeus::CTransform::Identity());
return zeus::CRectangle(left, bottom, right, top);
return {{left, bottom}, {right, top}};
}
void CBooRenderer::SetClippingPlanes(const zeus::CFrustum& frustum)

View File

@ -216,7 +216,7 @@ public:
void SetWorldViewpoint(const zeus::CTransform&);
void SetPerspective(float, float, float, float, float);
void SetPerspective(float, float, float, float);
zeus::CRectangle SetViewportOrtho(bool, float, float);
std::pair<zeus::CVector2f, zeus::CVector2f> SetViewportOrtho(bool, float, float);
void SetClippingPlanes(const zeus::CFrustum& frustum);
void SetViewport(int, int, int, int);
//void SetDepthReadWrite(bool, bool);

View File

@ -15,7 +15,9 @@ if(WIN32)
Shaders/CEnergyBarShaderHLSL.cpp
Shaders/CRadarPaintShaderHLSL.cpp
Shaders/CMapSurfaceShaderHLSL.cpp
Shaders/CPhazonSuitFilterHLSL.cpp)
Shaders/CPhazonSuitFilterHLSL.cpp
Shaders/CScanLinesFilterHLSL.cpp
Shaders/CRandomStaticFilterHLSL.cpp)
elseif(BOO_HAS_METAL)
set(PLAT_SRCS
Shaders/CLineRendererShadersMetal.cpp
@ -33,7 +35,9 @@ elseif(BOO_HAS_METAL)
Shaders/CEnergyBarShaderMetal.cpp
Shaders/CRadarPaintShaderMetal.cpp
Shaders/CMapSurfaceShaderMetal.cpp
Shaders/CPhazonSuitFilterMetal.cpp)
Shaders/CPhazonSuitFilterMetal.cpp
Shaders/CScanLinesFilterMetal.cpp
Shaders/CRandomStaticFilterMetal.cpp)
endif()
set(GRAPHICS_SOURCES
@ -73,6 +77,8 @@ set(GRAPHICS_SOURCES
Shaders/CRadarPaintShader.hpp Shaders/CRadarPaintShader.cpp Shaders/CRadarPaintShaderGLSL.cpp
Shaders/CMapSurfaceShader.hpp Shaders/CMapSurfaceShader.cpp Shaders/CMapSurfaceShaderGLSL.cpp
Shaders/CPhazonSuitFilter.hpp Shaders/CPhazonSuitFilter.cpp Shaders/CPhazonSuitFilterGLSL.cpp
Shaders/CScanLinesFilter.hpp Shaders/CScanLinesFilter.cpp Shaders/CScanLinesFilterGLSL.cpp
Shaders/CRandomStaticFilter.hpp Shaders/CRandomStaticFilter.cpp Shaders/CRandomStaticFilterGLSL.cpp
${PLAT_SRCS})
runtime_add_list(Graphics GRAPHICS_SOURCES)

View File

@ -61,7 +61,7 @@ public:
virtual void SetWorldViewpoint(const zeus::CTransform&)=0;
virtual void SetPerspective(float, float, float, float, float)=0;
virtual void SetPerspective(float, float, float, float)=0;
virtual zeus::CRectangle SetViewportOrtho(bool, float, float)=0;
virtual std::pair<zeus::CVector2f, zeus::CVector2f> SetViewportOrtho(bool, float, float)=0;
virtual void SetClippingPlanes(const zeus::CFrustum&)=0;
virtual void SetViewport(int, int, int, int)=0;
//virtual void SetDepthReadWrite(bool, bool)=0;

View File

@ -3,7 +3,7 @@
namespace urde
{
CColoredQuadFilter::CColoredQuadFilter(CCameraFilterPass::EFilterType type)
CColoredQuadFilter::CColoredQuadFilter(EFilterType type)
{
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
@ -37,6 +37,11 @@ void CColoredQuadFilter::draw(const zeus::CColor& color, const zeus::CRectangle&
CGraphics::g_BooMainCommandQueue->draw(0, 4);
}
void CColoredQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t)
{
}
void CWideScreenFilter::draw(const zeus::CColor& color, float t)
{
float aspect = g_Viewport.x8_width / float(g_Viewport.xc_height);
@ -52,6 +57,11 @@ void CWideScreenFilter::draw(const zeus::CColor& color, float t)
}
}
void CWideScreenFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t)
{
}
float CWideScreenFilter::SetViewportToMatch(float t)
{
float aspect = g_Viewport.x8_width / float(g_Viewport.xc_height);

View File

@ -30,8 +30,11 @@ class CColoredQuadFilter
public:
static const zeus::CRectangle DefaultRect;
CColoredQuadFilter(CCameraFilterPass::EFilterType type);
CColoredQuadFilter(EFilterType type);
CColoredQuadFilter(EFilterType type, const TLockedToken<CTexture>&)
: CColoredQuadFilter(type) {}
void draw(const zeus::CColor& color, const zeus::CRectangle& rect=DefaultRect);
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
using _CLS = CColoredQuadFilter;
#include "TMultiBlendShaderDecl.hpp"
@ -42,9 +45,13 @@ class CWideScreenFilter
CColoredQuadFilter m_top;
CColoredQuadFilter m_bottom;
public:
CWideScreenFilter(CCameraFilterPass::EFilterType type)
CWideScreenFilter(EFilterType type)
: m_top(type), m_bottom(type) {}
CWideScreenFilter(EFilterType type, const TLockedToken<CTexture>&)
: CWideScreenFilter(type) {}
void draw(const zeus::CColor& color, float t);
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
static float SetViewportToMatch(float t);
static void SetViewportToFull();
};

View File

@ -50,15 +50,15 @@ static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
@ -68,7 +68,7 @@ static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CColoredQuadFilter& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
@ -89,7 +89,7 @@ struct CColoredQuadFilterGLDataBindingFactory : TMultiBlendShader<CColoredQuadFi
struct CColoredQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CColoredQuadFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);

View File

@ -50,15 +50,15 @@ static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
@ -68,7 +68,7 @@ static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
struct CColoredQuadFilterD3DDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CColoredQuadFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);

View File

@ -54,15 +54,15 @@ static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
@ -72,7 +72,7 @@ static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
struct CColoredQuadFilterMetalDataBindingFactory : TMultiBlendShader<CColoredQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CColoredQuadFilter& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);

View File

@ -0,0 +1,39 @@
#include "CRandomStaticFilter.hpp"
#include "Graphics/CBooRenderer.hpp"
#include "GameGlobalObjects.hpp"
namespace urde
{
CRandomStaticFilter::CRandomStaticFilter(EFilterType type, bool cookieCutter)
: m_cookieCutter(cookieCutter)
{
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
struct Vert
{
zeus::CVector2f m_pos;
} verts[4] =
{
{{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);
m_dataBind = TMultiBlendShader<CRandomStaticFilter>::BuildShaderDataBinding(ctx, type, *this);
return true;
});
}
void CRandomStaticFilter::draw(const zeus::CColor& color, float t)
{
std::pair<zeus::CVector2f, zeus::CVector2f> rect = g_Renderer->SetViewportOrtho(true, 0.f, 1.f);
}
void CRandomStaticFilter::Shutdown() {}
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
}

View File

@ -0,0 +1,54 @@
#ifndef __URDE_CRANDOMSTATICFILTER_HPP__
#define __URDE_CRANDOMSTATICFILTER_HPP__
#include "TMultiBlendShader.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CRectangle.hpp"
#include "Camera/CCameraFilter.hpp"
namespace urde
{
class CRandomStaticFilter
{
friend struct CRandomStaticFilterGLDataBindingFactory;
friend struct CRandomStaticFilterVulkanDataBindingFactory;
friend struct CRandomStaticFilterMetalDataBindingFactory;
friend struct CRandomStaticFilterD3DDataBindingFactory;
struct Uniform
{
zeus::CMatrix4f m_matrix;
zeus::CColor m_color;
};
boo::GraphicsDataToken m_token;
boo::IGraphicsBufferS* m_vbo;
boo::IGraphicsBufferD* m_uniBuf;
boo::IShaderDataBinding* m_dataBind = nullptr;
Uniform m_uniform;
bool m_cookieCutter;
public:
CRandomStaticFilter(EFilterType type, bool cookieCutter=false);
CRandomStaticFilter(EFilterType type, const TLockedToken<CTexture>&)
: CRandomStaticFilter(type) {}
void draw(const zeus::CColor& color, float t);
void DrawFilter(EFilterShape, const zeus::CColor& color, float t) { draw(color, t); }
using _CLS = CRandomStaticFilter;
#include "TMultiBlendShaderDecl.hpp"
};
class CCookieCutterDepthRandomStaticFilter : public CRandomStaticFilter
{
public:
CCookieCutterDepthRandomStaticFilter(EFilterType type) :
CRandomStaticFilter(type, true) {}
CCookieCutterDepthRandomStaticFilter(EFilterType type, const TLockedToken<CTexture>&)
: CCookieCutterDepthRandomStaticFilter(type) {}
};
}
#endif // __URDE_CRANDOMSTATICFILTER_HPP__

View File

@ -0,0 +1,143 @@
#include "CRandomStaticFilter.hpp"
#include "TMultiBlendShader.hpp"
namespace urde
{
static const char* VS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n"
"\n"
"UBINDING0 uniform ColoredQuadUniform\n"
"{\n"
" mat4 xf;\n"
" vec4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
"};\n"
"\n"
"SBINDING(0) out VertToFrag vtf;\n"
"void main()\n"
"{\n"
" vtf.color = color;\n"
" gl_Position = xf * vec4(posIn.xyz, 1.0);\n"
"}\n";
static const char* FS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
"};\n"
"\n"
"SBINDING(0) in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n"
"void main()\n"
"{\n"
" colorOut = vtf.color;\n"
"}\n";
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* s_CookieCutterPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case EFilterType::Blend:
return s_AlphaPipeline;
case EFilterType::Add:
return s_AddPipeline;
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
}
}
struct CRandomStaticFilterGLDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CRandomStaticFilter& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
const boo::VertexElementDescriptor VtxVmt[] =
{
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4}
};
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
#if BOO_HAS_VULKAN
struct CRandomStaticFilterVulkanDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CRandomStaticFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
#endif
TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory*
CRandomStaticFilter::Initialize(boo::GLDataFactory::Context& ctx)
{
const char* uniNames[] = {"ColoredQuadUniform"};
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CRandomStaticFilterGLDataBindingFactory;
}
#if BOO_HAS_VULKAN
TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory*
CRandomStaticFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CRandomStaticFilterVulkanDataBindingFactory;
}
#endif
}

View File

@ -0,0 +1,107 @@
#include "CRandomStaticFilter.hpp"
#include "TMultiBlendShader.hpp"
namespace urde
{
static const char* VS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertData\n"
"{\n"
" float4 posIn [[ attribute(0) ]];\n"
"};\n"
"\n"
"struct ColoredQuadUniform\n"
"{\n"
" float4x4 xf;\n"
" float4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
"};\n"
"\n"
"vertex VertToFrag vmain(VertData v [[ stage_in ]], constant ColoredQuadUniform& cqu [[ buffer(2) ]])\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.color = cqu.color;\n"
" vtf.position = cqu.xf * float4(v.posIn.xyz, 1.0);\n"
" return vtf;\n"
"}\n";
static const char* FS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
"};\n"
"\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]])\n"
"{\n"
" return vtf.color;\n"
"}\n";
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* s_CookieCutterPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case EFilterType::Blend:
return s_AlphaPipeline;
case EFilterType::Add:
return s_AddPipeline;
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
}
}
struct CRandomStaticFilterMetalDataBindingFactory : TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CRandomStaticFilter& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
return cctx.newShaderDataBinding(filter.m_cookieCutter ? s_CookieCutterPipeline : SelectPipeline(type),
s_VtxFmt, filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
TMultiBlendShader<CRandomStaticFilter>::IDataBindingFactory*
CRandomStaticFilter::Initialize(boo::MetalDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CRandomStaticFilterMetalDataBindingFactory;
}
}

View File

@ -0,0 +1,36 @@
#include "CScanLinesFilter.hpp"
namespace urde
{
CScanLinesFilter::CScanLinesFilter(EFilterType type)
{
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
{
struct Vert
{
zeus::CVector2f m_pos;
} verts[4] =
{
{{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);
m_dataBind = TMultiBlendShader<CScanLinesFilter>::BuildShaderDataBinding(ctx, type, *this);
return true;
});
}
void CScanLinesFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t)
{
}
void CScanLinesFilter::Shutdown() {}
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
}

View File

@ -0,0 +1,43 @@
#ifndef __URDE_CSCANLINESFILTER_HPP__
#define __URDE_CSCANLINESFILTER_HPP__
#include "TMultiBlendShader.hpp"
#include "zeus/CMatrix4f.hpp"
#include "zeus/CColor.hpp"
#include "zeus/CRectangle.hpp"
#include "Camera/CCameraFilter.hpp"
namespace urde
{
class CScanLinesFilter
{
friend struct CScanLinesFilterGLDataBindingFactory;
friend struct CScanLinesFilterVulkanDataBindingFactory;
friend struct CScanLinesFilterMetalDataBindingFactory;
friend struct CScanLinesFilterD3DDataBindingFactory;
struct Uniform
{
zeus::CMatrix4f m_matrix;
zeus::CColor m_color;
};
boo::GraphicsDataToken m_token;
boo::IGraphicsBufferS* m_vbo;
boo::IGraphicsBufferD* m_uniBuf;
boo::IShaderDataBinding* m_dataBind = nullptr;
Uniform m_uniform;
public:
CScanLinesFilter(EFilterType type);
CScanLinesFilter(EFilterType type, const TLockedToken<CTexture>&)
: CScanLinesFilter(type) {}
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
using _CLS = CScanLinesFilter;
#include "TMultiBlendShaderDecl.hpp"
};
}
#endif // __URDE_CSCANLINESFILTER_HPP__

View File

@ -0,0 +1,142 @@
#include "CScanLinesFilter.hpp"
#include "TMultiBlendShader.hpp"
namespace urde
{
static const char* VS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"layout(location=0) in vec4 posIn;\n"
"\n"
"UBINDING0 uniform ColoredQuadUniform\n"
"{\n"
" mat4 xf;\n"
" vec4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
"};\n"
"\n"
"SBINDING(0) out VertToFrag vtf;\n"
"void main()\n"
"{\n"
" vtf.color = color;\n"
" gl_Position = xf * vec4(posIn.xyz, 1.0);\n"
"}\n";
static const char* FS =
"#version 330\n"
BOO_GLSL_BINDING_HEAD
"struct VertToFrag\n"
"{\n"
" vec4 color;\n"
"};\n"
"\n"
"SBINDING(0) in VertToFrag vtf;\n"
"layout(location=0) out vec4 colorOut;\n"
"void main()\n"
"{\n"
" colorOut = vtf.color;\n"
"}\n";
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case EFilterType::Blend:
return s_AlphaPipeline;
case EFilterType::Add:
return s_AddPipeline;
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
}
}
struct CScanLinesFilterGLDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CScanLinesFilter& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
const boo::VertexElementDescriptor VtxVmt[] =
{
{filter.m_vbo, nullptr, boo::VertexSemantic::Position4}
};
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
return cctx.newShaderDataBinding(SelectPipeline(type),
ctx.newVertexFormat(1, VtxVmt), filter.m_vbo, nullptr, nullptr,
1, bufs, stages, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
#if BOO_HAS_VULKAN
struct CScanLinesFilterVulkanDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CScanLinesFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
#endif
TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory*
CScanLinesFilter::Initialize(boo::GLDataFactory::Context& ctx)
{
const char* uniNames[] = {"ColoredQuadUniform"};
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CScanLinesFilterGLDataBindingFactory;
}
#if BOO_HAS_VULKAN
TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory*
CScanLinesFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, false, boo::CullMode::None);
return new CScanLinesFilterVulkanDataBindingFactory;
}
#endif
}

View File

@ -0,0 +1,106 @@
#include "CScanLinesFilter.hpp"
#include "TMultiBlendShader.hpp"
namespace urde
{
static const char* VS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertData\n"
"{\n"
" float4 posIn [[ attribute(0) ]];\n"
"};\n"
"\n"
"struct ColoredQuadUniform\n"
"{\n"
" float4x4 xf;\n"
" float4 color;\n"
"};\n"
"\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
"};\n"
"\n"
"vertex VertToFrag vmain(VertData v [[ stage_in ]], constant ColoredQuadUniform& cqu [[ buffer(2) ]])\n"
"{\n"
" VertToFrag vtf;\n"
" vtf.color = cqu.color;\n"
" vtf.position = cqu.xf * float4(v.posIn.xyz, 1.0);\n"
" return vtf;\n"
"}\n";
static const char* FS =
"#include <metal_stdlib>\n"
"using namespace metal;\n"
"struct VertToFrag\n"
"{\n"
" float4 position [[ position ]];\n"
" float4 color;\n"
"};\n"
"\n"
"fragment float4 fmain(VertToFrag vtf [[ stage_in ]])\n"
"{\n"
" return vtf.color;\n"
"}\n";
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
static boo::IVertexFormat* s_VtxFmt = nullptr;
static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case EFilterType::Blend:
return s_AlphaPipeline;
case EFilterType::Add:
return s_AddPipeline;
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
}
}
struct CScanLinesFilterMetalDataBindingFactory : TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
EFilterType type,
CScanLinesFilter& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
boo::IGraphicsBuffer* bufs[] = {filter.m_uniBuf};
return cctx.newShaderDataBinding(SelectPipeline(type), s_VtxFmt,
filter.m_vbo, nullptr, nullptr, 1, bufs,
nullptr, nullptr, nullptr, 0, nullptr, nullptr, nullptr);
}
};
TMultiBlendShader<CScanLinesFilter>::IDataBindingFactory*
CScanLinesFilter::Initialize(boo::MetalDataFactory::Context& ctx)
{
const boo::VertexElementDescriptor VtxVmt[] =
{
{nullptr, nullptr, boo::VertexSemantic::Position4}
};
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_AddPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
boo::BlendFactor::One, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
s_MultPipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcColor,
boo::BlendFactor::DstColor, boo::Primitive::TriStrips,
boo::ZTest::None, false, true, true, boo::CullMode::None);
return new CScanLinesFilterMetalDataBindingFactory;
}
}

View File

@ -9,7 +9,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(boo::ITexture* tex)
{
}
CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, boo::ITexture* tex)
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type, boo::ITexture* tex)
: m_booTex(tex)
{
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
@ -21,7 +21,7 @@ CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type, bo
});
}
CTexturedQuadFilter::CTexturedQuadFilter(CCameraFilterPass::EFilterType type,
CTexturedQuadFilter::CTexturedQuadFilter(EFilterType type,
TLockedToken<CTexture> tex)
: CTexturedQuadFilter(type, (tex ? tex->GetBooTexture() : nullptr))
{
@ -86,13 +86,18 @@ void CTexturedQuadFilter::drawVerts(const zeus::CColor& color, const Vert verts[
CGraphics::g_BooMainCommandQueue->draw(0, 4);
}
void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t)
{
}
const zeus::CRectangle CTexturedQuadFilter::DefaultRect = {0.f, 0.f, 1.f, 1.f};
void CTexturedQuadFilter::Shutdown() {}
URDE_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterType type, boo::ITexture* tex)
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type, boo::ITexture* tex)
: CTexturedQuadFilter(tex)
{
m_token = CGraphics::g_BooFactory->commitTransaction([&](boo::IGraphicsDataFactory::Context& ctx) -> bool
@ -104,7 +109,7 @@ CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterTyp
});
}
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterType type,
CTexturedQuadFilterAlpha::CTexturedQuadFilterAlpha(EFilterType type,
TLockedToken<CTexture> tex)
: CTexturedQuadFilterAlpha(type, (tex ? tex->GetBooTexture() : nullptr))
{

View File

@ -43,8 +43,8 @@ public:
};
static const zeus::CRectangle DefaultRect;
CTexturedQuadFilter(CCameraFilterPass::EFilterType type, TLockedToken<CTexture> tex);
CTexturedQuadFilter(CCameraFilterPass::EFilterType type, boo::ITexture* tex);
CTexturedQuadFilter(EFilterType type, TLockedToken<CTexture> tex);
CTexturedQuadFilter(EFilterType type, boo::ITexture* tex);
CTexturedQuadFilter(const CTexturedQuadFilter&) = delete;
CTexturedQuadFilter& operator=(const CTexturedQuadFilter&) = delete;
CTexturedQuadFilter(CTexturedQuadFilter&&) = default;
@ -52,6 +52,7 @@ public:
void draw(const zeus::CColor& color, float uvScale, const zeus::CRectangle& rect=DefaultRect);
void drawCropped(const zeus::CColor& color, float uvScale);
void drawVerts(const zeus::CColor& color, const Vert verts[4], float lod=0.f);
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
const TLockedToken<CTexture>& GetTex() const { return m_tex; }
using _CLS = CTexturedQuadFilter;
@ -66,8 +67,8 @@ class CTexturedQuadFilterAlpha : public CTexturedQuadFilter
friend struct CTexturedQuadFilterAlphaD3DDataBindingFactory;
public:
CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterType type, TLockedToken<CTexture> tex);
CTexturedQuadFilterAlpha(CCameraFilterPass::EFilterType type, boo::ITexture* tex);
CTexturedQuadFilterAlpha(EFilterType type, TLockedToken<CTexture> tex);
CTexturedQuadFilterAlpha(EFilterType type, boo::ITexture* tex);
using _CLS = CTexturedQuadFilterAlpha;
#include "TMultiBlendShaderDecl.hpp"
};

View File

@ -108,15 +108,15 @@ static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
@ -128,15 +128,15 @@ static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
static boo::IShaderPipeline* SelectAlphaPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AAlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AAddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_AMultPipeline;
default:
return nullptr;
@ -146,7 +146,7 @@ static boo::IShaderPipeline* SelectAlphaPipeline(CCameraFilterPass::EFilterType
struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilter& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
@ -169,7 +169,7 @@ struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader<CTexturedQuad
struct CTexturedQuadFilterVulkanDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilter& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);
@ -228,7 +228,7 @@ URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
struct CTexturedQuadFilterAlphaGLDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilterAlpha& filter)
{
boo::GLDataFactory::Context& cctx = static_cast<boo::GLDataFactory::Context&>(ctx);
@ -251,7 +251,7 @@ struct CTexturedQuadFilterAlphaGLDataBindingFactory : TMultiBlendShader<CTexture
struct CTexturedQuadFilterAlphaVulkanDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilterAlpha& filter)
{
boo::VulkanDataFactory::Context& cctx = static_cast<boo::VulkanDataFactory::Context&>(ctx);

View File

@ -111,15 +111,15 @@ static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
@ -129,7 +129,7 @@ static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
struct CTexturedQuadFilterD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilter& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);
@ -171,15 +171,15 @@ static boo::IShaderPipeline* s_AAlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AAddPipeline = nullptr;
static boo::IShaderPipeline* s_AMultPipeline = nullptr;
static boo::IShaderPipeline* SelectAlphaPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectAlphaPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AAlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AAddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_AMultPipeline;
default:
return nullptr;
@ -189,7 +189,7 @@ static boo::IShaderPipeline* SelectAlphaPipeline(CCameraFilterPass::EFilterType
struct CTexturedQuadFilterAlphaD3DDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilterAlpha& filter)
{
boo::ID3DDataFactory::Context& cctx = static_cast<boo::ID3DDataFactory::Context&>(ctx);

View File

@ -116,15 +116,15 @@ static boo::IShaderPipeline* s_AlphaPipeline = nullptr;
static boo::IShaderPipeline* s_AddPipeline = nullptr;
static boo::IShaderPipeline* s_MultPipeline = nullptr;
static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
static boo::IShaderPipeline* SelectPipeline(EFilterType type)
{
switch (type)
{
case CCameraFilterPass::EFilterType::Blend:
case EFilterType::Blend:
return s_AlphaPipeline;
case CCameraFilterPass::EFilterType::Add:
case EFilterType::Add:
return s_AddPipeline;
case CCameraFilterPass::EFilterType::Multiply:
case EFilterType::Multiply:
return s_MultPipeline;
default:
return nullptr;
@ -134,7 +134,7 @@ static boo::IShaderPipeline* SelectPipeline(CCameraFilterPass::EFilterType type)
struct CTexturedQuadFilterMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilter>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilter& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);
@ -171,7 +171,7 @@ CTexturedQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
struct CTexturedQuadFilterAlphaMetalDataBindingFactory : TMultiBlendShader<CTexturedQuadFilterAlpha>::IDataBindingFactory
{
boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
EFilterType type,
CTexturedQuadFilterAlpha& filter)
{
boo::MetalDataFactory::Context& cctx = static_cast<boo::MetalDataFactory::Context&>(ctx);

View File

@ -18,8 +18,7 @@ public:
struct IDataBindingFactory
{
virtual boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
ShaderImp& filter)=0;
EFilterType type, ShaderImp& filter)=0;
};
static std::unique_ptr<IDataBindingFactory> m_bindFactory;
@ -67,8 +66,7 @@ public:
}
static boo::IShaderDataBinding* BuildShaderDataBinding(boo::IGraphicsDataFactory::Context& ctx,
CCameraFilterPass::EFilterType type,
ShaderImp& filter)
EFilterType type, ShaderImp& filter)
{
return m_bindFactory->BuildShaderDataBinding(ctx, type, filter);
}

View File

@ -50,10 +50,10 @@ void CAuiImagePane::Update(float dt)
}
CAuiImagePane::Filters::Filters(TLockedToken<CTexture>& tex)
: m_darkenerQuad(CCameraFilterPass::EFilterType::Blend, tex),
m_flashQuad{{CCameraFilterPass::EFilterType::Add, tex}, {CCameraFilterPass::EFilterType::Add, tex}},
m_alphaQuad{{CCameraFilterPass::EFilterType::Blend, tex}, {CCameraFilterPass::EFilterType::Blend, tex}},
m_addQuad{{CCameraFilterPass::EFilterType::Add, tex}, {CCameraFilterPass::EFilterType::Add, tex}}
: m_darkenerQuad(EFilterType::Blend, tex),
m_flashQuad{{EFilterType::Add, tex}, {EFilterType::Add, tex}},
m_alphaQuad{{EFilterType::Blend, tex}, {EFilterType::Blend, tex}},
m_addQuad{{EFilterType::Add, tex}, {EFilterType::Add, tex}}
{
}

View File

@ -46,7 +46,7 @@ public:
CTexturedQuadFilter m_quad;
public:
CDataDot(const TLockedToken<CTexture>& dataDotTex)
: m_quad(CCameraFilterPass::EFilterType::Add, dataDotTex) {}
: m_quad(EFilterType::Add, dataDotTex) {}
void Update(float dt);
void Draw(const zeus::CColor& color, float radius) const;
float GetTransitionFactor() const { return x1c_transDur > 0.f ? x20_remTime / x1c_transDur : 0.f; }

View File

@ -16,7 +16,7 @@ static const char* SplashTextures[]
CSplashScreen::CSplashScreen(ESplashScreen which)
: CIOWin("SplashScreen"), x14_which(which),
m_quad(CCameraFilterPass::EFilterType::Blend,
m_quad(EFilterType::Blend,
g_SimplePool->GetObj(SplashTextures[int(which)]))
{
}

View File

@ -37,7 +37,7 @@ void CFaceplateDecoration::Update(float dt, CStateManager& stateMgr)
}
if (!m_texFilter && x4_tex.IsLoaded())
m_texFilter.emplace(CCameraFilterPass::EFilterType::Blend, x4_tex);
m_texFilter.emplace(EFilterType::Blend, x4_tex);
}
void CFaceplateDecoration::Draw(CStateManager& stateMgr)

View File

@ -2320,7 +2320,7 @@ bool CFrontEndUI::PumpLoad()
return false;
/* Ready to construct texture quads */
m_pressStartQuad.emplace(CCameraFilterPass::EFilterType::Add, x38_pressStart);
m_pressStartQuad.emplace(EFilterType::Add, x38_pressStart);
return true;
}

View File

@ -421,7 +421,7 @@ private:
std::unique_ptr<SOptionsFrontEndFrame> xf0_optionsFrme;
CStaticAudioPlayer* xf4_curAudio = nullptr;
CColoredQuadFilter m_fadeToBlack = {CCameraFilterPass::EFilterType::Blend};
CColoredQuadFilter m_fadeToBlack = {EFilterType::Blend};
std::experimental::optional<CTexturedQuadFilterAlpha> m_pressStartQuad;
std::unique_ptr<CFrontEndUITouchBar> m_touchBar;

View File

@ -569,7 +569,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
if (x1d8_onScreenTexAlpha > 0.f && x1dc_onScreenTexTok.IsLoaded())
{
if (!m_onScreenQuad || m_onScreenQuad->GetTex().GetObj() != x1dc_onScreenTexTok.GetObj())
m_onScreenQuad.emplace(CCameraFilterPass::EFilterType::Blend, x1dc_onScreenTexTok);
m_onScreenQuad.emplace(EFilterType::Blend, x1dc_onScreenTexTok);
// No depth read/write
// Alpha blend
@ -612,11 +612,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
{
CGraphics::SetDepthRange(0.001953125f, 0.015625f);
if (staticAlpha > 0.f)
{
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::RandomStatic,
zeus::CColor(1.f, staticAlpha), nullptr, 1.f);
}
m_randomStatic.draw(zeus::CColor(1.f, staticAlpha), 1.f);
x34_samusHud->Draw(stateMgr, x1f4_visorStaticAlpha * (1.f - staticAlpha),
x1e0_helmetVisMode, x1ec_hudVisMode != EHudVisMode::Zero,
x1e4_enableTargetingManager && !scanVisor);
@ -691,9 +687,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
dieDur = 6.f;
float alpha = zeus::clamp(0.f, stateMgr.GetPlayer().GetDeathTime() / dieDur, 1.f);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::Fullscreen,
zeus::CColor(1.f, alpha), nullptr, 1.f);
m_deathWhiteout.draw(zeus::CColor(1.f, alpha));
float zStart = dieDur - 0.5f - 0.5f - 1.f;
float xStart = 0.5f - zStart;
@ -705,9 +699,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
float colT = 1.f - zeus::clamp(0.f, (stateMgr.GetPlayer().GetDeathTime() - colStart) / 0.5f, 1.f);
SClipScreenRect rect(g_Viewport);
CGraphics::ResolveSpareTexture(rect);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::Fullscreen,
zeus::CColor::skBlack, nullptr, 1.f);
m_deathBlackout.draw(zeus::CColor::skBlack);
float z = 0.5f * (zT * zT * zT * zT * zT * (g_Viewport.xc_height - 12.f) + 12.f);
float x = 0.5f * (xT * (g_Viewport.x8_width - 12.f) + 12.f);
@ -720,11 +712,11 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
};
if (!m_deathRenderTexQuad)
m_deathRenderTexQuad.emplace(CCameraFilterPass::EFilterType::Blend, CGraphics::g_SpareTexture);
m_deathRenderTexQuad.emplace(EFilterType::Blend, CGraphics::g_SpareTexture);
m_deathRenderTexQuad->drawVerts(zeus::CColor(1.f, colT), verts);
if (!m_deathDotQuad)
m_deathDotQuad.emplace(CCameraFilterPass::EFilterType::Multiply, x50_deathDot);
m_deathDotQuad.emplace(EFilterType::Multiply, x50_deathDot);
m_deathDotQuad->drawVerts(zeus::CColor(1.f, colT), verts);
}
}
@ -746,8 +738,8 @@ void CInGameGuiManager::PauseGame(CStateManager& stateMgr, EInGameGuiState state
void CInGameGuiManager::StartFadeIn()
{
xf8_camFilter.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
xf8_camFilter.SetFilter(EFilterType::Multiply,
EFilterShape::Fullscreen,
0.f, zeus::CColor::skBlack, -1);
xf8_camFilter.DisableFilter(0.5f);
}

View File

@ -15,6 +15,7 @@
#include "CPauseScreen.hpp"
#include "CPauseScreenBlur.hpp"
#include "CInGameGuiManagerCommon.hpp"
#include "Graphics/Shaders/CRandomStaticFilter.hpp"
namespace urde
{
@ -71,7 +72,7 @@ private:
std::vector<TLockedToken<CDependencyGroup>> xc8_inGameGuiDGRPs;
std::vector<u32> xd8_;
std::vector<CToken> xe8_pauseResources;
CCameraFilterPass xf8_camFilter;
CCameraFilterPass<CColoredQuadFilter> xf8_camFilter;
ResId x124_pauseGameHudMessage = -1;
float x128_pauseGameHudTime = 0.f;
std::list<CToken> x12c_;
@ -100,6 +101,9 @@ private:
std::experimental::optional<CTexturedQuadFilter> m_deathRenderTexQuad;
std::experimental::optional<CTexturedQuadFilter> m_deathDotQuad;
CRandomStaticFilter m_randomStatic = { EFilterType::Blend };
CColoredQuadFilter m_deathWhiteout = { EFilterType::Blend };
CColoredQuadFilter m_deathBlackout = { EFilterType::Blend };
union
{

View File

@ -40,7 +40,7 @@ class CMFGame : public CMFGameBase
u8 _dummy = 0;
};
CColoredQuadFilter m_fadeToBlack = {CCameraFilterPass::EFilterType::Multiply};
CColoredQuadFilter m_fadeToBlack = {EFilterType::Multiply};
bool IsCameraActiveFlow() const
{

View File

@ -92,7 +92,7 @@ void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool b)
}
else
{
x1c_camBlur.SetBlur(CCameraBlurPass::EBlurType::HiBlur,
x1c_camBlur.SetBlur(EBlurType::HiBlur,
g_tweakGui->GetPauseBlurFactor() * std::fabs(x18_blurAmt), 0.f);
x50_24_blurring = true;
}
@ -102,18 +102,14 @@ void CPauseScreenBlur::Draw(const CStateManager&) const
{
const_cast<CCameraBlurPass&>(x1c_camBlur).Draw();
float t = std::fabs(x18_blurAmt);
if (x1c_camBlur.GetCurrType() != CCameraBlurPass::EBlurType::NoBlur)
if (x1c_camBlur.GetCurrType() != EBlurType::NoBlur)
{
zeus::CColor filterColor =
zeus::CColor::lerp(zeus::CColor::skWhite, g_tweakGuiColors->GetPauseBlurFilterColor(), t);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::FullscreenQuarters,
filterColor, x4_mapLightQuarter.GetObj(), t);
const_cast<CTexturedQuadFilter&>(m_quarterFilter).DrawFilter(EFilterShape::FullscreenQuarters, filterColor, t);
zeus::CColor scanLinesColor =
zeus::CColor::lerp(zeus::CColor::skWhite, zeus::CColor(0.75f, 1.f), t);
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::ScanLinesEven,
scanLinesColor, nullptr, t);
const_cast<CScanLinesFilter&>(m_linesFilter).DrawFilter(EFilterShape::ScanLinesEven, scanLinesColor, t);
}
if (x50_24_blurring /*&& x1c_camBlur.x2d_noPersistentCopy*/)

View File

@ -5,6 +5,8 @@
#include "CToken.hpp"
#include "Camera/CCameraFilter.hpp"
#include "Graphics/CTexture.hpp"
#include "Graphics/Shaders/CTexturedQuadFilter.hpp"
#include "Graphics/Shaders/CScanLinesFilter.hpp"
namespace urde
{
@ -29,6 +31,8 @@ class CPauseScreenBlur
EState x14_nextState = EState::InGame;
float x18_blurAmt = 0.f;
CCameraBlurPass x1c_camBlur;
CTexturedQuadFilter m_quarterFilter = { EFilterType::Multiply, x4_mapLightQuarter };
CScanLinesFilter m_linesFilter = { EFilterType::Multiply };
union
{

View File

@ -506,15 +506,13 @@ void CPlayerVisor::UpdateCurrentVisor(float transFactor)
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(CCameraBlurPass::EBlurType::Xray, 36.f * transFactor, 0.f);
x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f * transFactor, 0.f);
break;
case CPlayerState::EPlayerVisor::Scan:
{
zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorHudLightMultiply(),
zeus::CColor::skWhite, 1.f - transFactor);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, dimColor, -1);
x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1);
break;
}
default: break;
@ -529,7 +527,7 @@ void CPlayerVisor::FinishTransitionIn()
x90_xrayBlur.DisableBlur(0.f);
break;
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(CCameraBlurPass::EBlurType::Xray, 36.f, 0.f);
x90_xrayBlur.SetBlur(EBlurType::Xray, 36.f, 0.f);
if (!x5c_visorLoopSfx)
x5c_visorLoopSfx = CSfxManager::SfxStart(1384, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId);
break;
@ -538,9 +536,7 @@ void CPlayerVisor::FinishTransitionIn()
zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(),
g_tweakGuiColors->GetScanVisorHudLightMultiply(),
x2c_scanDimInterp);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, dimColor, -1);
x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1);
if (!x5c_visorLoopSfx)
x5c_visorLoopSfx = CSfxManager::SfxStart(1404, x24_visorSfxVol, 0.f, false, 0x7f, true, kInvalidAreaId);
break;
@ -558,16 +554,14 @@ void CPlayerVisor::BeginTransitionIn(const CStateManager&)
switch (x1c_curVisor)
{
case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(CCameraBlurPass::EBlurType::Xray, 0.f, 0.f);
x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f);
xc4_vpScaleX = 0.9f;
xc8_vpScaleY = 0.9f;
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break;
case CPlayerState::EPlayerVisor::Scan:
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, zeus::CColor::skWhite, -1);
x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, zeus::CColor::skWhite, -1);
break;
case CPlayerState::EPlayerVisor::Thermal:
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
@ -670,9 +664,7 @@ void CPlayerVisor::Update(float dt, const CStateManager& mgr)
zeus::CColor dimColor = zeus::CColor::lerp(g_tweakGuiColors->GetScanVisorScreenDimColor(),
g_tweakGuiColors->GetScanVisorHudLightMultiply(),
x2c_scanDimInterp);
x64_scanDim.SetFilter(CCameraFilterPass::EFilterType::Multiply,
CCameraFilterPass::EFilterShape::Fullscreen,
0.f, dimColor, -1);
x64_scanDim.SetFilter(EFilterType::Multiply, EFilterShape::Fullscreen, 0.f, dimColor, -1);
}
}

View File

@ -7,6 +7,7 @@
#include "Audio/CSfxManager.hpp"
#include "CPlayerState.hpp"
#include "Graphics/CModel.hpp"
#include "Graphics/Shaders/CColoredQuadFilter.hpp"
namespace urde
{
@ -51,7 +52,7 @@ class CPlayerVisor
float x58_scanMagInterp = 1.f;
CSfxHandle x5c_visorLoopSfx;
CSfxHandle x60_scanningLoopSfx;
CCameraFilterPass x64_scanDim;
CCameraFilterPass<CColoredQuadFilter> x64_scanDim;
CCameraBlurPass x90_xrayBlur;
float xc4_vpScaleX = 1.f;
float xc8_vpScaleY = 1.f;

View File

@ -113,7 +113,7 @@ CQuitGameScreen::CQuitGameScreen(EQuitType tp)
{
x4_frame = g_SimplePool->GetObj("FRME_QuitScreen");
if (tp == EQuitType::QuitGame)
m_blackScreen.emplace(CCameraFilterPass::EFilterType::Blend);
m_blackScreen.emplace(EFilterType::Blend);
}
}

View File

@ -23,7 +23,9 @@ CSamusHud* CSamusHud::g_SamusHud = nullptr;
CSamusHud::CSamusHud(CStateManager& stateMgr)
: x8_targetingMgr(stateMgr),
x258_frmeHelmet(g_SimplePool->GetObj("FRME_Helmet")),
x268_frmeBaseHud(g_SimplePool->GetObj("FRME_BaseHud"))
x268_frmeBaseHud(g_SimplePool->GetObj("FRME_BaseHud")),
m_energyDrainFilter(g_tweakGui->GetEnergyDrainFilterAdditive() ?
EFilterType::Add : EFilterType::Blend)
{
x2e0_26_latestFirstPerson = true;
x2e0_27_energyLow = stateMgr.GetPlayer().IsEnergyLow(stateMgr);
@ -1002,7 +1004,7 @@ void CSamusHud::UpdateHudDamage(float dt, const CStateManager& mgr,
{
if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Unmorphed)
color2.a *= 0.75f;
x3a8_camFilter.SetFilter(CCameraFilterPass::EFilterType::Add, CCameraFilterPass::EFilterShape::Fullscreen,
x3a8_camFilter.SetFilter(EFilterType::Add, EFilterShape::Fullscreen,
0.f, color2, -1);
}
else
@ -1113,8 +1115,8 @@ void CSamusHud::UpdateStaticInterference(float dt, const CStateManager& mgr)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = x510_staticInterp;
x51c_camFilter2.SetFilter(CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::RandomStatic, 0.f, color, -1);
x51c_camFilter2.SetFilter(EFilterType::Blend,
EFilterShape::RandomStatic, 0.f, color, -1);
}
else
{
@ -1535,10 +1537,7 @@ void CSamusHud::DrawAttachedEnemyEffect(const CStateManager& mgr) const
zeus::CColor filterColor = g_tweakGuiColors->GetEnergyDrainFilterColor();
filterColor.a *= alpha;
CCameraFilterPass::DrawFilter(g_tweakGui->GetEnergyDrainFilterAdditive() ?
CCameraFilterPass::EFilterType::Add : CCameraFilterPass::EFilterType::Blend,
CCameraFilterPass::EFilterShape::Fullscreen, filterColor,
nullptr, 1.f);
const_cast<CColoredQuadFilter&>(m_energyDrainFilter).draw(filterColor);
}
void CSamusHud::Draw(const CStateManager& mgr, float alpha,
@ -1559,11 +1558,8 @@ void CSamusHud::Draw(const CStateManager& mgr, float alpha,
helmetVis < CInGameGuiManager::EHelmetVisMode::HelmetOnly)
{
if (alpha < 1.f)
{
CCameraFilterPass::DrawFilter(CCameraFilterPass::EFilterType::NoColor,
CCameraFilterPass::EFilterShape::CookieCutterDepthRandomStatic,
zeus::CColor::skWhite, nullptr, 1.f - alpha);
}
const_cast<CCookieCutterDepthRandomStaticFilter&>(m_cookieCutterStatic).
draw(zeus::CColor::skWhite, 1.f - alpha);
if (x288_loadedSelectedHud)
{

View File

@ -13,6 +13,7 @@
#include "GuiSys/CHudRadarInterface.hpp"
#include "GuiSys/CHudThreatInterface.hpp"
#include "GuiSys/CHudVisorBeamMenu.hpp"
#include "Graphics/Shaders/CRandomStaticFilter.hpp"
namespace urde
{
@ -151,7 +152,7 @@ class CSamusHud
std::unique_ptr<CActorLights> x33c_lights;
rstl::reserved_vector<SCachedHudLight, 3> x340_hudLights;
CSfxHandle x3a4_damageSfx;
CCameraFilterPass x3a8_camFilter;
CCameraFilterPass<CColoredQuadFilter> x3a8_camFilter;
CGuiLight* x3d4_damageLight = nullptr;
std::vector<zeus::CTransform> x3d8_lightTransforms;
float x3e8_damageTIme = 0.f;
@ -178,7 +179,7 @@ class CSamusHud
float x510_staticInterp = 0.f;
float x514_staticCycleTimerHi = 0.f;
float x518_staticCycleTimerLo = 0.f;
CCameraFilterPass x51c_camFilter2;
CCameraFilterPass<CRandomStaticFilter> x51c_camFilter2;
CHUDMemoParms x548_hudMemoParms;
TLockedToken<CStringTable> x550_hudMemoString;
u32 x554_hudMemoIdx = 0;
@ -206,6 +207,9 @@ class CSamusHud
float x72c_camZTweaks[32];
rstl::reserved_vector<SProfileInfo, 15> x7ac_;
CColoredQuadFilter m_energyDrainFilter;
CCookieCutterDepthRandomStaticFilter m_cookieCutterStatic = { EFilterType::NoColor };
static CSamusHud* g_SamusHud;
static rstl::prereserved_vector<bool, 4> BuildPlayerHasVisors(const CStateManager& mgr);
static rstl::prereserved_vector<bool, 4> BuildPlayerHasBeams(const CStateManager& mgr);

View File

@ -44,7 +44,7 @@ public:
void SetTexture(const TLockedToken<CTexture>& tex)
{
m_texQuad.emplace(CCameraFilterPass::EFilterType::Blend, tex);
m_texQuad.emplace(EFilterType::Blend, tex);
}
bool IsLoaded() const
{

View File

@ -12,6 +12,8 @@
#include "Graphics/Shaders/CRadarPaintShader.hpp"
#include "Graphics/Shaders/CMapSurfaceShader.hpp"
#include "Graphics/Shaders/CPhazonSuitFilter.hpp"
#include "Graphics/Shaders/CScanLinesFilter.hpp"
#include "Graphics/Shaders/CRandomStaticFilter.hpp"
#include "Character/CCharLayoutInfo.hpp"
#include "Audio/CStreamAudioManager.hpp"
#include "CGBASupport.hpp"
@ -35,6 +37,8 @@ URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CColoredQuadFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTexturedQuadFilterAlpha)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CTextSupportShader)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CScanLinesFilter)
URDE_DECL_SPECIALIZE_MULTI_BLEND_SHADER(CRandomStaticFilter)
namespace MP1
{
@ -229,6 +233,8 @@ CMain::BooSetter::BooSetter(boo::IGraphicsDataFactory* factory,
TMultiBlendShader<CTexturedQuadFilter>::Initialize();
TMultiBlendShader<CTexturedQuadFilterAlpha>::Initialize();
TMultiBlendShader<CTextSupportShader>::Initialize();
TMultiBlendShader<CScanLinesFilter>::Initialize();
TMultiBlendShader<CRandomStaticFilter>::Initialize();
}
void CMain::RegisterResourceTweaks()
@ -362,6 +368,8 @@ void CMain::Shutdown()
TMultiBlendShader<CTexturedQuadFilter>::Shutdown();
TMultiBlendShader<CTexturedQuadFilterAlpha>::Shutdown();
TMultiBlendShader<CTextSupportShader>::Shutdown();
TMultiBlendShader<CScanLinesFilter>::Shutdown();
TMultiBlendShader<CRandomStaticFilter>::Shutdown();
}
boo::IWindow* CMain::GetMainWindow() const

View File

@ -82,10 +82,10 @@ private:
u8 dummy = 0;
};
CColoredQuadFilter m_fadeToBlack = { CCameraFilterPass::EFilterType::Blend };
CTexturedQuadFilter m_dissolve = { CCameraFilterPass::EFilterType::Blend,
CColoredQuadFilter m_fadeToBlack = { EFilterType::Blend };
CTexturedQuadFilter m_dissolve = { EFilterType::Blend,
CGraphics::g_SpareTexture };
CWideScreenFilter m_widescreen = { CCameraFilterPass::EFilterType::Blend };
CWideScreenFilter m_widescreen = { EFilterType::Blend };
CCameraBlurFilter m_camblur;
static int GetSuitCharIdx();