mirror of https://github.com/AxioDL/metaforce.git
Lots of bug fixes; working CPhazonSuitFilter
This commit is contained in:
parent
1c44f8d1bc
commit
c00cc6cea9
|
@ -734,8 +734,8 @@ void CCameraManager::SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId)
|
|||
|
||||
float CCameraManager::GetCameraBobMagnitude() const
|
||||
{
|
||||
return 1.f - zeus::clamp(-1.f, zeus::clamp(-1.f,
|
||||
x7c_fpCamera->GetTransform().basis[1].dot(zeus::CVector3f::skUp), 1.f) /
|
||||
return 1.f - zeus::clamp(-1.f, std::fabs(zeus::clamp(-1.f,
|
||||
x7c_fpCamera->GetTransform().basis[1].dot(zeus::CVector3f::skUp), 1.f)) /
|
||||
std::cos(2.f * M_PIF / 12.f), 1.f);
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
|
||||
if (player->GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed ||
|
||||
player->GetOrbitState() == CPlayer::EPlayerOrbitState::Grapple ||
|
||||
player->GetGrappleState() == CPlayer::EGrappleState::None ||
|
||||
player->GetGrappleState() != CPlayer::EGrappleState::None ||
|
||||
mgr.GetGameState() == CStateManager::EGameState::SoftPaused ||
|
||||
mgr.GetCameraManager()->IsInCinematicCamera() ||
|
||||
x1d4_closeInTimer > 0.f)
|
||||
|
|
|
@ -533,17 +533,18 @@ zeus::CTransform CAnimData::GetLocatorTransform(CSegId id, const CCharAnimTime*
|
|||
return {};
|
||||
|
||||
zeus::CTransform ret;
|
||||
if (!x220_31_poseCached)
|
||||
if (time || !x220_31_poseCached)
|
||||
{
|
||||
const_cast<CAnimData*>(this)->RecalcPoseBuilder(time);
|
||||
const_cast<CAnimData*>(this)->x220_31_poseCached = time == nullptr;
|
||||
}
|
||||
|
||||
if (!x220_30_poseBuilt)
|
||||
x2fc_poseBuilder.BuildTransform(id, ret);
|
||||
else
|
||||
{
|
||||
zeus::CMatrix3f rot = x224_pose.GetRotation(id);
|
||||
zeus::CVector3f offset = x224_pose.GetOffset(id);
|
||||
ret.setRotation(rot);
|
||||
ret.origin = offset;
|
||||
ret.setRotation(x224_pose.GetTransformMinusOffset(id));
|
||||
ret.origin = x224_pose.GetOffset(id);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -339,6 +339,7 @@ bool CBitLevelLoader::LoadBool()
|
|||
|
||||
CSegIdToIndexConverter::CSegIdToIndexConverter(const CFBStreamedAnimReaderTotals& totals)
|
||||
{
|
||||
std::fill(std::begin(x0_indices), std::end(x0_indices), -1);
|
||||
for (u32 b=0 ; b<totals.x24_boneChanCount ; ++b)
|
||||
{
|
||||
u16 segId = totals.xc_segIds2[b];
|
||||
|
@ -360,13 +361,19 @@ CFBStreamedAnimReader::CFBStreamedAnimReader(const TSubAnimTypeToken<CFBStreamed
|
|||
|
||||
bool CFBStreamedAnimReader::HasOffset(const CSegId& seg) const
|
||||
{
|
||||
return x7c_totals.Prior().x8_hasTrans1[x114_segIdToIndex.SegIdToIndex(seg)];
|
||||
s32 idx = x114_segIdToIndex.SegIdToIndex(seg);
|
||||
if (idx == -1)
|
||||
return false;
|
||||
return x7c_totals.Prior().x8_hasTrans1[idx];
|
||||
}
|
||||
|
||||
zeus::CVector3f CFBStreamedAnimReader::GetOffset(const CSegId& seg) const
|
||||
{
|
||||
const float* af = x7c_totals.Prior().GetFloats(x114_segIdToIndex.SegIdToIndex(seg));
|
||||
const float* bf = x7c_totals.Next().GetFloats(x114_segIdToIndex.SegIdToIndex(seg));
|
||||
s32 idx = x114_segIdToIndex.SegIdToIndex(seg);
|
||||
if (idx == -1)
|
||||
return {};
|
||||
const float* af = x7c_totals.Prior().GetFloats(idx);
|
||||
const float* bf = x7c_totals.Next().GetFloats(idx);
|
||||
zeus::CVector3f a(af[4], af[5], af[6]);
|
||||
zeus::CVector3f b(bf[4], bf[5], bf[6]);
|
||||
return zeus::CVector3f::lerp(a, b, x7c_totals.GetT());
|
||||
|
@ -374,8 +381,11 @@ zeus::CVector3f CFBStreamedAnimReader::GetOffset(const CSegId& seg) const
|
|||
|
||||
zeus::CQuaternion CFBStreamedAnimReader::GetRotation(const CSegId& seg) const
|
||||
{
|
||||
const float* af = x7c_totals.Prior().GetFloats(x114_segIdToIndex.SegIdToIndex(seg));
|
||||
const float* bf = x7c_totals.Next().GetFloats(x114_segIdToIndex.SegIdToIndex(seg));
|
||||
s32 idx = x114_segIdToIndex.SegIdToIndex(seg);
|
||||
if (idx == -1)
|
||||
return {};
|
||||
const float* af = x7c_totals.Prior().GetFloats(idx);
|
||||
const float* bf = x7c_totals.Next().GetFloats(idx);
|
||||
zeus::CQuaternion a(af[0], af[1], af[2], af[3]);
|
||||
zeus::CQuaternion b(bf[0], bf[1], bf[2], bf[3]);
|
||||
return zeus::CQuaternion::slerp(a, b, x7c_totals.GetT());
|
||||
|
@ -479,33 +489,40 @@ SAdvancementResults CFBStreamedAnimReader::VAdvanceView(const CCharAnimTime& dt)
|
|||
SAdvancementResults res = {};
|
||||
|
||||
CCharAnimTime animDur = x54_source->GetAnimationDuration();
|
||||
if (xc_curTime >= animDur || dt.EqualsZero())
|
||||
if (xc_curTime == animDur)
|
||||
{
|
||||
xc_curTime = CCharAnimTime(0);
|
||||
xc_curTime = CCharAnimTime();
|
||||
x7c_totals.SetTime(x108_bitLoader, xc_curTime);
|
||||
res.x0_remTime = dt;
|
||||
return res;
|
||||
}
|
||||
else if (dt.EqualsZero())
|
||||
{
|
||||
return res;
|
||||
}
|
||||
|
||||
zeus::CQuaternion priorQ = GetRotation(3);
|
||||
zeus::CVector3f priorV = GetOffset(3);
|
||||
|
||||
CCharAnimTime nextTime = xc_curTime + dt;
|
||||
if (nextTime > animDur)
|
||||
xc_curTime += dt;
|
||||
CCharAnimTime overTime;
|
||||
if (xc_curTime > animDur)
|
||||
{
|
||||
nextTime = animDur;
|
||||
res.x0_remTime = nextTime - animDur;
|
||||
overTime = xc_curTime - animDur;
|
||||
xc_curTime = animDur;
|
||||
}
|
||||
xc_curTime = nextTime;
|
||||
|
||||
x7c_totals.SetTime(x108_bitLoader, xc_curTime);
|
||||
if (x54_source->HasPOIData())
|
||||
UpdatePOIStates();
|
||||
|
||||
zeus::CQuaternion nextQ = GetRotation(3);
|
||||
zeus::CVector3f nextV = GetOffset(3);
|
||||
|
||||
res.x8_deltas.xc_rotDelta = priorQ.inverse() * nextQ;
|
||||
res.x0_remTime = overTime;
|
||||
res.x8_deltas.xc_rotDelta = nextQ * priorQ.inverse();
|
||||
if (HasOffset(3))
|
||||
res.x8_deltas.x0_posDelta = res.x8_deltas.xc_rotDelta.transform(nextV - priorV);
|
||||
res.x8_deltas.x0_posDelta = nextQ.inverse().transform(nextV - priorV);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -85,10 +85,10 @@ public:
|
|||
|
||||
class CSegIdToIndexConverter
|
||||
{
|
||||
u32 x0_indices[96] = {u32(-1)};
|
||||
s32 x0_indices[96];
|
||||
public:
|
||||
CSegIdToIndexConverter(const CFBStreamedAnimReaderTotals& totals);
|
||||
u32 SegIdToIndex(const CSegId& id) const { return x0_indices[id]; }
|
||||
s32 SegIdToIndex(const CSegId& id) const { return x0_indices[id]; }
|
||||
};
|
||||
|
||||
class CFBStreamedAnimReader : public CAnimSourceReaderBase
|
||||
|
|
|
@ -19,10 +19,10 @@ std::shared_ptr<CAnimTreeNode>
|
|||
CMetaAnimPlay::VGetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const
|
||||
{
|
||||
if (orders.x0_)
|
||||
if (orders.x0_recursiveAdvance)
|
||||
{
|
||||
CMetaAnimTreeBuildOrders modOrders;
|
||||
modOrders.PreAdvanceForAll(*orders.x0_);
|
||||
modOrders.PreAdvanceForAll(*orders.x0_recursiveAdvance);
|
||||
return GetAnimationTree(animSys, modOrders);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "CMetaAnimRandom.hpp"
|
||||
#include "CMetaAnimFactory.hpp"
|
||||
#include "CAnimSysContext.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
@ -32,7 +33,16 @@ std::shared_ptr<CAnimTreeNode>
|
|||
CMetaAnimRandom::VGetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const
|
||||
{
|
||||
return {};
|
||||
s32 r = animSys.x8_random->Range(1, 100);
|
||||
const std::pair<std::shared_ptr<IMetaAnim>, u32>* useRd = nullptr;
|
||||
for (auto& rd : x4_randomData)
|
||||
{
|
||||
useRd = &rd;
|
||||
if (r <= rd.second)
|
||||
break;
|
||||
}
|
||||
|
||||
return useRd->first->GetAnimationTree(animSys, orders);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,10 +30,10 @@ std::shared_ptr<CAnimTreeNode>
|
|||
CMetaAnimSequence::VGetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const
|
||||
{
|
||||
if (orders.x0_)
|
||||
if (orders.x0_recursiveAdvance)
|
||||
{
|
||||
CMetaAnimTreeBuildOrders modOrders;
|
||||
modOrders.PreAdvanceForAll(*orders.x0_);
|
||||
modOrders.PreAdvanceForAll(*orders.x0_recursiveAdvance);
|
||||
return GetAnimationTree(animSys, modOrders);
|
||||
}
|
||||
|
||||
|
|
|
@ -423,7 +423,7 @@ void CModelData::InvSuitDraw(EWhichModel which, const zeus::CTransform& xf, cons
|
|||
|
||||
/* Normal Blended */
|
||||
lights->ActivateLights(*model.GetModelInst());
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = alphaColor;
|
||||
x10_animData->Render(model, flags, {}, nullptr);
|
||||
|
||||
|
@ -445,7 +445,7 @@ void CModelData::InvSuitDraw(EWhichModel which, const zeus::CTransform& xf, cons
|
|||
|
||||
/* Normal Blended */
|
||||
lights->ActivateLights(model);
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = alphaColor;
|
||||
model.Draw(flags, nullptr, nullptr);
|
||||
|
||||
|
|
|
@ -11,13 +11,13 @@ std::shared_ptr<CAnimTreeNode>
|
|||
IMetaAnim::GetAnimationTree(const CAnimSysContext& animSys,
|
||||
const CMetaAnimTreeBuildOrders& orders) const
|
||||
{
|
||||
if (orders.x44_)
|
||||
if (orders.x44_singleAdvance)
|
||||
{
|
||||
std::shared_ptr<CAnimTreeNode> tree =
|
||||
VGetAnimationTree(animSys, CMetaAnimTreeBuildOrders::NoSpecialOrders());
|
||||
if (orders.x44_->IsTime() || orders.x44_->IsString())
|
||||
if (orders.x44_singleAdvance->IsTime() || orders.x44_singleAdvance->IsString())
|
||||
{
|
||||
CCharAnimTime time = GetTime(*orders.x44_, *tree);
|
||||
CCharAnimTime time = GetTime(*orders.x44_singleAdvance, *tree);
|
||||
AdvanceAnim(*tree, time);
|
||||
}
|
||||
return tree;
|
||||
|
|
|
@ -52,14 +52,14 @@ public:
|
|||
|
||||
struct CMetaAnimTreeBuildOrders
|
||||
{
|
||||
std::experimental::optional<CPreAdvanceIndicator> x0_;
|
||||
std::experimental::optional<CPreAdvanceIndicator> x44_;
|
||||
std::experimental::optional<CPreAdvanceIndicator> x0_recursiveAdvance;
|
||||
std::experimental::optional<CPreAdvanceIndicator> x44_singleAdvance;
|
||||
static CMetaAnimTreeBuildOrders NoSpecialOrders() { return {}; }
|
||||
static CMetaAnimTreeBuildOrders PreAdvanceForAll(const CPreAdvanceIndicator& ind)
|
||||
{
|
||||
CMetaAnimTreeBuildOrders ret;
|
||||
ret.x0_.emplace(ind);
|
||||
ret.x44_.emplace(ind);
|
||||
ret.x0_recursiveAdvance.emplace(ind);
|
||||
ret.x44_singleAdvance.emplace(ind);
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -664,11 +664,6 @@ bool CMetroidAreaCollider::MovingAABoxCollisionCheck_BoxVertexTri(const CCollisi
|
|||
{
|
||||
pointOut = float(d) * dir + point;
|
||||
normalOut = surf.GetNormal();
|
||||
if (normalOut.z > 100.f)
|
||||
{
|
||||
printf("");
|
||||
normalOut = surf.GetNormal();
|
||||
}
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1310,7 +1310,8 @@ void CBooRenderer::ReallyDrawPhazonSuitIndirectEffect(const zeus::CColor& vertCo
|
|||
const CTexture& indTex, const zeus::CColor& modColor,
|
||||
float scale, float offX, float offY)
|
||||
{
|
||||
m_phazonSuitFilter.draw(modColor, scale, offX * scale, offY * scale);
|
||||
float qScale = scale / 8.f; // Adjustment for URDE
|
||||
m_phazonSuitFilter.draw(modColor, scale, offX * qScale, offY * qScale);
|
||||
}
|
||||
|
||||
void CBooRenderer::ReallyDrawPhazonSuitEffect(const zeus::CColor& modColor /*, const CTexture& maskTex*/)
|
||||
|
|
|
@ -119,7 +119,7 @@ TShader<CCameraBlurFilter>::IDataBindingFactory* CCameraBlurFilter::Initialize(b
|
|||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
return new CCameraBlurFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -92,15 +92,15 @@ CColoredQuadFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
|||
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_AddPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_MultPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
||||
boo::BlendFactor::SrcColor, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
return new CColoredQuadFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -318,28 +318,28 @@ TShader<CElementGenShaders>::IDataBindingFactory* CElementGenShaders::Initialize
|
|||
m_texZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, false, boo::CullMode::None);
|
||||
m_texNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
|
||||
m_texZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
m_texNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
|
||||
m_texAdditiveZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
m_texAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
|
||||
m_texRedToAlphaZTest = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
|
@ -365,64 +365,64 @@ TShader<CElementGenShaders>::IDataBindingFactory* CElementGenShaders::Initialize
|
|||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false,
|
||||
true, false, boo::CullMode::None);
|
||||
true, true, boo::CullMode::None);
|
||||
m_texRedToAlphaNoZTestSub = ctx.newShaderPipeline(VS_METAL_TEX, FS_METAL_TEX_REDTOALPHA, nullptr, nullptr,
|
||||
m_vtxFormatTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::Subtract, boo::BlendFactor::Subtract,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||
true, false, boo::CullMode::None);
|
||||
true, true, boo::CullMode::None);
|
||||
|
||||
m_indTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, nullptr, nullptr,
|
||||
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
|
||||
m_indTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, nullptr, nullptr,
|
||||
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
m_indTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_INDTEX, nullptr, nullptr,
|
||||
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
|
||||
|
||||
m_cindTexZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, nullptr, nullptr,
|
||||
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
|
||||
m_cindTexNoZWrite = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, nullptr, nullptr,
|
||||
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
m_cindTexAdditive = ctx.newShaderPipeline(VS_METAL_INDTEX, FS_METAL_CINDTEX, nullptr, nullptr,
|
||||
m_vtxFormatIndTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
|
||||
|
||||
m_noTexZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, true, true, false, boo::CullMode::None);
|
||||
m_noTexNoZTestZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, true, true, false, boo::CullMode::None);
|
||||
m_noTexZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
m_noTexNoZTestNoZWrite = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
|
||||
m_noTexAdditiveZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
m_noTexAdditiveNoZTest = ctx.newShaderPipeline(VS_METAL_NOTEX, FS_METAL_NOTEX, nullptr, nullptr,
|
||||
m_vtxFormatNoTex, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
|
||||
return new struct MetalElementDataBindingFactory;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
namespace urde
|
||||
{
|
||||
|
||||
#define BLUR_SCALE (1.f / 32.f)
|
||||
|
||||
void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
|
||||
{
|
||||
if (!m_dataBind || indTex != m_indTex)
|
||||
|
@ -27,6 +29,7 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
|
|||
};
|
||||
m_blurVbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, blurVerts, sizeof(BlurVert), 4);
|
||||
|
||||
float aspect = g_Viewport.x8_width / float(g_Viewport.xc_height);
|
||||
struct Vert
|
||||
{
|
||||
zeus::CVector3f pos;
|
||||
|
@ -35,10 +38,10 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
|
|||
zeus::CVector2f maskUv;
|
||||
} verts[4] =
|
||||
{
|
||||
{{-1.f, 1.f, 0.f}, {0.01f, 0.99f}, {0.f, 1.f}, {0.f, 1.f}},
|
||||
{{-1.f, -1.f, 0.f}, {0.01f, 0.01f}, {0.f, 1.f}, {0.f, 1.f}},
|
||||
{{ 1.f, 1.f, 0.f}, {0.99f, 0.99f}, {0.f, 1.f}, {0.f, 1.f}},
|
||||
{{ 1.f, -1.f, 0.f}, {0.99f, 0.01f}, {0.f, 1.f}, {0.f, 1.f}}
|
||||
{{-1.f, 1.f, 0.f}, {0.01f, 0.99f}, {0.f, 4.f}, {0.f, 1.f}},
|
||||
{{-1.f, -1.f, 0.f}, {0.01f, 0.01f}, {0.f, 0.f}, {0.f, 0.f}},
|
||||
{{ 1.f, 1.f, 0.f}, {0.99f, 0.99f}, {aspect * 4.f, 4.f}, {1.f, 1.f}},
|
||||
{{ 1.f, -1.f, 0.f}, {0.99f, 0.01f}, {aspect * 4.f, 0.f}, {1.f, 0.f}}
|
||||
};
|
||||
m_vbo = ctx.newStaticBuffer(boo::BufferUse::Vertex, verts, sizeof(Vert), 4);
|
||||
|
||||
|
@ -54,7 +57,8 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
|
|||
rect.x10_height = g_Viewport.xc_height;
|
||||
|
||||
/* X Pass */
|
||||
zeus::CVector4f blurDir = zeus::CVector4f{2.f * radius / g_Viewport.x8_width, 0.f, 0.f, 0.f};
|
||||
zeus::CVector4f blurDir = zeus::CVector4f{g_Viewport.xc_height / float(g_Viewport.x8_width) *
|
||||
radius * BLUR_SCALE, 0.f, 0.f, 0.f};
|
||||
m_uniBufBlurX->load(&blurDir, sizeof(zeus::CVector4f));
|
||||
|
||||
CGraphics::SetShaderDataBinding(m_dataBindBlurX);
|
||||
|
@ -62,7 +66,7 @@ void CPhazonSuitFilter::drawBlurPasses(float radius, const CTexture* indTex)
|
|||
CGraphics::ResolveSpareTexture(rect, 2);
|
||||
|
||||
/* Y Pass */
|
||||
blurDir = zeus::CVector4f{0.f, 2.f * radius / g_Viewport.xc_height, 0.f, 0.f};
|
||||
blurDir = zeus::CVector4f{0.f, radius * BLUR_SCALE, 0.f, 0.f};
|
||||
m_uniBufBlurY->load(&blurDir, sizeof(zeus::CVector4f));
|
||||
|
||||
CGraphics::SetShaderDataBinding(m_dataBindBlurY);
|
||||
|
|
|
@ -59,10 +59,11 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING3 uniform sampler2D maskTexBlur;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" vec2 indUv = (texture(indTex, vtf.indUv).rg - vec2(0.5, 0.5)) * \n"
|
||||
" vec2 indUv = (texture(indTex, vtf.indUv).ra - vec2(0.5, 0.5)) * \n"
|
||||
" vtf.indScaleOff.xy + vtf.indScaleOff.zw;\n"
|
||||
" colorOut = vtf.color * texture(screenTex, indUv + vtf.screenUv) * \n"
|
||||
" (texture(maskTexBlur, vtf.maskUv).a - texture(maskTex, vtf.maskUv).a);\n"
|
||||
" float maskBlurAlpha = clamp(0.0, (texture(maskTexBlur, vtf.maskUv).a - texture(maskTex, vtf.maskUv).a) * 2.0, 1.0);\n"
|
||||
" colorOut = vtf.color * texture(screenTex, indUv + vtf.screenUv) * maskBlurAlpha;\n"
|
||||
" colorOut.a = vtf.color.a;\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
|
@ -84,8 +85,9 @@ BOO_GLSL_BINDING_HEAD
|
|||
"TBINDING2 uniform sampler2D maskTexBlur;\n"
|
||||
"void main()\n"
|
||||
"{\n"
|
||||
" colorOut = vtf.color * texture(screenTex, vtf.screenUv) * \n"
|
||||
" (texture(maskTexBlur, vtf.maskUv).a - texture(maskTex, vtf.maskUv).a);\n"
|
||||
" float maskBlurAlpha = clamp(0.0, (texture(maskTexBlur, vtf.maskUv).a - texture(maskTex, vtf.maskUv).a) * 2.0, 1.0);\n"
|
||||
" colorOut = vtf.color * texture(screenTex, vtf.screenUv) * maskBlurAlpha;\n"
|
||||
" colorOut.a = vtf.color.a;\n"
|
||||
"}\n";
|
||||
|
||||
static const char* BlurVS =
|
||||
|
@ -139,10 +141,10 @@ BOO_GLSL_BINDING_HEAD
|
|||
"\n"
|
||||
" sum += texture(maskTex, vtf.uv).a * 0.2270270270;\n"
|
||||
"\n"
|
||||
" sum += texture(maskTex, vtf.uv - 1.0 * vtf.blurDir).a * 0.1945945946;\n"
|
||||
" sum += texture(maskTex, vtf.uv - 2.0 * vtf.blurDir).a * 0.1216216216;\n"
|
||||
" sum += texture(maskTex, vtf.uv - 3.0 * vtf.blurDir).a * 0.0540540541;\n"
|
||||
" sum += texture(maskTex, vtf.uv - 4.0 * vtf.blurDir).a * 0.0162162162;\n"
|
||||
" sum += texture(maskTex, vtf.uv + 1.0 * vtf.blurDir).a * 0.1945945946;\n"
|
||||
" sum += texture(maskTex, vtf.uv + 2.0 * vtf.blurDir).a * 0.1216216216;\n"
|
||||
" sum += texture(maskTex, vtf.uv + 3.0 * vtf.blurDir).a * 0.0540540541;\n"
|
||||
" sum += texture(maskTex, vtf.uv + 4.0 * vtf.blurDir).a * 0.0162162162;\n"
|
||||
"\n"
|
||||
" colorOut = vec4(1.0, 1.0, 1.0, sum);\n"
|
||||
"}\n";
|
||||
|
@ -291,12 +293,12 @@ CPhazonSuitFilter::Initialize(boo::GLDataFactory::Context& ctx)
|
|||
{
|
||||
const char* uniNames[] = {"PhazonSuitUniform"};
|
||||
const char* texNames[] = {"screenTex", "indTex", "maskTex", "maskTexBlur"};
|
||||
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, 4, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, 4, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
texNames[1] = "maskTex";
|
||||
texNames[2] = "maskTexBlur";
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, 3, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, 3, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
uniNames[0] = "PhazonSuitBlurUniform";
|
||||
|
@ -333,10 +335,10 @@ CPhazonSuitFilter::Initialize(boo::VulkanDataFactory::Context& ctx)
|
|||
{nullptr, nullptr, boo::VertexSemantic::UV4}
|
||||
};
|
||||
s_BlurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
|
||||
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, s_VtxFmt, boo::BlendFactor::One,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::One,
|
||||
s_Pipeline = 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_BlurPipeline = ctx.newShaderPipeline(BlurVS, BlurFS, s_BlurVtxFmt, boo::BlendFactor::One,
|
||||
|
|
|
@ -35,8 +35,10 @@ static const char* VS =
|
|||
" vtf.color = color;\n"
|
||||
" vtf.indScaleOff = indScaleOff;\n"
|
||||
" vtf.screenUv = v.screenUvIn.xy;\n"
|
||||
" vtf.screenUv.y = 1.0 - vtf.screenUv.y;\n"
|
||||
" vtf.indUv = v.indUvIn.xy;\n"
|
||||
" vtf.maskUv = v.maskUvIn.xy;\n"
|
||||
" vtf.maskUv.y = 1.0 - vtf.maskUv.y;\n"
|
||||
" vtf.position = float4(v.posIn.xyz, 1.0);\n"
|
||||
" return vtf;\n"
|
||||
"}\n";
|
||||
|
@ -59,10 +61,10 @@ static const char* IndFS =
|
|||
"Texture2D maskTexBlur : register(t3);\n"
|
||||
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||
"{\n"
|
||||
" float2 indUv = (indTex.Sample(samp, vtf.indUv).rg - float2(0.5, 0.5)) * \n"
|
||||
" float2 indUv = (indTex.Sample(samp, vtf.indUv).ra - float2(0.5, 0.5)) * \n"
|
||||
" vtf.indScaleOff.xy + vtf.indScaleOff.zw;\n"
|
||||
" return vtf.color * screenTex.Sample(samp, indUv + vtf.screenUv) * \n"
|
||||
" (maskTexBlur.Sample(samp, vtf.maskUv).a - maskTex.Sample(samp, vtf.maskUv).a);\n"
|
||||
" float maskBlurAlpha = saturate((maskTexBlur.Sample(samp, vtf.maskUv).a - maskTex.Sample(samp, vtf.maskUv).a) * 2.0);\n"
|
||||
" return float4((vtf.color * screenTex.Sample(samp, indUv + vtf.screenUv) * maskBlurAlpha).rgb, vtf.color.a);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
|
@ -76,14 +78,14 @@ static const char* FS =
|
|||
" float2 maskUv : UV2;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SamplerState samp : register(s0);\n"
|
||||
"SamplerState samp : register(s2);\n"
|
||||
"Texture2D screenTex : register(t0);\n"
|
||||
"Texture2D maskTex : register(t1);\n"
|
||||
"Texture2D maskTexBlur : register(t2);\n"
|
||||
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||
"{\n"
|
||||
" return vtf.color * screenTex.Sample(samp, vtf.screenUv) * \n"
|
||||
" (maskTexBlur.Sample(samp, vtf.maskUv).a - maskTex.Sample(samp, vtf.maskUv).a);\n"
|
||||
" float maskBlurAlpha = saturate((maskTexBlur.Sample(samp, vtf.maskUv).a - maskTex.Sample(samp, vtf.maskUv).a) * 2.0);\n"
|
||||
" return float4((vtf.color * screenTex.Sample(samp, vtf.screenUv) * maskBlurAlpha).rgb, vtf.color.a);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* BlurVS =
|
||||
|
@ -108,6 +110,7 @@ static const char* BlurVS =
|
|||
"{\n"
|
||||
" VertToFrag vtf;\n"
|
||||
" vtf.uv = v.uvIn.xy;\n"
|
||||
" vtf.uv.y = 1.0 - vtf.uv.y;\n"
|
||||
" vtf.blurDir = blurDir.xy;\n"
|
||||
" vtf.position = float4(v.posIn.xyz, 1.0);\n"
|
||||
" return vtf;\n"
|
||||
|
@ -121,7 +124,7 @@ static const char* BlurFS =
|
|||
" float2 blurDir : BLURDIR;\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"SamplerState samp : register(s0);\n"
|
||||
"SamplerState samp : register(s2);\n"
|
||||
"Texture2D maskTex : register(t0);\n"
|
||||
"float4 main(in VertToFrag vtf) : SV_Target0\n"
|
||||
"{\n"
|
||||
|
@ -137,10 +140,10 @@ static const char* BlurFS =
|
|||
"\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv).a * 0.2270270270;\n"
|
||||
"\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv - 1.0 * vtf.blurDir).a * 0.1945945946;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv - 2.0 * vtf.blurDir).a * 0.1216216216;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv - 3.0 * vtf.blurDir).a * 0.0540540541;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv - 4.0 * vtf.blurDir).a * 0.0162162162;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv + 1.0 * vtf.blurDir).a * 0.1945945946;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv + 2.0 * vtf.blurDir).a * 0.1216216216;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv + 3.0 * vtf.blurDir).a * 0.0540540541;\n"
|
||||
" sum += maskTex.Sample(samp, vtf.uv + 4.0 * vtf.blurDir).a * 0.0162162162;\n"
|
||||
"\n"
|
||||
" return float4(1.0, 1.0, 1.0, sum);\n"
|
||||
"}\n";
|
||||
|
|
|
@ -38,8 +38,10 @@ static const char* VS =
|
|||
" vtf.color = psu.color;\n"
|
||||
" vtf.indScaleOff = psu.indScaleOff;\n"
|
||||
" vtf.screenUv = v.screenUvIn.xy;\n"
|
||||
" vtf.screenUv.y = 1.0 - vtf.screenUv.y;\n"
|
||||
" vtf.indUv = v.indUvIn.xy;\n"
|
||||
" vtf.maskUv = v.maskUvIn.xy;\n"
|
||||
" vtf.maskUv.y = 1.0 - vtf.maskUv.y;\n"
|
||||
" vtf.position = float4(v.posIn.xyz, 1.0);\n"
|
||||
" return vtf;\n"
|
||||
"}\n";
|
||||
|
@ -64,16 +66,16 @@ static const char* IndFS =
|
|||
" texture2d<float> maskTex [[ texture(2) ]],\n"
|
||||
" texture2d<float> maskTexBlur [[ texture(3) ]])\n"
|
||||
"{\n"
|
||||
" float2 indUv = (indTex.sample(samp, vtf.indUv).rg - float2(0.5, 0.5)) * \n"
|
||||
" float2 indUv = (indTex.sample(samp, vtf.indUv).ra - float2(0.5, 0.5)) * \n"
|
||||
" vtf.indScaleOff.xy + vtf.indScaleOff.zw;\n"
|
||||
" return vtf.color * screenTex.sample(samp, indUv + vtf.screenUv) * \n"
|
||||
" (maskTexBlur.sample(samp, vtf.maskUv).a - maskTex.sample(samp, vtf.maskUv).a);\n"
|
||||
" float maskBlurAlpha = saturate((maskTexBlur.sample(samp, vtf.maskUv).a - maskTex.sample(samp, vtf.maskUv).a) * 2.0);\n"
|
||||
" return float4((vtf.color * screenTex.sample(samp, indUv + vtf.screenUv) * maskBlurAlpha).rgb, vtf.color.a);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* FS =
|
||||
"#include <metal_stdlib>\n"
|
||||
"using namespace metal;\n"
|
||||
"constexpr sampler samp(address::repeat, filter::linear);\n"
|
||||
"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n"
|
||||
"struct VertToFrag\n"
|
||||
"{\n"
|
||||
" float4 color;\n"
|
||||
|
@ -88,8 +90,8 @@ static const char* FS =
|
|||
" texture2d<float> maskTex [[ texture(1) ]],\n"
|
||||
" texture2d<float> maskTexBlur [[ texture(2) ]])\n"
|
||||
"{\n"
|
||||
" return vtf.color * screenTex.sample(samp, vtf.screenUv) * \n"
|
||||
" (maskTexBlur.sample(samp, vtf.maskUv).a - maskTex.sample(samp, vtf.maskUv).a);\n"
|
||||
" float maskBlurAlpha = saturate((maskTexBlur.sample(samp, vtf.maskUv).a - maskTex.sample(samp, vtf.maskUv).a) * 2.0);\n"
|
||||
" return float4((vtf.color * screenTex.sample(samp, vtf.screenUv) * maskBlurAlpha).rgb, vtf.color.a);\n"
|
||||
"}\n";
|
||||
|
||||
static const char* BlurVS =
|
||||
|
@ -117,6 +119,7 @@ static const char* BlurVS =
|
|||
"{\n"
|
||||
" VertToFrag vtf;\n"
|
||||
" vtf.uv = v.uvIn.xy;\n"
|
||||
" vtf.uv.y = 1.0 - vtf.uv.y;\n"
|
||||
" vtf.blurDir = psu.blurDir.xy;\n"
|
||||
" vtf.position = float4(v.posIn.xyz, 1.0);\n"
|
||||
" return vtf;\n"
|
||||
|
@ -125,7 +128,7 @@ static const char* BlurVS =
|
|||
static const char* BlurFS =
|
||||
"#include <metal_stdlib>\n"
|
||||
"using namespace metal;\n"
|
||||
"constexpr sampler samp(address::repeat, filter::linear);\n"
|
||||
"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n"
|
||||
"struct VertToFrag\n"
|
||||
"{\n"
|
||||
" float4 position [[ position ]];\n"
|
||||
|
@ -148,10 +151,10 @@ static const char* BlurFS =
|
|||
"\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv).a * 0.2270270270;\n"
|
||||
"\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv - 1.0 * vtf.blurDir).a * 0.1945945946;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv - 2.0 * vtf.blurDir).a * 0.1216216216;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv - 3.0 * vtf.blurDir).a * 0.0540540541;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv - 4.0 * vtf.blurDir).a * 0.0162162162;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv + 1.0 * vtf.blurDir).a * 0.1945945946;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv + 2.0 * vtf.blurDir).a * 0.1216216216;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv + 3.0 * vtf.blurDir).a * 0.0540540541;\n"
|
||||
" sum += maskTex.sample(samp, vtf.uv + 4.0 * vtf.blurDir).a * 0.0162162162;\n"
|
||||
"\n"
|
||||
" return float4(1.0, 1.0, 1.0, sum);\n"
|
||||
"}\n";
|
||||
|
@ -238,11 +241,11 @@ CPhazonSuitFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
|||
};
|
||||
s_BlurVtxFmt = ctx.newVertexFormat(2, BlurVtxVmt);
|
||||
s_IndPipeline = ctx.newShaderPipeline(VS, IndFS, nullptr, nullptr, s_VtxFmt,
|
||||
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, s_VtxFmt,
|
||||
CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||
CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_BlurPipeline = ctx.newShaderPipeline(BlurVS, BlurFS, nullptr, nullptr, s_BlurVtxFmt,
|
||||
|
|
|
@ -96,15 +96,15 @@ CScanLinesFilter::Initialize(boo::MetalDataFactory::Context& ctx)
|
|||
s_AlphaPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_AddPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
s_MultPipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::Zero,
|
||||
boo::BlendFactor::SrcColor, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
return new CScanLinesFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ TShader<CSpaceWarpFilter>::IDataBindingFactory* CSpaceWarpFilter::Initialize(boo
|
|||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
return new CSpaceWarpFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,12 @@ namespace urde
|
|||
boo::ObjToken<boo::IVertexFormat> CTextSupportShader::s_TextVtxFmt;
|
||||
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_TextAlphaPipeline;
|
||||
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_TextAddPipeline;
|
||||
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_TextAddOverdrawPipeline;
|
||||
|
||||
boo::ObjToken<boo::IVertexFormat> CTextSupportShader::s_ImageVtxFmt;
|
||||
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_ImageAlphaPipeline;
|
||||
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_ImageAddPipeline;
|
||||
boo::ObjToken<boo::IShaderPipeline> CTextSupportShader::s_ImageAddOverdrawPipeline;
|
||||
|
||||
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance> CTextSupportShader::s_CharInsts;
|
||||
hecl::VertexBufferPool<CTextSupportShader::ImageInstance> CTextSupportShader::s_ImgInsts;
|
||||
|
@ -64,9 +66,11 @@ void CTextSupportShader::Shutdown()
|
|||
s_TextVtxFmt.reset();
|
||||
s_TextAlphaPipeline.reset();
|
||||
s_TextAddPipeline.reset();
|
||||
s_TextAddOverdrawPipeline.reset();
|
||||
s_ImageVtxFmt.reset();
|
||||
s_ImageAlphaPipeline.reset();
|
||||
s_ImageAddPipeline.reset();
|
||||
s_ImageAddOverdrawPipeline.reset();
|
||||
|
||||
s_CharInsts.doDestroy();
|
||||
s_ImgInsts.doDestroy();
|
||||
|
|
|
@ -23,10 +23,12 @@ class CTextSupportShader
|
|||
static boo::ObjToken<boo::IVertexFormat> s_TextVtxFmt;
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_TextAlphaPipeline;
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_TextAddPipeline;
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_TextAddOverdrawPipeline;
|
||||
|
||||
static boo::ObjToken<boo::IVertexFormat> s_ImageVtxFmt;
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_ImageAlphaPipeline;
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_ImageAddPipeline;
|
||||
static boo::ObjToken<boo::IShaderPipeline> s_ImageAddOverdrawPipeline;
|
||||
|
||||
struct Uniform
|
||||
{
|
||||
|
@ -67,9 +69,9 @@ public:
|
|||
case CGuiWidget::EGuiModelDrawFlags::Shadeless:
|
||||
case CGuiWidget::EGuiModelDrawFlags::Opaque:
|
||||
case CGuiWidget::EGuiModelDrawFlags::Alpha:
|
||||
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||
return s_TextAlphaPipeline;
|
||||
case CGuiWidget::EGuiModelDrawFlags::Additive:
|
||||
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||
return s_TextAddPipeline;
|
||||
default:
|
||||
return {};
|
||||
|
@ -83,15 +85,25 @@ public:
|
|||
case CGuiWidget::EGuiModelDrawFlags::Shadeless:
|
||||
case CGuiWidget::EGuiModelDrawFlags::Opaque:
|
||||
case CGuiWidget::EGuiModelDrawFlags::Alpha:
|
||||
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||
return s_ImageAlphaPipeline;
|
||||
case CGuiWidget::EGuiModelDrawFlags::Additive:
|
||||
case CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||
return s_ImageAddPipeline;
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> GetTextAdditiveOverdrawPipeline()
|
||||
{
|
||||
return s_TextAddOverdrawPipeline;
|
||||
}
|
||||
|
||||
static boo::ObjToken<boo::IShaderPipeline> GetImageAdditiveOverdrawPipeline()
|
||||
{
|
||||
return s_ImageAddOverdrawPipeline;
|
||||
}
|
||||
|
||||
static void UpdateBuffers()
|
||||
{
|
||||
s_CharInsts.updateBuffers();
|
||||
|
|
|
@ -118,6 +118,9 @@ CTextSupportShader::Initialize(boo::GLDataFactory::Context& ctx)
|
|||
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_TextAddOverdrawPipeline = ctx.newShaderPipeline(TextVS, TextFS, 1, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
|
@ -125,6 +128,9 @@ CTextSupportShader::Initialize(boo::GLDataFactory::Context& ctx)
|
|||
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_ImageAddOverdrawPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, 1, texNames, 1, uniNames, boo::BlendFactor::One,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -134,8 +140,10 @@ void CTextSupportShader::Shutdown<boo::GLDataFactory>()
|
|||
{
|
||||
s_TextAlphaPipeline.reset();
|
||||
s_TextAddPipeline.reset();
|
||||
s_TextAddOverdrawPipeline.reset();
|
||||
s_ImageAlphaPipeline.reset();
|
||||
s_ImageAddPipeline.reset();
|
||||
s_ImageAddOverdrawPipeline.reset();
|
||||
}
|
||||
|
||||
#if BOO_HAS_VULKAN
|
||||
|
@ -163,6 +171,9 @@ CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
|||
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_TextAddOverdrawPipeline = ctx.newShaderPipeline(TextVS, TextFS, s_TextVtxFmt, boo::BlendFactor::One,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
boo::VertexElementDescriptor ImageVtxVmt[] =
|
||||
{
|
||||
|
@ -183,6 +194,9 @@ CTextSupportShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
|||
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_ImageAddOverdrawPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, s_ImageVtxFmt, boo::BlendFactor::One,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -193,9 +207,11 @@ void CTextSupportShader::Shutdown<boo::VulkanDataFactory>()
|
|||
s_TextVtxFmt.reset();
|
||||
s_TextAlphaPipeline.reset();
|
||||
s_TextAddPipeline.reset();
|
||||
s_TextAddOverdrawPipeline.reset();
|
||||
s_ImageVtxFmt.reset();
|
||||
s_ImageAlphaPipeline.reset();
|
||||
s_ImageAddPipeline.reset();
|
||||
s_ImageAddOverdrawPipeline.reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -134,6 +134,10 @@ CTextSupportShader::Initialize(boo::ID3DDataFactory::Context& ctx)
|
|||
s_TextVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_TextAddOverdrawPipeline = ctx.newShaderPipeline(TextVS, TextFS, nullptr, nullptr, nullptr,
|
||||
s_TextVtxFmt, boo::BlendFactor::One,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
boo::VertexElementDescriptor ImageVtxVmt[] =
|
||||
{
|
||||
|
@ -156,6 +160,10 @@ CTextSupportShader::Initialize(boo::ID3DDataFactory::Context& ctx)
|
|||
s_ImageVtxFmt, boo::BlendFactor::SrcAlpha,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_ImageAddOverdrawPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, nullptr, nullptr, nullptr,
|
||||
s_ImageVtxFmt, boo::BlendFactor::One,
|
||||
boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -166,8 +174,10 @@ void CTextSupportShader::Shutdown<boo::ID3DDataFactory>()
|
|||
s_TextVtxFmt.reset();
|
||||
s_TextAlphaPipeline.reset();
|
||||
s_TextAddPipeline.reset();
|
||||
s_TextAddOverdrawPipeline.reset();
|
||||
s_ImageVtxFmt.reset();
|
||||
s_ImageAlphaPipeline.reset();
|
||||
s_ImageAddPipeline.reset();
|
||||
s_ImageAddOverdrawPipeline.reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,11 +141,15 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
|||
s_TextAlphaPipeline = ctx.newShaderPipeline(TextVS, TextFS, nullptr, nullptr,
|
||||
s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_TextAddPipeline = ctx.newShaderPipeline(TextVS, TextFS, nullptr, nullptr,
|
||||
s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_TextAddOverdrawPipeline = ctx.newShaderPipeline(TextVS, TextFS, nullptr, nullptr,
|
||||
s_TextVtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::One, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
boo::VertexElementDescriptor ImageVtxVmt[] =
|
||||
{
|
||||
|
@ -163,11 +167,15 @@ CTextSupportShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
|||
s_ImageAlphaPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, nullptr, nullptr,
|
||||
s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_ImageAddPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, nullptr, nullptr,
|
||||
s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
s_ImageAddOverdrawPipeline = ctx.newShaderPipeline(ImgVS, ImgFS, nullptr, nullptr,
|
||||
s_ImageVtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::One, boo::BlendFactor::One, boo::Primitive::TriStrips,
|
||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::None);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -178,9 +186,11 @@ void CTextSupportShader::Shutdown<boo::MetalDataFactory>()
|
|||
s_TextVtxFmt.reset();
|
||||
s_TextAlphaPipeline.reset();
|
||||
s_TextAddPipeline.reset();
|
||||
s_TextAddOverdrawPipeline.reset();
|
||||
s_ImageVtxFmt.reset();
|
||||
s_ImageAlphaPipeline.reset();
|
||||
s_ImageAddPipeline.reset();
|
||||
s_ImageAddOverdrawPipeline.reset();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -114,7 +114,7 @@ TShader<CThermalColdFilter>::IDataBindingFactory* CThermalColdFilter::Initialize
|
|||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips,
|
||||
boo::ZTest::None, false, true, true, boo::CullMode::None);
|
||||
boo::ZTest::None, false, true, false, boo::CullMode::None);
|
||||
return new CThermalColdFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ TShader<CThermalHotFilter>::IDataBindingFactory* CThermalHotFilter::Initialize(b
|
|||
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||
boo::BlendFactor::DstAlpha, boo::BlendFactor::InvDstAlpha,
|
||||
boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||
true, true, boo::CullMode::None);
|
||||
true, false, boo::CullMode::None);
|
||||
return new CThermalHotFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ TShader<CXRayBlurFilter>::IDataBindingFactory* CXRayBlurFilter::Initialize(boo::
|
|||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||
s_VtxFmt, CGraphics::g_ViewportSamples, boo::BlendFactor::One,
|
||||
boo::BlendFactor::Zero, boo::Primitive::TriStrips, boo::ZTest::None, false,
|
||||
true, true, boo::CullMode::None);
|
||||
true, false, boo::CullMode::None);
|
||||
return new CXRayBlurFilterMetalDataBindingFactory;
|
||||
}
|
||||
|
||||
|
|
|
@ -117,9 +117,10 @@ void CHudEnergyInterface::Update(float dt, float energyLowPulse)
|
|||
zeus::CColor emptyColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarEmptyLowEnergy() : barColors.empty;
|
||||
zeus::CColor filledColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarFilledLowEnergy() : barColors.filled;
|
||||
zeus::CColor shadowColor = x1c_27_energyLow ? g_tweakGuiColors->GetEnergyBarShadowLowEnergy() : barColors.shadow;
|
||||
x2c_energybart01_energybar->SetFilledColor(zeus::CColor::lerp(
|
||||
zeus::CColor::lerp(filledColor, g_tweakGuiColors->GetEnergyBarFlashColor(), x8_flashMag),
|
||||
zeus::CColor(1.f, 0.8f, 0.4f, 1.f), energyLowPulse));
|
||||
zeus::CColor useFillColor = zeus::CColor::lerp(filledColor, g_tweakGuiColors->GetEnergyBarFlashColor(), x8_flashMag);
|
||||
if (x1c_27_energyLow)
|
||||
useFillColor = zeus::CColor::lerp(useFillColor, zeus::CColor(1.f, 0.8f, 0.4f, 1.f), energyLowPulse);
|
||||
x2c_energybart01_energybar->SetFilledColor(useFillColor);
|
||||
x2c_energybart01_energybar->SetShadowColor(shadowColor);
|
||||
x2c_energybart01_energybar->SetEmptyColor(emptyColor);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,12 @@ void CTextRenderBuffer::CommitResources()
|
|||
{
|
||||
m_uniBuf = CTextSupportShader::s_Uniforms.allocateBlock(CGraphics::g_BooFactory);
|
||||
auto uBufInfo = m_uniBuf.getBufferInfo();
|
||||
decltype(uBufInfo) uBufInfo2;
|
||||
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
|
||||
{
|
||||
m_uniBuf2 = CTextSupportShader::s_Uniforms.allocateBlock(CGraphics::g_BooFactory);
|
||||
uBufInfo2 = m_uniBuf2.getBufferInfo();
|
||||
}
|
||||
|
||||
for (BooFontCharacters& chs : m_fontCharacters)
|
||||
{
|
||||
|
@ -94,6 +100,16 @@ void CTextRenderBuffer::CommitResources()
|
|||
vFmt, nullptr, iBufInfo.first.get(), nullptr,
|
||||
1, uniforms, unistages, unioffs,
|
||||
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second);
|
||||
|
||||
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
|
||||
{
|
||||
uniforms[0] = uBufInfo2.first.get();
|
||||
unioffs[0] = size_t(uBufInfo2.second);
|
||||
chs.m_dataBinding2 = ctx.newShaderDataBinding(CTextSupportShader::GetTextAdditiveOverdrawPipeline(),
|
||||
vFmt, nullptr, iBufInfo.first.get(), nullptr,
|
||||
1, uniforms, unistages, unioffs,
|
||||
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second);
|
||||
}
|
||||
}
|
||||
|
||||
for (BooImage& img : m_images)
|
||||
|
@ -134,6 +150,21 @@ void CTextRenderBuffer::CommitResources()
|
|||
1, uniforms, unistages, unioffs,
|
||||
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second));
|
||||
}
|
||||
|
||||
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
|
||||
{
|
||||
uniforms[0] = uBufInfo2.first.get();
|
||||
unioffs[0] = size_t(uBufInfo2.second);
|
||||
img.m_dataBinding2.reserve(img.m_imageDef.x4_texs.size());
|
||||
for (TToken<CTexture>& tex : img.m_imageDef.x4_texs)
|
||||
{
|
||||
boo::ObjToken<boo::ITexture> texs[] = {tex->GetBooTexture()};
|
||||
img.m_dataBinding2.push_back(ctx.newShaderDataBinding(CTextSupportShader::GetImageAdditiveOverdrawPipeline(),
|
||||
vFmt, nullptr, iBufInfo.first.get(), nullptr,
|
||||
1, uniforms, unistages, unioffs,
|
||||
unisizes, 1, texs, nullptr, nullptr, 0, iBufInfo.second));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
@ -166,6 +197,13 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
|
|||
|
||||
const_cast<CTextRenderBuffer*>(this)->m_uniBuf.access() =
|
||||
CTextSupportShader::Uniform{mat, col};
|
||||
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
|
||||
{
|
||||
zeus::CColor colSq = col * col;
|
||||
colSq.a = col.a;
|
||||
const_cast<CTextRenderBuffer*>(this)->m_uniBuf2.access() =
|
||||
CTextSupportShader::Uniform{mat, colSq};
|
||||
}
|
||||
|
||||
for (const BooFontCharacters& chs : m_fontCharacters)
|
||||
{
|
||||
|
@ -180,6 +218,11 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
|
|||
}
|
||||
CGraphics::SetShaderDataBinding(chs.m_dataBinding);
|
||||
CGraphics::DrawInstances(0, 4, chs.m_charData.size());
|
||||
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
|
||||
{
|
||||
CGraphics::SetShaderDataBinding(chs.m_dataBinding2);
|
||||
CGraphics::DrawInstances(0, 4, chs.m_charData.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -193,6 +236,11 @@ void CTextRenderBuffer::Render(const zeus::CColor& col, float time) const
|
|||
int idx = int(img.m_imageDef.x0_fps * time) % img.m_dataBinding.size();
|
||||
CGraphics::SetShaderDataBinding(img.m_dataBinding[idx]);
|
||||
CGraphics::DrawInstances(0, 4, 1);
|
||||
if (m_drawFlags == CGuiWidget::EGuiModelDrawFlags::AlphaAdditiveOverdraw)
|
||||
{
|
||||
CGraphics::SetShaderDataBinding(img.m_dataBinding2[idx]);
|
||||
CGraphics::DrawInstances(0, 4, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -67,12 +67,14 @@ private:
|
|||
#else
|
||||
/* Boo-specific text-rendering functionality */
|
||||
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf;
|
||||
hecl::UniformBufferPool<CTextSupportShader::Uniform>::Token m_uniBuf2;
|
||||
|
||||
struct BooFontCharacters
|
||||
{
|
||||
TLockedToken<CRasterFont> m_font;
|
||||
hecl::VertexBufferPool<CTextSupportShader::CharacterInstance>::Token m_instBuf;
|
||||
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding;
|
||||
boo::ObjToken<boo::IShaderDataBinding> m_dataBinding2;
|
||||
std::vector<CTextSupportShader::CharacterInstance> m_charData;
|
||||
u32 m_charCount = 0;
|
||||
bool m_dirty = true;
|
||||
|
@ -86,6 +88,7 @@ private:
|
|||
CFontImageDef m_imageDef;
|
||||
hecl::VertexBufferPool<CTextSupportShader::ImageInstance>::Token m_instBuf;
|
||||
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding;
|
||||
std::vector<boo::ObjToken<boo::IShaderDataBinding>> m_dataBinding2;
|
||||
CTextSupportShader::ImageInstance m_imageData;
|
||||
bool m_dirty = true;
|
||||
BooImage(const CFontImageDef& imgDef, const zeus::CVector2i& offset);
|
||||
|
|
|
@ -75,9 +75,9 @@ CInventoryScreen::CInventoryScreen(const CStateManager& mgr, CGuiFrame& frame, c
|
|||
: CPauseScreenBase(mgr, frame, pauseStrg)
|
||||
{
|
||||
CPlayerState& playerState = *mgr.GetPlayerState();
|
||||
x19c_samusDoll = std::make_unique<CSamusDoll>(suitDgrp, ballDgrp,
|
||||
CPlayerState::EPlayerSuit(int(playerState.GetCurrentSuit()) +
|
||||
playerState.IsFusionEnabled() * 4),
|
||||
x19c_samusDoll = std::make_unique<CSamusDoll>(suitDgrp, ballDgrp, CPlayerState::EPlayerSuit::Phazon
|
||||
/*CPlayerState::EPlayerSuit(int(playerState.GetCurrentSuit()) +
|
||||
playerState.IsFusionEnabled() * 4)*/,
|
||||
playerState.GetCurrentBeam(),
|
||||
playerState.HasPowerUp(CPlayerState::EItemType::SpiderBall),
|
||||
playerState.HasPowerUp(CPlayerState::EItemType::GrappleBeam));
|
||||
|
|
|
@ -120,6 +120,8 @@ CSamusDoll::CSamusDoll(const CDependencyGroup& suitDgrp, const CDependencyGroup&
|
|||
bool hasSpiderBall, bool hasGrappleBeam)
|
||||
: x44_suit(suit), x48_beam(beam)
|
||||
{
|
||||
x70_fixedRot.rotateZ(M_PIF);
|
||||
x90_userInterpRot = xb0_userRot = x70_fixedRot;
|
||||
x1d4_spiderBallGlass = g_SimplePool->GetObj(SpiderBallGlassModels[int(suit)].first);
|
||||
x1e0_ballMatIdx = hasSpiderBall ? SpiderBallCharacters[int(suit)].second : BallCharacters[int(suit)].second;
|
||||
x1e4_glassMatIdx = SpiderBallGlassModels[int(suit)].second;
|
||||
|
@ -398,7 +400,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x1f4_invBeam->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha);
|
||||
x1f4_invBeam->Draw(flags);
|
||||
|
||||
|
@ -431,7 +433,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
|
||||
x20c_invGrappleBeam->GetInstance().ActivateLights(x23c_lights);
|
||||
CModelFlags flags = {};
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha);
|
||||
x20c_invGrappleBeam->Draw(flags);
|
||||
|
||||
|
@ -445,7 +447,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
|
||||
x218_invFins->GetInstance().ActivateLights(x23c_lights);
|
||||
CModelFlags flags = {};
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor(1.f, alpha);
|
||||
x218_invFins->Draw(flags);
|
||||
|
||||
|
@ -472,7 +474,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha * ballAlpha;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
@ -523,7 +525,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
@ -533,16 +535,16 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
flags.x4_color.a = x6c_ballPulseFactor * alpha * itemPulse;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
}
|
||||
}
|
||||
|
||||
if (phazonSuit && alpha > 0.1f)
|
||||
{
|
||||
float radius = zeus::clamp(0.2f, (10.f - (xc0_userZoom >= 0.f ? xc0_userZoom : -xc0_userZoom)) / 20.f, 1.f);
|
||||
float offset = std::sin(x260_phazonOffsetAngle);
|
||||
zeus::CColor color = g_tweakGuiColors->GetPauseBlurFilterColor();
|
||||
color.a = alpha;
|
||||
g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, alpha), x250_phazonIndirectTexture,
|
||||
color, radius, 0.1f, offset, offset);
|
||||
}
|
||||
if (phazonSuit && alpha > 0.1f)
|
||||
{
|
||||
float radius = zeus::clamp(0.2f, (10.f - (xc0_userZoom >= 0.f ? xc0_userZoom : -xc0_userZoom)) / 20.f, 1.f);
|
||||
float offset = std::sin(x260_phazonOffsetAngle);
|
||||
zeus::CColor color = g_tweakGuiColors->GetPauseBlurFilterColor();
|
||||
color.a = alpha;
|
||||
g_Renderer->DrawPhazonSuitIndirectEffect(zeus::CColor(0.1f, alpha), x250_phazonIndirectTexture,
|
||||
color, radius, 0.1f, offset, offset);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -553,7 +555,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha;
|
||||
x184_ballModelData->Render(mgr, x10_xf, x24c_actorLights.get(), flags);
|
||||
|
@ -596,7 +598,7 @@ void CSamusDoll::Draw(const CStateManager& mgr, float alpha)
|
|||
flags.x4_color = zeus::CColor::skWhite;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
||||
flags.m_extendedShader = EExtendedShader::Lighting;
|
||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
||||
flags.x4_color = zeus::CColor::skWhite;
|
||||
flags.x4_color.a = alpha;
|
||||
x1d4_spiderBallGlass->Draw(flags);
|
||||
|
@ -726,16 +728,15 @@ void CSamusDoll::SetRotation(float xDelta, float zDelta, float dt)
|
|||
float angXCenter = angX;
|
||||
if (angXCenter > M_PIF)
|
||||
angXCenter -= 2.f * M_PIF;
|
||||
angX = zeus::clamp(-M_PIF / 2.f, angXCenter, M_PIF / 2.f);
|
||||
angXCenter = zeus::clamp(-1.555f, angXCenter, 1.555f);
|
||||
|
||||
float angZCenter = angZ;
|
||||
if (angZCenter > M_PIF)
|
||||
angZCenter -= 2.f * M_PIF;
|
||||
angZ = zeus::clamp(-M_PIF / 2.f, angZCenter, M_PIF / 2.f);
|
||||
|
||||
zeus::CQuaternion quat;
|
||||
quat.rotateZ(angZ);
|
||||
quat.rotateX(angX);
|
||||
quat.rotateZ(angZCenter);
|
||||
quat.rotateX(angXCenter);
|
||||
xb0_userRot = quat;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,26 @@ void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateMana
|
|||
CEntity::AcceptScriptMsg(msg, uid, mgr);
|
||||
}
|
||||
|
||||
void CActor::PreRender(CStateManager&, const zeus::CFrustum&)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CActor::AddToRenderer(const zeus::CFrustum&, const CStateManager&) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CActor::Render(const CStateManager&) const
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool CActor::CanRenderUnsorted(const CStateManager&) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void CActor::CalculateRenderBounds()
|
||||
{
|
||||
if (x64_modelData && (x64_modelData->AnimationData() || x64_modelData->GetNormalModel()))
|
||||
|
|
|
@ -109,10 +109,10 @@ public:
|
|||
xe7_29_actorActive = active;
|
||||
CEntity::SetActive(active);
|
||||
}
|
||||
virtual void PreRender(CStateManager&, const zeus::CFrustum&) {}
|
||||
virtual void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const {}
|
||||
virtual void Render(const CStateManager&) const {}
|
||||
virtual bool CanRenderUnsorted(const CStateManager&) const { return false; }
|
||||
virtual void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||
virtual void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
||||
virtual void Render(const CStateManager&) const;
|
||||
virtual bool CanRenderUnsorted(const CStateManager&) const;
|
||||
virtual void CalculateRenderBounds();
|
||||
virtual CHealthInfo* HealthInfo(CStateManager&);
|
||||
virtual const CDamageVulnerability* GetDamageVulnerability() const;
|
||||
|
|
|
@ -116,7 +116,7 @@ void CPlayerCameraBob::UpdateViewWander(float dt, CStateManager& mgr)
|
|||
xb0_wanderPitches[(xcc_wanderIndex + 2) & 3],
|
||||
xb0_wanderPitches[(xcc_wanderIndex + 3) & 3], dt) *
|
||||
x100_wanderMagnitude));
|
||||
xd0_viewWanderXf = zeus::lookAt(pt, zeus::CVector3f::skZero, zeus::CVector3f::skUp) * orient;
|
||||
xd0_viewWanderXf = zeus::lookAt(zeus::CVector3f::skZero, pt, zeus::CVector3f::skUp) * orient;
|
||||
|
||||
xc4_wanderTime = (xc8_viewWanderSpeed * xc4_wanderTime) + dt;
|
||||
if (xc4_wanderTime > 1.f)
|
||||
|
|
|
@ -39,7 +39,7 @@ public:
|
|||
void PreRender(CStateManager&, const zeus::CFrustum&);
|
||||
zeus::CAABox GetSortingBounds(const CStateManager&) const;
|
||||
EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
||||
const CWeaponMode&, int) const;
|
||||
const CWeaponMode&, int) const;
|
||||
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
||||
void Touch(CActor&, CStateManager&);
|
||||
const CDamageVulnerability* GetDamageVulnerability() const { return &x268_damageVulnerability; }
|
||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
|||
Subproject commit 0d3f9f345c43bd85cc21945dcd62566e2701a971
|
||||
Subproject commit fac818d9a0b4cf41934cb9b7f780fe87cafba293
|
2
specter
2
specter
|
@ -1 +1 @@
|
|||
Subproject commit ff9755bc27083b7c3bb461a27131ec7f2b886144
|
||||
Subproject commit 1100f55788199d353e7310ed4427a655c7965255
|
Loading…
Reference in New Issue