mirror of https://github.com/AxioDL/metaforce.git
Various AutoMapper render fixes
This commit is contained in:
parent
21505e46ce
commit
a914e121ea
|
@ -417,9 +417,42 @@ void CAutoMapper::BeginMapperStateTransition(EAutoMapperState state, const CStat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::CompleteMapperStateTransition(const CStateManager&)
|
void CAutoMapper::CompleteMapperStateTransition(const CStateManager& mgr)
|
||||||
{
|
{
|
||||||
|
if (x1bc_state == EAutoMapperState::MapScreenUniverse)
|
||||||
|
TransformRenderStatesUniverseToWorld();
|
||||||
|
|
||||||
|
if (x1c0_nextState == EAutoMapperState::MapScreen)
|
||||||
|
{
|
||||||
|
const CMapWorldInfo& mwInfo = *g_GameState->StateForWorld(x24_world->IGetWorldAssetId()).MapWorldInfo();
|
||||||
|
x24_world->IGetMapWorld()->RecalculateWorldSphere(mwInfo, *x24_world);
|
||||||
|
x1d8_flashTimer = 0.f;
|
||||||
|
x1dc_playerFlashPulse = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x1c0_nextState == EAutoMapperState::MiniMap)
|
||||||
|
{
|
||||||
|
x28_frmeMapScreen = TLockedToken<CGuiFrame>();
|
||||||
|
m_frmeInitialized = false;
|
||||||
|
x2fc_textpane_hint = nullptr;
|
||||||
|
x300_textpane_instructions = nullptr;
|
||||||
|
x304_textpane_instructions1 = nullptr;
|
||||||
|
x308_textpane_instructions2 = nullptr;
|
||||||
|
x2f8_textpane_areaname = nullptr;
|
||||||
|
x30c_basewidget_leftPane = nullptr;
|
||||||
|
x310_basewidget_yButtonPane = nullptr;
|
||||||
|
x314_basewidget_bottomPane = nullptr;
|
||||||
|
SetResLockState(x210_lstick, false);
|
||||||
|
SetResLockState(x25c_cstick, false);
|
||||||
|
SetResLockState(x2a8_ltrigger, false);
|
||||||
|
SetResLockState(x2bc_rtrigger, false);
|
||||||
|
SetResLockState(x2d0_abutton, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x1c0_nextState == EAutoMapperState::MapScreenUniverse && x328_ == 1)
|
||||||
|
LeaveMapScreen(mgr);
|
||||||
|
|
||||||
|
x1bc_state = x1c0_nextState;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoMapper::ResetInterpolationTimer(float t)
|
void CAutoMapper::ResetInterpolationTimer(float t)
|
||||||
|
@ -812,7 +845,7 @@ void CAutoMapper::ProcessMapScreenInput(const CFinalInput& input, const CStateMa
|
||||||
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
zeus::CMatrix3f camRot = xa8_renderStates[0].x8_camOrientation.toTransform().buildMatrix3f();
|
||||||
if (x1bc_state == EAutoMapperState::MapScreen)
|
if (x1bc_state == EAutoMapperState::MapScreen)
|
||||||
{
|
{
|
||||||
if (input.PA() && !x328_ && HasCurrentMapUniverseWorld())
|
if (input.PA() && x328_ == 0 && HasCurrentMapUniverseWorld())
|
||||||
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
|
BeginMapperStateTransition(EAutoMapperState::MapScreenUniverse, mgr);
|
||||||
}
|
}
|
||||||
else if (x1bc_state == EAutoMapperState::MapScreenUniverse && input.PA())
|
else if (x1bc_state == EAutoMapperState::MapScreenUniverse && input.PA())
|
||||||
|
@ -981,7 +1014,7 @@ float CAutoMapper::GetDesiredMiniMapCameraDistance(const CStateManager& mgr) con
|
||||||
const IGameArea* area = x24_world->IGetAreaAlways(xa0_curAreaId);
|
const IGameArea* area = x24_world->IGetAreaAlways(xa0_curAreaId);
|
||||||
const CMapArea* mapa = mw->GetMapArea(xa0_curAreaId);
|
const CMapArea* mapa = mw->GetMapArea(xa0_curAreaId);
|
||||||
bool oneMiniMapArea = g_tweakAutoMapper->GetShowOneMiniMapArea();
|
bool oneMiniMapArea = g_tweakAutoMapper->GetShowOneMiniMapArea();
|
||||||
for (int i = -1 ; i < (oneMiniMapArea ? 0 : area->IGetNumAttachedAreas()) ; ++i)
|
for (int i = -1 ; i < (oneMiniMapArea ? 0 : int(area->IGetNumAttachedAreas())) ; ++i)
|
||||||
{
|
{
|
||||||
TAreaId aid = i == -1 ? xa0_curAreaId : area->IGetAttachedAreaId(i);
|
TAreaId aid = i == -1 ? xa0_curAreaId : area->IGetAttachedAreaId(i);
|
||||||
const CMapArea* attMapa = mw->GetMapArea(aid);
|
const CMapArea* attMapa = mw->GetMapArea(aid);
|
||||||
|
@ -1032,7 +1065,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
||||||
CheckDummyWorldLoad(mgr);
|
CheckDummyWorldLoad(mgr);
|
||||||
else if (x1e0_hintSteps.size())
|
else if (x1e0_hintSteps.size())
|
||||||
UpdateHintNavigation(input.DeltaTime(), mgr);
|
UpdateHintNavigation(input.DeltaTime(), mgr);
|
||||||
else if (!x328_)
|
else if (x328_ == 0)
|
||||||
ProcessMapScreenInput(input, mgr);
|
ProcessMapScreenInput(input, mgr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1150,7 +1183,7 @@ void CAutoMapper::ProcessControllerInput(const CFinalInput& input, CStateManager
|
||||||
|
|
||||||
if (input.PZ() || input.PB())
|
if (input.PZ() || input.PB())
|
||||||
{
|
{
|
||||||
if (!x328_)
|
if (x328_ == 0)
|
||||||
{
|
{
|
||||||
if (CanLeaveMapScreenInternal(mgr))
|
if (CanLeaveMapScreenInternal(mgr))
|
||||||
LeaveMapScreen(mgr);
|
LeaveMapScreen(mgr);
|
||||||
|
|
|
@ -363,7 +363,7 @@ void CMapWorld::DrawAreas(const CMapWorld::CMapWorldDrawParms& parms, int selAre
|
||||||
std::sort(sortInfos.begin(), sortInfos.end(),
|
std::sort(sortInfos.begin(), sortInfos.end(),
|
||||||
[](const CMapObjectSortInfo& a, const CMapObjectSortInfo& b)
|
[](const CMapObjectSortInfo& a, const CMapObjectSortInfo& b)
|
||||||
{
|
{
|
||||||
return a.GetZDistance() < b.GetZDistance();
|
return a.GetZDistance() > b.GetZDistance();
|
||||||
});
|
});
|
||||||
|
|
||||||
int lastAreaIdx = -1;
|
int lastAreaIdx = -1;
|
||||||
|
|
|
@ -73,10 +73,9 @@ zeus::CTransform CMappableObject::AdjustTransformForType()
|
||||||
}
|
}
|
||||||
else if (x0_type >= EMappableObjectType::BlueDoor || x0_type <= EMappableObjectType::PlasmaDoorFloor2)
|
else if (x0_type >= EMappableObjectType::BlueDoor || x0_type <= EMappableObjectType::PlasmaDoorFloor2)
|
||||||
{
|
{
|
||||||
zeus::CMatrix4f tmp = x10_transform.toMatrix4f().transposed();
|
return x10_transform;
|
||||||
return zeus::CTransform::Translate(tmp.m[1][0], tmp.m[2][1], tmp[3][2]);
|
|
||||||
}
|
}
|
||||||
return x10_transform;
|
return zeus::CTransform::Translate(x10_transform.origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<zeus::CColor, zeus::CColor>
|
std::pair<zeus::CColor, zeus::CColor>
|
||||||
|
@ -155,8 +154,8 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo,
|
||||||
line.Reset();
|
line.Reset();
|
||||||
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||||
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
|
||||||
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||||
|
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||||
line.Render();
|
line.Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -229,8 +228,8 @@ void CMappableObject::DrawDoorSurface(int curArea, const CMapWorldInfo& mwInfo,
|
||||||
line.Reset();
|
line.Reset();
|
||||||
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
line.AddVertex(skDoorVerts[baseIdx[0]], colors.second, 1.f);
|
||||||
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
line.AddVertex(skDoorVerts[baseIdx[1]], colors.second, 1.f);
|
||||||
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
|
||||||
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
line.AddVertex(skDoorVerts[baseIdx[3]], colors.second, 1.f);
|
||||||
|
line.AddVertex(skDoorVerts[baseIdx[2]], colors.second, 1.f);
|
||||||
line.Render();
|
line.Render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ private:
|
||||||
CLineRenderer m_outline;
|
CLineRenderer m_outline;
|
||||||
DoorSurface(boo::IGraphicsDataFactory::Context& ctx)
|
DoorSurface(boo::IGraphicsDataFactory::Context& ctx)
|
||||||
: m_surface(ctx, g_doorVbo, g_doorIbo),
|
: m_surface(ctx, g_doorVbo, g_doorIbo),
|
||||||
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineStrip, 5, nullptr, false)
|
m_outline(ctx, CLineRenderer::EPrimitiveMode::LineLoop, 5, nullptr, false)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
std::experimental::optional<DoorSurface> m_doorSurface;
|
std::experimental::optional<DoorSurface> m_doorSurface;
|
||||||
|
|
|
@ -179,40 +179,17 @@ void CCameraBlurPass::Draw()
|
||||||
if (x10_curType == EBlurType::NoBlur)
|
if (x10_curType == EBlurType::NoBlur)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SClipScreenRect rect(g_Viewport);
|
|
||||||
CGraphics::ResolveSpareTexture(rect);
|
|
||||||
|
|
||||||
if (x10_curType == EBlurType::Xray)
|
if (x10_curType == EBlurType::Xray)
|
||||||
{
|
{
|
||||||
float blurX = x1c_curValue * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
if (!m_xrayShader)
|
||||||
float blurY = x1c_curValue * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
m_xrayShader.emplace(x0_paletteTex);
|
||||||
|
m_xrayShader->draw(x1c_curValue);
|
||||||
for (int i=0 ; i<4 ; ++i)
|
|
||||||
{
|
|
||||||
float iflt = i;
|
|
||||||
float uvScale = (1.f - (blurX * iflt + blurY * iflt * iflt));
|
|
||||||
float uvOffset = uvScale * -0.5f + 0.5f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i=0 ; i<7 ; ++i)
|
if (!m_shader)
|
||||||
{
|
m_shader.emplace();
|
||||||
float amtX = 0.f;
|
m_shader->draw(x1c_curValue);
|
||||||
float amtY = 0.f;
|
|
||||||
if (i)
|
|
||||||
{
|
|
||||||
float tmp = i - 1;
|
|
||||||
tmp *= 2.f * M_PIF;
|
|
||||||
tmp /= 6.f;
|
|
||||||
|
|
||||||
amtX = std::cos(tmp);
|
|
||||||
amtX *= x1c_curValue / 640.f;
|
|
||||||
|
|
||||||
amtY = std::sin(tmp);
|
|
||||||
amtY *= x1c_curValue / 448.f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "zeus/CColor.hpp"
|
#include "zeus/CColor.hpp"
|
||||||
#include "RetroTypes.hpp"
|
#include "RetroTypes.hpp"
|
||||||
#include "CToken.hpp"
|
#include "CToken.hpp"
|
||||||
|
#include "Graphics/Shaders/CCameraBlurFilter.hpp"
|
||||||
|
#include "Graphics/Shaders/CXRayBlurFilter.hpp"
|
||||||
|
|
||||||
namespace urde
|
namespace urde
|
||||||
{
|
{
|
||||||
|
@ -103,6 +105,9 @@ class CCameraBlurPass
|
||||||
//bool x2d_noPersistentCopy = false;
|
//bool x2d_noPersistentCopy = false;
|
||||||
//u32 x30_persistentBuf = 0;
|
//u32 x30_persistentBuf = 0;
|
||||||
|
|
||||||
|
mutable std::experimental::optional<CCameraBlurFilter> m_shader;
|
||||||
|
mutable std::experimental::optional<CXRayBlurFilter> m_xrayShader;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Draw();
|
void Draw();
|
||||||
void Update(float dt);
|
void Update(float dt);
|
||||||
|
|
|
@ -91,7 +91,7 @@ CMapSurfaceShader::Initialize(boo::GLDataFactory::Context& ctx)
|
||||||
const char* uniNames[] = {"MapSurfaceUniform"};
|
const char* uniNames[] = {"MapSurfaceUniform"};
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, 0, nullptr, 1, uniNames,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha,
|
||||||
boo::Primitive::TriStrips, boo::ZTest::LEqual, false, true,
|
boo::Primitive::TriStrips, boo::ZTest::None, false, true,
|
||||||
false, boo::CullMode::Backface);
|
false, boo::CullMode::Backface);
|
||||||
return new CMapSurfaceShaderGLDataBindingFactory;
|
return new CMapSurfaceShaderGLDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ CMapSurfaceShader::Initialize(boo::VulkanDataFactory::Context& ctx)
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha,
|
||||||
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
|
||||||
return new CMapSurfaceShaderVulkanDataBindingFactory;
|
return new CMapSurfaceShaderVulkanDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ CMapSurfaceShader::Initialize(boo::ID3DDataFactory::Context& ctx)
|
||||||
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
s_VtxFmt = ctx.newVertexFormat(1, VtxVmt);
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, nullptr, s_VtxFmt,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr, nullptr, s_VtxFmt,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
|
||||||
return new CMapSurfaceShaderD3DDataBindingFactory;
|
return new CMapSurfaceShaderD3DDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ CMapSurfaceShader::Initialize(boo::MetalDataFactory::Context& ctx)
|
||||||
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
s_Pipeline = ctx.newShaderPipeline(VS, FS, nullptr, nullptr,
|
||||||
s_VtxFmt, CGraphics::g_ViewportSamples,
|
s_VtxFmt, CGraphics::g_ViewportSamples,
|
||||||
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips,
|
||||||
boo::ZTest::LEqual, false, true, false, boo::CullMode::Backface);
|
boo::ZTest::None, false, true, false, boo::CullMode::Backface);
|
||||||
return new CMapSurfaceShaderMetalDataBindingFactory;
|
return new CMapSurfaceShaderMetalDataBindingFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,10 +33,8 @@ void CXRayBlurFilter::draw(float amount)
|
||||||
{
|
{
|
||||||
CGraphics::ResolveSpareTexture(CGraphics::g_CroppedViewport);
|
CGraphics::ResolveSpareTexture(CGraphics::g_CroppedViewport);
|
||||||
|
|
||||||
float blurL = amount * 0.0014f * 0.25f;
|
float blurL = amount * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
||||||
float blurQ = amount * 0.0000525f * 0.25f;
|
float blurQ = amount * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
||||||
//float blurL = amount * g_tweakGui->GetXrayBlurScaleLinear() * 0.25f;
|
|
||||||
//float blurQ = amount * g_tweakGui->GetXrayBlurScaleQuadratic() * 0.25f;
|
|
||||||
|
|
||||||
for (int i=0 ; i<4 ; ++i)
|
for (int i=0 ; i<4 ; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
@ -319,7 +319,7 @@ void CInGameGuiManager::OnNewPauseScreenState(CArchitectureQueue& archQueue)
|
||||||
{
|
{
|
||||||
if (x1c0_nextState != EInGameGuiState::PauseGame && x1c0_nextState != EInGameGuiState::PauseLogBook)
|
if (x1c0_nextState != EInGameGuiState::PauseGame && x1c0_nextState != EInGameGuiState::PauseLogBook)
|
||||||
{
|
{
|
||||||
if (x48_pauseScreen->IsTransitioning())
|
if (x48_pauseScreen && x48_pauseScreen->IsTransitioning())
|
||||||
return;
|
return;
|
||||||
x48_pauseScreen.reset();
|
x48_pauseScreen.reset();
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ void CInGameGuiManager::Update(CStateManager& stateMgr, float dt, CArchitectureQ
|
||||||
{
|
{
|
||||||
if (x1c0_nextState == EInGameGuiState::Zero || x1c0_nextState == EInGameGuiState::InGame)
|
if (x1c0_nextState == EInGameGuiState::Zero || x1c0_nextState == EInGameGuiState::InGame)
|
||||||
TryReloadAreaTextures();
|
TryReloadAreaTextures();
|
||||||
if ((x1bc_prevState == x1c0_nextState || !x1e8_enableAutoMapper) &&
|
if ((!x38_autoMapper->IsInMapperStateTransition() || !x1e8_enableAutoMapper) &&
|
||||||
x3c_pauseScreenBlur->IsNotTransitioning())
|
x3c_pauseScreenBlur->IsNotTransitioning())
|
||||||
OnNewPauseScreenState(archQueue);
|
OnNewPauseScreenState(archQueue);
|
||||||
}
|
}
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 7fe1cb8320ee23d115a222980bba96508a139920
|
Subproject commit 97734162b1cbebac86078c07f4586a977091a9a7
|
Loading…
Reference in New Issue