Various bug fixes

This commit is contained in:
Jack Andersen 2018-11-17 18:01:29 -10:00
parent b099be63dd
commit 57c1196599
8 changed files with 56 additions and 9 deletions

View File

@ -38,7 +38,6 @@ public:
virtual void ProcessInput(const CFinalInput&, CStateManager& mgr) = 0;
virtual void Reset(const zeus::CTransform&, CStateManager& mgr) = 0;
const zeus::CTransform& GetTransform() const { return x34_transform; }
zeus::CMatrix4f GetPerspectiveMatrix() const;
zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f&) const;
zeus::CTransform ValidateCameraTransform(const zeus::CTransform&, const zeus::CTransform&);

View File

@ -48,9 +48,15 @@ void CModelShaders::LightingUniform::ActivateLights(const std::vector<CLight>& l
for (; curLight<URDE_MAX_LIGHTS ; ++curLight)
{
CModelShaders::Light& lightOut = lights[curLight];
lightOut.pos = zeus::CVector3f::skZero;
lightOut.dir = zeus::CVector3f::skDown;
lightOut.color = zeus::CColor::skClear;
lightOut.linAtt[0] = 1.f;
lightOut.linAtt[1] = 0.f;
lightOut.linAtt[2] = 0.f;
lightOut.angAtt[0] = 1.f;
lightOut.angAtt[1] = 0.f;
lightOut.angAtt[2] = 0.f;
}
}

View File

@ -7,15 +7,19 @@ namespace urde
static boo::ObjToken<boo::IShaderPipeline> s_AlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualZWritePipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaLEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddGEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddGEqualZWritePipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddLEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_SubtractPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_SubtractGEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_SubtractGEqualZWritePipeline;
static boo::ObjToken<boo::IShaderPipeline> s_SubtractLEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultGEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultGEqualZWritePipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultLEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_InvDstMultPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_InvDstMultGEqualPipeline;
@ -31,15 +35,19 @@ void CTexturedQuadFilter::Initialize()
{
s_AlphaPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAlpha{});
s_AlphaGEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAlphaGEqual{});
s_AlphaGEqualZWritePipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAlphaGEqualZWrite{});
s_AlphaLEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAlphaLEqual{});
s_AddPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAdd{});
s_AddGEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAddGEqual{});
s_AddGEqualZWritePipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAddGEqualZWrite{});
s_AddLEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterAddLEqual{});
s_SubtractPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterSubtract{});
s_SubtractGEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterSubtractGEqual{});
s_SubtractGEqualZWritePipeline = hecl::conv->convert(Shader_CTexturedQuadFilterSubtractGEqualZWrite{});
s_SubtractLEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterSubtractLEqual{});
s_MultPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterMult{});
s_MultGEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterMultGEqual{});
s_MultGEqualZWritePipeline = hecl::conv->convert(Shader_CTexturedQuadFilterMultGEqualZWrite{});
s_MultLEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterMultLEqual{});
s_InvDstMultPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterInvDstMult{});
s_InvDstMultGEqualPipeline = hecl::conv->convert(Shader_CTexturedQuadFilterInvDstMultGEqual{});
@ -50,15 +58,19 @@ void CTexturedQuadFilter::Shutdown()
{
s_AlphaPipeline.reset();
s_AlphaGEqualPipeline.reset();
s_AlphaGEqualZWritePipeline.reset();
s_AlphaLEqualPipeline.reset();
s_AddPipeline.reset();
s_AddGEqualPipeline.reset();
s_AddGEqualZWritePipeline.reset();
s_AddLEqualPipeline.reset();
s_SubtractPipeline.reset();
s_SubtractGEqualPipeline.reset();
s_SubtractGEqualZWritePipeline.reset();
s_SubtractLEqualPipeline.reset();
s_MultPipeline.reset();
s_MultGEqualPipeline.reset();
s_MultGEqualZWritePipeline.reset();
s_MultLEqualPipeline.reset();
s_InvDstMultPipeline.reset();
s_InvDstMultGEqualPipeline.reset();
@ -101,6 +113,22 @@ static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type, CTex
default:
break;
}
break;
case CTexturedQuadFilter::ZTest::GEqualZWrite:
switch (type)
{
case EFilterType::Blend:
return s_AlphaGEqualZWritePipeline;
case EFilterType::Add:
return s_AddGEqualZWritePipeline;
case EFilterType::Subtract:
return s_SubtractGEqualZWritePipeline;
case EFilterType::Multiply:
return s_MultGEqualZWritePipeline;
default:
break;
}
break;
case CTexturedQuadFilter::ZTest::LEqual:
switch (type)
{
@ -117,6 +145,7 @@ static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type, CTex
default:
break;
}
break;
default:
break;
}

View File

@ -16,7 +16,8 @@ public:
{
None,
LEqual,
GEqual
GEqual,
GEqualZWrite
};
protected:

View File

@ -1092,6 +1092,7 @@ void CPlayerGun::ProcessGunMorph(float dt, CStateManager& mgr)
break;
case CGunMorph::EGunState::InWipe:
case CGunMorph::EGunState::OutWipe:
x774_holoTransitionGen->SetGlobalScale(sGunScale);
x774_holoTransitionGen->SetGlobalTranslation(zeus::CVector3f(0.f, x678_morph.GetYLerp(), 0.f));
x774_holoTransitionGen->Update(dt);
break;
@ -2442,11 +2443,7 @@ void CPlayerGun::DrawArm(const CStateManager& mgr, const zeus::CVector3f& pos, c
zeus::CVector3f CPlayerGun::ConvertToScreenSpace(const zeus::CVector3f& pos, const CGameCamera& cam) const
{
zeus::CVector3f camToPosLocal = cam.GetTransform().transposeRotate(pos - cam.GetTranslation());
if (!camToPosLocal.isZero())
return CGraphics::GetPerspectiveProjectionMatrix(false).multiplyOneOverW(camToPosLocal);
else
return {-1.f, -1.f, 1.f};
return cam.ConvertToScreenSpace(pos);
}
void CPlayerGun::CopyScreenTex()

View File

@ -314,7 +314,7 @@ private:
};
mutable CTexturedQuadFilter m_screenQuad = {EFilterType::Blend, CGraphics::g_SpareTexture.get(),
CTexturedQuadFilter::ZTest::GEqual};
CTexturedQuadFilter::ZTest::GEqualZWrite};
mutable CAABoxShader m_aaboxShader = {true};
void InitBeamData();

View File

@ -270,3 +270,18 @@ fragment float4 fmain(VertToFrag vtf [[ stage_in ]],
#srcfac zero
#dstfac invsrccolor
#shader CTexturedQuadFilterAlphaGEqualZWrite : CTexturedQuadFilterAlpha
#depthtest gequal
#depthwrite true
#shader CTexturedQuadFilterAddGEqualZWrite : CTexturedQuadFilterAdd
#depthtest gequal
#depthwrite true
#shader CTexturedQuadFilterSubtractGEqualZWrite : CTexturedQuadFilterSubtract
#depthtest gequal
#depthwrite true
#shader CTexturedQuadFilterMultGEqualZWrite : CTexturedQuadFilterMult
#depthtest gequal
#depthwrite true

@ -1 +1 @@
Subproject commit 90665dd3d12e659f88ee46b2c7bd2873fefa4c90
Subproject commit 91cdaddfd976307c6d97982831c39c1b5110c47b