From 168fab6b142fe70b0c9ad1bbf230f751427af141 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 5 Jan 2018 20:50:42 -1000 Subject: [PATCH] HUD rendering bug fixes --- DataSpec/DNAMP1/SCAN.hpp | 2 + Runtime/AutoMapper/CAutoMapper.cpp | 4 +- Runtime/CPlayerState.cpp | 23 ++++--- Runtime/CStateManager.cpp | 10 +-- Runtime/Camera/CCameraFilter.cpp | 6 +- Runtime/Camera/CCameraFilter.hpp | 2 +- Runtime/Graphics/CGraphics.hpp | 24 ++++++- Runtime/Graphics/CModel.hpp | 1 + Runtime/Graphics/CModelBoo.cpp | 12 +++- .../Graphics/Shaders/CCameraBlurFilter.cpp | 4 +- .../Graphics/Shaders/CCameraBlurFilter.hpp | 2 +- .../Shaders/CEnergyBarShaderMetal.cpp | 2 +- .../Shaders/CFluidPlaneShaderMetal.cpp | 4 +- .../Shaders/CFogVolumeFilterMetal.cpp | 4 +- Runtime/Graphics/Shaders/CModelShaders.hpp | 4 +- .../Graphics/Shaders/CModelShadersGLSL.cpp | 14 ++++- .../Graphics/Shaders/CModelShadersHLSL.cpp | 14 ++++- .../Graphics/Shaders/CModelShadersMetal.cpp | 14 ++++- .../Shaders/CParticleSwooshShadersMetal.cpp | 2 +- .../Shaders/CPhazonSuitFilterMetal.cpp | 6 +- .../Shaders/CSpaceWarpFilterMetal.cpp | 2 +- .../Shaders/CTextSupportShaderMetal.cpp | 4 +- .../Shaders/CTexturedQuadFilterGLSL.cpp | 62 +++++++++++++++---- .../Shaders/CTexturedQuadFilterMetal.cpp | 4 +- .../Shaders/CThermalColdFilterMetal.cpp | 2 +- .../Shaders/CThermalHotFilterMetal.cpp | 2 +- .../Graphics/Shaders/CXRayBlurFilterMetal.cpp | 2 +- Runtime/GuiSys/CAuiImagePane.cpp | 9 +-- Runtime/GuiSys/CAuiImagePane.hpp | 1 + Runtime/GuiSys/CGuiModel.cpp | 3 + Runtime/GuiSys/CTextExecuteBuffer.cpp | 2 +- Runtime/GuiSys/CTextParser.cpp | 8 +-- Runtime/MP1/CInGameGuiManager.cpp | 8 +-- Runtime/MP1/CLogBookScreen.cpp | 12 +++- Runtime/MP1/COptionsScreen.cpp | 9 ++- Runtime/MP1/CPauseScreenBase.cpp | 3 + Runtime/MP1/CPauseScreenBlur.cpp | 2 +- Runtime/MP1/CPlayerVisor.cpp | 45 +++++++------- Runtime/MP1/CPlayerVisor.hpp | 6 +- Runtime/Weapon/CPlayerGun.cpp | 4 +- Runtime/World/CMorphBallShadow.cpp | 2 +- Runtime/World/CScriptSpawnPoint.cpp | 8 +-- Runtime/World/CScriptSpawnPoint.hpp | 6 +- Runtime/World/CWorld.cpp | 4 +- Runtime/World/CWorldShadow.cpp | 2 +- Runtime/World/ScriptLoader.cpp | 6 +- hecl | 2 +- 47 files changed, 254 insertions(+), 120 deletions(-) diff --git a/DataSpec/DNAMP1/SCAN.hpp b/DataSpec/DNAMP1/SCAN.hpp index 821ae15be..9f6cd8238 100644 --- a/DataSpec/DNAMP1/SCAN.hpp +++ b/DataSpec/DNAMP1/SCAN.hpp @@ -202,6 +202,8 @@ struct SCAN : BigYAML void gatherDependencies(std::vector& pathsOut) { + g_curSpec->flattenDependencies(frame, pathsOut); + g_curSpec->flattenDependencies(string, pathsOut); for (int i = 0; i < 4; ++i) g_curSpec->flattenDependencies(textures[i].texture, pathsOut); } diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index e0962ee2e..353740cd2 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -1687,10 +1687,10 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo frmeAlpha = 1.f - frmeAlpha; } } - CGraphics::SetDepthRange(0.f, 0.f); + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_NEAR); CGuiWidgetDrawParms parms(frmeAlpha, zeus::CVector3f::skZero); x28_frmeMapScreen->Draw(parms); - CGraphics::SetDepthRange(0.f, 1.f / 512.f); + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_HUD); } } diff --git a/Runtime/CPlayerState.cpp b/Runtime/CPlayerState.cpp index b9f3abe93..ab6281329 100644 --- a/Runtime/CPlayerState.cpp +++ b/Runtime/CPlayerState.cpp @@ -245,15 +245,12 @@ float CPlayerState::GetScanTime(CAssetId res) const bool CPlayerState::GetIsVisorTransitioning() const { - if (x14_currentVisor != x18_transitioningVisor || x1c_visorTransitionFactor < 0.2f) - return true; - - return false; + return x14_currentVisor != x18_transitioningVisor || x1c_visorTransitionFactor < 0.2f; } float CPlayerState::GetVisorTransitionFactor() const { - return x1c_visorTransitionFactor; + return x1c_visorTransitionFactor / 0.2f; } void CPlayerState::UpdateVisorTransition(float dt) @@ -273,9 +270,9 @@ void CPlayerState::UpdateVisorTransition(float dt) if (x1c_visorTransitionFactor < 0.f) { x14_currentVisor = x18_transitioningVisor; - x1c_visorTransitionFactor = fabs(x1c_visorTransitionFactor); - if (x1c_visorTransitionFactor < 0.19f) - x1c_visorTransitionFactor = 0.19f; + x1c_visorTransitionFactor = std::fabs(x1c_visorTransitionFactor); + if (x1c_visorTransitionFactor > 0.19999f) + x1c_visorTransitionFactor = 0.19999f; } } } @@ -379,6 +376,10 @@ void CPlayerState::IncrPickup(EItemType type, s32 amount) { CPowerUp& pup = x24_powerups[u32(type)]; pup.x0_amount = std::min(pup.x0_amount + amount, pup.x4_capacity); + + if (type == CPlayerState::EItemType::Truth) + printf(""); + if (type == EItemType::EnergyTanks) IncrPickup(EItemType::HealthRefill, 9999); break; @@ -409,6 +410,9 @@ void CPlayerState::InitializePowerUp(CPlayerState::EItemType type, u32 capacity) if (type >= EItemType::Max) return; + if (type == CPlayerState::EItemType::Truth) + printf(""); + CPowerUp& pup = x24_powerups[(u32)type]; pup.x4_capacity = zeus::clamp(u32(0), pup.x4_capacity + capacity, PowerUpMaxValues[u32(type)]); pup.x0_amount = std::min(pup.x0_amount, pup.x4_capacity); @@ -427,6 +431,9 @@ void CPlayerState::InitializePowerUp(CPlayerState::EItemType type, u32 capacity) void CPlayerState::ReInitalizePowerUp(CPlayerState::EItemType type, u32 capacity) { + if (type == CPlayerState::EItemType::Truth) + printf(""); + x24_powerups[u32(type)].x4_capacity = 0; InitializePowerUp(type, capacity); } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 1c63551c2..190eed510 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -587,7 +587,7 @@ zeus::CFrustum CStateManager::SetupViewForDraw(const SViewport& vp) const int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left; int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top; g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight); - CGraphics::SetDepthRange(0.125f, 1.f); + CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y * 2.f); float width = xf2c_viewportScale.x * vp.x8_width; float height = xf2c_viewportScale.y * vp.xc_height; @@ -786,12 +786,12 @@ void CStateManager::DrawWorld() const { if (x86c_stateManagerContainer->xf39c_renderLast.size()) { - CGraphics::SetDepthRange(0.015625f, 0.03125f); + CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); for (TUniqueId id : x86c_stateManagerContainer->xf39c_renderLast) if (const CActor* actor = static_cast(GetObjectById(id))) if (actor->xe6_27_renderVisorFlags & 0x1) actor->Render(*this); - CGraphics::SetDepthRange(0.125f, 1.f); + CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); } g_Renderer->DoThermalBlendCold(); @@ -857,12 +857,12 @@ void CStateManager::DrawWorld() const if (x86c_stateManagerContainer->xf39c_renderLast.size()) { - CGraphics::SetDepthRange(0.015625f, 0.03125f); + CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); for (TUniqueId id : x86c_stateManagerContainer->xf39c_renderLast) if (const CActor* actor = static_cast(GetObjectById(id))) if (actor->xe6_27_renderVisorFlags & 0x2) actor->Render(*this); - CGraphics::SetDepthRange(0.125f, 1.f); + CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); } if (thermal) diff --git a/Runtime/Camera/CCameraFilter.cpp b/Runtime/Camera/CCameraFilter.cpp index d661758d7..1eab1fca3 100644 --- a/Runtime/Camera/CCameraFilter.cpp +++ b/Runtime/Camera/CCameraFilter.cpp @@ -174,7 +174,7 @@ void CCameraFilterPassPoly::SetFilter(EFilterType type, EFilterShape shape, m_filter->SetFilter(type, shape, time, color, txtr); } -void CCameraBlurPass::Draw() +void CCameraBlurPass::Draw(bool clearDepth) { if (x10_curType == EBlurType::NoBlur) return; @@ -189,7 +189,9 @@ void CCameraBlurPass::Draw() { if (!m_shader) m_shader.emplace(); - m_shader->draw(x1c_curValue); + m_shader->draw(x1c_curValue, clearDepth); + if (clearDepth) + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR); } } diff --git a/Runtime/Camera/CCameraFilter.hpp b/Runtime/Camera/CCameraFilter.hpp index 89bf57b34..b38d9f825 100644 --- a/Runtime/Camera/CCameraFilter.hpp +++ b/Runtime/Camera/CCameraFilter.hpp @@ -109,7 +109,7 @@ class CCameraBlurPass mutable std::experimental::optional m_xrayShader; public: - void Draw(); + void Draw(bool clearDepth=false); void Update(float dt); void SetBlur(EBlurType type, float amount, float duration); void DisableBlur(float duration); diff --git a/Runtime/Graphics/CGraphics.hpp b/Runtime/Graphics/CGraphics.hpp index 77a5a6bcd..93955e5d8 100644 --- a/Runtime/Graphics/CGraphics.hpp +++ b/Runtime/Graphics/CGraphics.hpp @@ -206,6 +206,26 @@ enum class ETexelFormat CMPRPC = 18, }; +/* +#define DEPTH_FAR 1.f +#define DEPTH_SKY 0.999f +#define DEPTH_TARGET_MANAGER 0.12500012f +#define DEPTH_WORLD (1.f / 8.f) +#define DEPTH_GUN (1.f / 32.f) +#define DEPTH_SCREEN_ACTORS (1.f / 64.f) +#define DEPTH_HUD (1.f / 512.f) +#define DEPTH_NEAR 0.f + */ + +#define DEPTH_FAR 1.f +#define DEPTH_SKY 0.999f +#define DEPTH_TARGET_MANAGER 0.12500012f +#define DEPTH_WORLD (1.f / 8.f) +#define DEPTH_GUN (1.f / 32.f) +#define DEPTH_SCREEN_ACTORS (1.f / 64.f) +#define DEPTH_HUD (1.f / 512.f) +#define DEPTH_NEAR 0.f + class CGraphics { public: @@ -334,10 +354,10 @@ public: { g_BooMainCommandQueue->setShaderDataBinding(binding); } - static void ResolveSpareTexture(const SClipScreenRect& rect, int bindIdx=0) + static void ResolveSpareTexture(const SClipScreenRect& rect, int bindIdx=0, bool clearDepth=false) { boo::SWindowRect wrect = {rect.x4_left, rect.x8_top, rect.xc_width, rect.x10_height}; - g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, bindIdx, true, false); + g_BooMainCommandQueue->resolveBindTexture(g_SpareTexture, wrect, true, bindIdx, true, false, clearDepth); } static void ResolveSpareDepth(const SClipScreenRect& rect, int bindIdx=0) { diff --git a/Runtime/Graphics/CModel.hpp b/Runtime/Graphics/CModel.hpp index 5dd79f78d..5d72ec3fb 100644 --- a/Runtime/Graphics/CModel.hpp +++ b/Runtime/Graphics/CModel.hpp @@ -27,6 +27,7 @@ struct CModelFlags u8 x1_matSetIdx = 0; EExtendedShader m_extendedShader = EExtendedShader::Flat; bool m_noCull = false; + bool m_noZWrite = false; u16 x2_flags = 0; /* Flags */ zeus::CColor x4_color; /* Set into kcolor slot specified by material */ zeus::CColor addColor = zeus::CColor::skClear; diff --git a/Runtime/Graphics/CModelBoo.cpp b/Runtime/Graphics/CModelBoo.cpp index 9fffdcb98..564ac2e91 100644 --- a/Runtime/Graphics/CModelBoo.cpp +++ b/Runtime/Graphics/CModelBoo.cpp @@ -631,11 +631,17 @@ void CBooModel::DrawSurface(const CBooSurface& surf, const CModelFlags& flags) c { if (data.heclIr.m_blendSrc == boo::BlendFactor::One && data.heclIr.m_blendDst == boo::BlendFactor::Zero) { - /* Override shader if originally opaque */ + /* Override shader if originally opaque (typical for FRME models) */ if (flags.x0_blendMode > 6) - extended = flags.m_noCull ? EExtendedShader::ForcedAdditiveNoCull : EExtendedShader::ForcedAdditive; + extended = flags.m_noCull ? (flags.m_noZWrite ? + EExtendedShader::ForcedAdditiveNoCullNoZWrite : + EExtendedShader::ForcedAdditiveNoCull) : + EExtendedShader::ForcedAdditive; else if (flags.x0_blendMode > 4) - extended = flags.m_noCull ? EExtendedShader::ForcedAlphaNoCull : EExtendedShader::ForcedAlpha; + extended = flags.m_noCull ? (flags.m_noZWrite ? + EExtendedShader::ForcedAlphaNoCullNoZWrite : + EExtendedShader::ForcedAlphaNoCull) : + EExtendedShader::ForcedAlpha; else extended = EExtendedShader::Lighting; } diff --git a/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp b/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp index 7b63fe1f6..695fe75c1 100644 --- a/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp +++ b/Runtime/Graphics/Shaders/CCameraBlurFilter.cpp @@ -14,13 +14,13 @@ CCameraBlurFilter::CCameraBlurFilter() }); } -void CCameraBlurFilter::draw(float amount) +void CCameraBlurFilter::draw(float amount, bool clearDepth) { if (amount <= 0.f) return; SClipScreenRect clipRect(g_Viewport); - CGraphics::ResolveSpareTexture(clipRect); + CGraphics::ResolveSpareTexture(clipRect, 0, clearDepth); float aspect = CGraphics::g_CroppedViewport.xc_width / float(CGraphics::g_CroppedViewport.x10_height); float xFac = CGraphics::g_CroppedViewport.xc_width / float(g_Viewport.x8_width); diff --git a/Runtime/Graphics/Shaders/CCameraBlurFilter.hpp b/Runtime/Graphics/Shaders/CCameraBlurFilter.hpp index 14e062d0f..18bd54cb3 100644 --- a/Runtime/Graphics/Shaders/CCameraBlurFilter.hpp +++ b/Runtime/Graphics/Shaders/CCameraBlurFilter.hpp @@ -33,7 +33,7 @@ class CCameraBlurFilter public: CCameraBlurFilter(); - void draw(float amount); + void draw(float amount, bool clearDepth=false); using _CLS = CCameraBlurFilter; #include "TShaderDecl.hpp" diff --git a/Runtime/Graphics/Shaders/CEnergyBarShaderMetal.cpp b/Runtime/Graphics/Shaders/CEnergyBarShaderMetal.cpp index 89d382bfe..d03bbfaec 100644 --- a/Runtime/Graphics/Shaders/CEnergyBarShaderMetal.cpp +++ b/Runtime/Graphics/Shaders/CEnergyBarShaderMetal.cpp @@ -39,7 +39,7 @@ static const char* VS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CFluidPlaneShaderMetal.cpp b/Runtime/Graphics/Shaders/CFluidPlaneShaderMetal.cpp index 4ef6be5e4..e2e09a426 100644 --- a/Runtime/Graphics/Shaders/CFluidPlaneShaderMetal.cpp +++ b/Runtime/Graphics/Shaders/CFluidPlaneShaderMetal.cpp @@ -62,7 +62,7 @@ static const char* VS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "\n" "struct Light\n" "{\n" @@ -140,7 +140,7 @@ static const char* FS = static const char* FSDoor = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "\n" "struct Light\n" "{\n" diff --git a/Runtime/Graphics/Shaders/CFogVolumeFilterMetal.cpp b/Runtime/Graphics/Shaders/CFogVolumeFilterMetal.cpp index cd071b0bf..5ceb85f63 100644 --- a/Runtime/Graphics/Shaders/CFogVolumeFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CFogVolumeFilterMetal.cpp @@ -40,7 +40,7 @@ static const char* VS = static const char* FS1Way = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 pos [[ position ]];\n" @@ -64,7 +64,7 @@ static const char* FS1Way = static const char* FS2Way = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 pos [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CModelShaders.hpp b/Runtime/Graphics/Shaders/CModelShaders.hpp index fbfd1e1a8..582bbc66f 100644 --- a/Runtime/Graphics/Shaders/CModelShaders.hpp +++ b/Runtime/Graphics/Shaders/CModelShaders.hpp @@ -28,7 +28,9 @@ enum EExtendedShader : uint8_t MorphBallShadow, WorldShadow, ForcedAlphaNoCull, - ForcedAdditiveNoCull + ForcedAdditiveNoCull, + ForcedAlphaNoCullNoZWrite, + ForcedAdditiveNoCullNoZWrite }; class CModelShaders diff --git a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp index 2049105eb..e1eb3b4b5 100644 --- a/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersGLSL.cpp @@ -260,9 +260,21 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat) ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, - hecl::Backend::CullMode::None, true, false, true); + hecl::Backend::CullMode::None, false, false, true); /* Forced additive shading without culling */ + ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, + 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::None, false, false, true); + + /* Forced alpha shading without culling or Z-write */ + ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, + 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::None, true, false, true); + + /* Forced additive shading without culling or Z-write */ ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, diff --git a/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp b/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp index 8ebdef9ed..776b14ef1 100644 --- a/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersHLSL.cpp @@ -243,9 +243,21 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat) ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, - hecl::Backend::CullMode::None, true, false, true); + hecl::Backend::CullMode::None, false, false, true); /* Forced additive shading without culling */ + ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, + 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::None, false, false, true); + + /* Forced alpha shading without culling or Z-write */ + ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, + 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::None, true, false, true); + + /* Forced additive shading without culling or Z-write */ ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, diff --git a/Runtime/Graphics/Shaders/CModelShadersMetal.cpp b/Runtime/Graphics/Shaders/CModelShadersMetal.cpp index 38eb0b5af..46b720065 100644 --- a/Runtime/Graphics/Shaders/CModelShadersMetal.cpp +++ b/Runtime/Graphics/Shaders/CModelShadersMetal.cpp @@ -250,9 +250,21 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, - hecl::Backend::CullMode::None, true, false, true); + hecl::Backend::CullMode::None, false, false, true); /* Forced additive shading without culling */ + ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, + 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::None, false, false, true); + + /* Forced alpha shading without culling or Z-write */ + ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, + 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, + hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original, + hecl::Backend::CullMode::None, true, false, true); + + /* Forced additive shading without culling or Z-write */ ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha, hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original, diff --git a/Runtime/Graphics/Shaders/CParticleSwooshShadersMetal.cpp b/Runtime/Graphics/Shaders/CParticleSwooshShadersMetal.cpp index 2e995a681..d51cda37d 100644 --- a/Runtime/Graphics/Shaders/CParticleSwooshShadersMetal.cpp +++ b/Runtime/Graphics/Shaders/CParticleSwooshShadersMetal.cpp @@ -39,7 +39,7 @@ static const char* VS = static const char* FS_TEX = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 pos [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CPhazonSuitFilterMetal.cpp b/Runtime/Graphics/Shaders/CPhazonSuitFilterMetal.cpp index 6aa263d0a..8c32c9bde 100644 --- a/Runtime/Graphics/Shaders/CPhazonSuitFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CPhazonSuitFilterMetal.cpp @@ -49,7 +49,7 @@ static const char* VS = static const char* IndFS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" @@ -75,7 +75,7 @@ static const char* IndFS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n" +"constexpr sampler samp(address::clamp_to_edge, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 color;\n" @@ -128,7 +128,7 @@ static const char* BlurVS = static const char* BlurFS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n" +"constexpr sampler samp(address::clamp_to_edge, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CSpaceWarpFilterMetal.cpp b/Runtime/Graphics/Shaders/CSpaceWarpFilterMetal.cpp index f84bec6ba..52a1f9054 100644 --- a/Runtime/Graphics/Shaders/CSpaceWarpFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CSpaceWarpFilterMetal.cpp @@ -41,7 +41,7 @@ static const char* VS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CTextSupportShaderMetal.cpp b/Runtime/Graphics/Shaders/CTextSupportShaderMetal.cpp index de1b1b250..9037ae5be 100644 --- a/Runtime/Graphics/Shaders/CTextSupportShaderMetal.cpp +++ b/Runtime/Graphics/Shaders/CTextSupportShaderMetal.cpp @@ -50,7 +50,7 @@ static const char* TextVS = static const char* TextFS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n" +"constexpr sampler samp(address::clamp_to_edge, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 pos [[ position ]];\n" @@ -105,7 +105,7 @@ static const char* ImgVS = static const char* ImgFS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n" +"constexpr sampler samp(address::clamp_to_edge, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 pos [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp index 334b16b8a..c300ba3c4 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilterGLSL.cpp @@ -30,6 +30,7 @@ BOO_GLSL_BINDING_HEAD "{\n" " vtf.color = color;\n" " vtf.uv = uvIn.xy;\n" +" vtf.uv.y = 1.0 - vtf.uv.y;\n" " vtf.lod = lod;\n" " gl_Position = mtx * vec4(posIn.xyz, 1.0);\n" " gl_Position = FLIPFROMGL(gl_Position);\n" @@ -108,19 +109,23 @@ static boo::ObjToken s_AlphaPipeline; static boo::ObjToken s_AlphaGEqualPipeline; static boo::ObjToken s_AddPipeline; static boo::ObjToken s_MultPipeline; +static boo::ObjToken s_AlphaFlipPipeline; +static boo::ObjToken s_AlphaGEqualFlipPipeline; +static boo::ObjToken s_AddFlipPipeline; +static boo::ObjToken s_MultFlipPipeline; -static boo::ObjToken SelectPipeline(EFilterType type, bool gequal) +static boo::ObjToken SelectPipeline(EFilterType type, bool gequal, bool flip) { if (gequal) - return s_AlphaGEqualPipeline; + return flip ? s_AlphaGEqualFlipPipeline : s_AlphaGEqualPipeline; switch (type) { case EFilterType::Blend: - return s_AlphaPipeline; + return flip ? s_AlphaFlipPipeline : s_AlphaPipeline; case EFilterType::Add: - return s_AddPipeline; + return flip ? s_AddFlipPipeline : s_AddPipeline; case EFilterType::Multiply: - return s_MultPipeline; + return flip ? s_MultFlipPipeline : s_MultPipeline; default: return {}; } @@ -161,7 +166,8 @@ struct CTexturedQuadFilterGLDataBindingFactory : TMultiBlendShader bufs[] = {filter.m_uniBuf.get()}; boo::PipelineStage stages[] = {boo::PipelineStage::Vertex}; boo::ObjToken texs[] = {filter.m_booTex.get()}; - return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal), + return cctx.newShaderDataBinding(SelectPipeline(type, filter.m_gequal, + filter.m_booTex->type() == boo::TextureType::Render), ctx.newVertexFormat(2, VtxVmt), filter.m_vbo.get(), nullptr, nullptr, 1, bufs, stages, nullptr, nullptr, 1, texs, nullptr, nullptr); } @@ -202,6 +208,18 @@ CTexturedQuadFilter::Initialize(boo::GLDataFactory::Context& ctx) s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::Zero, boo::BlendFactor::SrcColor, boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); + s_AlphaFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, + boo::ZTest::None, false, true, false, boo::CullMode::None); + s_AlphaGEqualFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, + boo::ZTest::GEqual, true, true, false, boo::CullMode::None); + s_AddFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + boo::BlendFactor::One, boo::Primitive::TriStrips, + boo::ZTest::None, false, true, false, boo::CullMode::None); + s_MultFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, 1, texNames, 1, uniNames, boo::BlendFactor::Zero, + boo::BlendFactor::SrcColor, boo::Primitive::TriStrips, + boo::ZTest::None, false, true, false, boo::CullMode::None); return new CTexturedQuadFilterGLDataBindingFactory; } @@ -212,6 +230,10 @@ void CTexturedQuadFilter::Shutdown() s_AlphaGEqualPipeline.reset(); s_AddPipeline.reset(); s_MultPipeline.reset(); + s_AlphaFlipPipeline.reset(); + s_AlphaGEqualFlipPipeline.reset(); + s_AddFlipPipeline.reset(); + s_MultFlipPipeline.reset(); } #if BOO_HAS_VULKAN @@ -236,6 +258,18 @@ CTexturedQuadFilter::Initialize(boo::VulkanDataFactory::Context& ctx) s_MultPipeline = ctx.newShaderPipeline(VSNoFlip, FS, s_VtxFmt, boo::BlendFactor::Zero, boo::BlendFactor::SrcColor, boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); + s_AlphaFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha, + boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, + boo::ZTest::None, false, true, false, boo::CullMode::None); + s_AlphaGEqualFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha, + boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, + boo::ZTest::GEqual, true, true, false, boo::CullMode::None); + s_AddFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, s_VtxFmt, boo::BlendFactor::SrcAlpha, + boo::BlendFactor::One, boo::Primitive::TriStrips, + boo::ZTest::None, false, true, false, boo::CullMode::None); + s_MultFlipPipeline = ctx.newShaderPipeline(VSFlip, FS, s_VtxFmt, boo::BlendFactor::Zero, + boo::BlendFactor::SrcColor, boo::Primitive::TriStrips, + boo::ZTest::None, false, true, false, boo::CullMode::None); return new CTexturedQuadFilterVulkanDataBindingFactory; } @@ -247,6 +281,10 @@ void CTexturedQuadFilter::Shutdown() s_AlphaGEqualPipeline.reset(); s_AddPipeline.reset(); s_MultPipeline.reset(); + s_AlphaFlipPipeline.reset(); + s_AlphaGEqualFlipPipeline.reset(); + s_AddFlipPipeline.reset(); + s_MultFlipPipeline.reset(); } #endif @@ -296,13 +334,13 @@ CTexturedQuadFilterAlpha::Initialize(boo::GLDataFactory::Context& ctx) { const char* texNames[] = {"tex"}; const char* uniNames[] = {"TexuredQuadUniform"}; - s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + s_AAlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); - s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, + s_AAddPipeline = ctx.newShaderPipeline(VSNoFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); - s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::Zero, + s_AMultPipeline = ctx.newShaderPipeline(VSNoFlip, FSAlpha, 1, texNames, 1, uniNames, boo::BlendFactor::Zero, boo::BlendFactor::SrcColor, boo::Primitive::TriStrips, boo::ZTest::None, false, true, false, boo::CullMode::None); return new CTexturedQuadFilterAlphaGLDataBindingFactory; @@ -326,13 +364,13 @@ CTexturedQuadFilterAlpha::Initialize(boo::VulkanDataFactory::Context& ctx) {nullptr, nullptr, boo::VertexSemantic::UV4} }; s_AVtxFmt = ctx.newVertexFormat(2, VtxVmt); - s_AAlphaPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha, + s_AAlphaPipeline = ctx.newShaderPipeline(VSNoFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha, boo::BlendFactor::InvSrcAlpha, boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None); - s_AAddPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha, + s_AAddPipeline = ctx.newShaderPipeline(VSNoFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::SrcAlpha, boo::BlendFactor::One, boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None); - s_AMultPipeline = ctx.newShaderPipeline(VSFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::Zero, + s_AMultPipeline = ctx.newShaderPipeline(VSNoFlip, FSAlpha, s_AVtxFmt, boo::BlendFactor::Zero, boo::BlendFactor::SrcColor, boo::Primitive::TriStrips, boo::ZTest::None, false, true, true, boo::CullMode::None); return new CTexturedQuadFilterAlphaVulkanDataBindingFactory; diff --git a/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp b/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp index bad1693e7..9e74c114f 100644 --- a/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CTexturedQuadFilterMetal.cpp @@ -77,7 +77,7 @@ static const char* VSNoFlip = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n" +"constexpr sampler samp(address::clamp_to_edge, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" @@ -94,7 +94,7 @@ static const char* FS = static const char* FSAlpha = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::clamp_to_edge, filter::linear);\n" +"constexpr sampler samp(address::clamp_to_edge, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CThermalColdFilterMetal.cpp b/Runtime/Graphics/Shaders/CThermalColdFilterMetal.cpp index e06874f7c..ea8e3d57a 100644 --- a/Runtime/Graphics/Shaders/CThermalColdFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CThermalColdFilterMetal.cpp @@ -56,7 +56,7 @@ static const char* VS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CThermalHotFilterMetal.cpp b/Runtime/Graphics/Shaders/CThermalHotFilterMetal.cpp index 49cd6f2fc..c8b66e20e 100644 --- a/Runtime/Graphics/Shaders/CThermalHotFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CThermalHotFilterMetal.cpp @@ -39,7 +39,7 @@ static const char* VS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/Graphics/Shaders/CXRayBlurFilterMetal.cpp b/Runtime/Graphics/Shaders/CXRayBlurFilterMetal.cpp index 1adcdd909..e71d5c67f 100644 --- a/Runtime/Graphics/Shaders/CXRayBlurFilterMetal.cpp +++ b/Runtime/Graphics/Shaders/CXRayBlurFilterMetal.cpp @@ -49,7 +49,7 @@ static const char* VS = static const char* FS = "#include \n" "using namespace metal;\n" -"constexpr sampler samp(address::repeat, filter::linear);\n" +"constexpr sampler samp(address::repeat, filter::linear, mip_filter::linear);\n" "struct VertToFrag\n" "{\n" " float4 position [[ position ]];\n" diff --git a/Runtime/GuiSys/CAuiImagePane.cpp b/Runtime/GuiSys/CAuiImagePane.cpp index 78e1d1a7d..3b5e916b2 100644 --- a/Runtime/GuiSys/CAuiImagePane.cpp +++ b/Runtime/GuiSys/CAuiImagePane.cpp @@ -50,7 +50,8 @@ void CAuiImagePane::Update(float dt) } CAuiImagePane::Filters::Filters(TLockedToken& tex) -: m_darkenerQuad(EFilterType::Blend, tex), +: m_texId(tex.GetObjectTag()->id), + 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}} @@ -89,8 +90,8 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t { {xe0_coords[0], (*useUVs)[0] + xd0_uvBias0}, {xe0_coords[1], (*useUVs)[1] + xd0_uvBias0}, - {xe0_coords[2], (*useUVs)[2] + xd0_uvBias0}, - {xe0_coords[3], (*useUVs)[3] + xd0_uvBias0} + {xe0_coords[3], (*useUVs)[3] + xd0_uvBias0}, + {xe0_coords[2], (*useUVs)[2] + xd0_uvBias0} }; if (noBlur) @@ -116,7 +117,7 @@ void CAuiImagePane::Draw(const CGuiWidgetDrawParms& params) const if (!GetIsVisible() || !xb8_tex0Tok.IsLoaded()) return; GetIsFinishedLoadingWidgetSpecific(); - if (!m_filters) + if (!m_filters || m_filters->m_texId != xb8_tex0Tok.GetObjectTag()->id) const_cast(this)->m_filters.emplace(const_cast(this)->xb8_tex0Tok); Filters& filters = const_cast(*m_filters); zeus::CColor color = xa8_color2; diff --git a/Runtime/GuiSys/CAuiImagePane.hpp b/Runtime/GuiSys/CAuiImagePane.hpp index d4e22aa83..53a311357 100644 --- a/Runtime/GuiSys/CAuiImagePane.hpp +++ b/Runtime/GuiSys/CAuiImagePane.hpp @@ -27,6 +27,7 @@ class CAuiImagePane : public CGuiWidget float x150_flashFactor = 0.f; struct Filters { + CAssetId m_texId; CTexturedQuadFilterAlpha m_darkenerQuad; CTexturedQuadFilterAlpha m_flashQuad[2]; CTexturedQuadFilterAlpha m_alphaQuad[2]; diff --git a/Runtime/GuiSys/CGuiModel.cpp b/Runtime/GuiSys/CGuiModel.cpp index ef5886fb6..72d84d548 100644 --- a/Runtime/GuiSys/CGuiModel.cpp +++ b/Runtime/GuiSys/CGuiModel.cpp @@ -80,6 +80,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const { CModelFlags flags(5, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol); flags.m_noCull = !xb6_29_cullFaces; + flags.m_noZWrite = !xb7_24_depthWrite; model->Draw(flags); break; } @@ -87,6 +88,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const { CModelFlags flags(7, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol); flags.m_noCull = !xb6_29_cullFaces; + flags.m_noZWrite = !xb7_24_depthWrite; model->Draw(flags); break; } @@ -94,6 +96,7 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const { CModelFlags flags(5, 0, xb6_31_depthTest, moduCol); flags.m_noCull = !xb6_29_cullFaces; + flags.m_noZWrite = !xb7_24_depthWrite; model->Draw(flags); flags.x0_blendMode = 7; diff --git a/Runtime/GuiSys/CTextExecuteBuffer.cpp b/Runtime/GuiSys/CTextExecuteBuffer.cpp index 26e540d07..d6b4004f2 100644 --- a/Runtime/GuiSys/CTextExecuteBuffer.cpp +++ b/Runtime/GuiSys/CTextExecuteBuffer.cpp @@ -200,7 +200,7 @@ int CTextExecuteBuffer::WrapOneLTR(const char16_t* str, int len) if (x18_textState.x7c_enableWordWrap) { if (w + xa4_curLine->x8_curX > xa0_curBlock->xc_blockExtentX && - xa4_curLine->x4_wordCount > 1 && + xa4_curLine->x4_wordCount >= 1 && xb0_curX + w < xa0_curBlock->xc_blockExtentX) { MoveWordLTR(); diff --git a/Runtime/GuiSys/CTextParser.cpp b/Runtime/GuiSys/CTextParser.cpp index 46d54ba97..4b533e858 100644 --- a/Runtime/GuiSys/CTextParser.cpp +++ b/Runtime/GuiSys/CTextParser.cpp @@ -71,19 +71,17 @@ s32 CTextParser::ParseInt(const char16_t* str, int len, bool signVal) bool CTextParser::Equals(const char16_t* str, int len, const char16_t* other) { - int i=0; - for (; *other && iIsGameDraw()) { x34_samusHud->GetTargetingManager().Draw(stateMgr, true); - CGraphics::SetDepthRange(0.015625f, 0.03125f); + CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); bool scanVisor = stateMgr.GetPlayerState()->GetActiveVisor(stateMgr) == CPlayerState::EPlayerVisor::Scan; if (drawVisor && x1f0_enablePlayerVisor) { @@ -612,7 +612,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) x40_samusReflection->Draw(stateMgr); if (drawVisor) { - CGraphics::SetDepthRange(0.001953125f, 0.015625f); + CGraphics::SetDepthRange(DEPTH_HUD, DEPTH_SCREEN_ACTORS); if (staticAlpha > 0.f) m_randomStatic.draw(zeus::CColor(1.f, staticAlpha), 1.f); x34_samusHud->Draw(stateMgr, x1f4_visorStaticAlpha * (1.f - staticAlpha), @@ -621,7 +621,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) } } - float preDrawBlur = true; + bool preDrawBlur = true; if (x1bc_prevState >= EInGameGuiState::Zero && x1bc_prevState <= EInGameGuiState::InGame) if (x1bc_prevState != EInGameGuiState::MapScreen && x1c0_nextState != EInGameGuiState::MapScreen) preDrawBlur = false; @@ -647,7 +647,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) mapAlpha = 0.f; x34_samusHud->GetBaseHudFrame()->GetFrameCamera()->Draw(CGuiWidgetDrawParms(0.f, zeus::CVector3f::skZero)); - CGraphics::SetDepthRange(0.f, 0.001953125f); + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_HUD); x148_model_automapper->SetIsVisible(true); x148_model_automapper->Draw(CGuiWidgetDrawParms(1.f, zeus::CVector3f::skZero)); // ZTest no write diff --git a/Runtime/MP1/CLogBookScreen.cpp b/Runtime/MP1/CLogBookScreen.cpp index 866b7358e..34c53b873 100644 --- a/Runtime/MP1/CLogBookScreen.cpp +++ b/Runtime/MP1/CLogBookScreen.cpp @@ -30,6 +30,7 @@ CLogBookScreen::~CLogBookScreen() bool CLogBookScreen::IsScanComplete(CSaveWorld::EScanCategory category, CAssetId scan, const CPlayerState& playerState) { + return true; float time = playerState.GetScanTime(scan); if (category == CSaveWorld::EScanCategory::Artifact) return time >= 0.5f; @@ -148,9 +149,14 @@ void CLogBookScreen::PumpArticleLoad() { scan.second = g_SimplePool->GetObj({FOURCC('STRG'), scan.first->GetStringTableId()}); scan.second.Lock(); + --rem; } } - if (--rem == 0) + else if (scan.first.IsLocked()) + { + --rem; + } + if (rem == 0) break; } @@ -161,6 +167,8 @@ void CLogBookScreen::PumpArticleLoad() { x1f0_curViewScans[articleIdx].first.Lock(); articleIdx = NextSurroundingArticleIndex(articleIdx); + if (articleIdx == -1) + break; --rem; } } @@ -322,7 +330,7 @@ void CLogBookScreen::Update(float dt, CRandom16& rand, CArchitectureQueue& archQ x70_tablegroup_leftlog->SetColor(invColor); x84_tablegroup_rightlog->SetColor(invColor); x17c_model_textalpha->SetColor(invColor); - x174_textpane_body->SetColor(invColor); + x174_textpane_body->SetColor(color); for (CAuiImagePane* pane : xf0_imagePanes) pane->SetDeResFactor(1.f - x254_viewInterp); diff --git a/Runtime/MP1/COptionsScreen.cpp b/Runtime/MP1/COptionsScreen.cpp index 49636afb7..9f19691d2 100644 --- a/Runtime/MP1/COptionsScreen.cpp +++ b/Runtime/MP1/COptionsScreen.cpp @@ -112,9 +112,14 @@ void COptionsScreen::Update(float dt, CRandom16& rand, CArchitectureQueue& archQ (x18c_slidergroup_slider->GetState() != CGuiSliderGroup::EState::None)) { if (x18c_slidergroup_slider->GetState() != CGuiSliderGroup::EState::None) + { x1a4_sliderSfx = CSfxManager::SfxStart(1451, 1.f, 0.f, false, 0x7f, false, kInvalidAreaId); + } else + { CSfxManager::SfxStop(x1a4_sliderSfx); + x1a4_sliderSfx.reset(); + } } if (x2a0_24_inOptionBody) @@ -181,9 +186,9 @@ void COptionsScreen::Draw(float transInterp, float totalAlpha, float yOff) x1a0_gameCube->Draw(transInterp * (1.f - x29c_optionAlpha)); if (x19c_quitGame) { - CGraphics::SetDepthRange(0.f, 0.001f); + CGraphics::SetDepthRange(DEPTH_NEAR, 0.001f); x19c_quitGame->Draw(); - CGraphics::SetDepthRange(0.f, 1.f); + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR); } } diff --git a/Runtime/MP1/CPauseScreenBase.cpp b/Runtime/MP1/CPauseScreenBase.cpp index 2c86b9b85..f1474dab9 100644 --- a/Runtime/MP1/CPauseScreenBase.cpp +++ b/Runtime/MP1/CPauseScreenBase.cpp @@ -28,11 +28,13 @@ void CPauseScreenBase::InitializeFrameGlue() x6c_basewidget_leftlog = x8_frame.FindWidget("basewidget_leftlog"); x70_tablegroup_leftlog = static_cast(x8_frame.FindWidget("tablegroup_leftlog")); x74_basewidget_leftguages = x8_frame.FindWidget("basewidget_leftguages"); + x74_basewidget_leftguages->SetColor(zeus::CColor(1.f, 0.f)); x78_model_lefthighlight = static_cast(x8_frame.FindWidget("model_lefthighlight")); x7c_basewidget_rightside = x8_frame.FindWidget("basewidget_rightside"); x80_basewidget_rightlog = x8_frame.FindWidget("basewidget_rightlog"); x84_tablegroup_rightlog = static_cast(x8_frame.FindWidget("tablegroup_rightlog")); x88_basewidget_rightguages = x8_frame.FindWidget("basewidget_rightguages"); + x88_basewidget_rightguages->SetColor(zeus::CColor(1.f, 0.f)); x8c_model_righthighlight = static_cast(x8_frame.FindWidget("model_righthighlight")); x90_model_textarrowtop = static_cast(x8_frame.FindWidget("model_textarrowtop")); x94_model_textarrowbottom = static_cast(x8_frame.FindWidget("model_textarrowbottom")); @@ -44,6 +46,7 @@ void CPauseScreenBase::InitializeFrameGlue() x178_textpane_title = static_cast(x8_frame.FindWidget("textpane_title")); x178_textpane_title->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor()); x174_textpane_body = static_cast(x8_frame.FindWidget("textpane_body")); + x174_textpane_body->SetColor(zeus::CColor(1.f, 0.f)); x174_textpane_body->SetIsVisible(true); x174_textpane_body->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor()); x174_textpane_body->TextSupport().SetPage(0); diff --git a/Runtime/MP1/CPauseScreenBlur.cpp b/Runtime/MP1/CPauseScreenBlur.cpp index be744a7f4..a25305826 100644 --- a/Runtime/MP1/CPauseScreenBlur.cpp +++ b/Runtime/MP1/CPauseScreenBlur.cpp @@ -98,7 +98,7 @@ void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool b) void CPauseScreenBlur::Draw(const CStateManager&) const { - const_cast(x1c_camBlur).Draw(); + const_cast(x1c_camBlur).Draw(true); float t = std::fabs(x18_blurAmt); if (x1c_camBlur.GetCurrType() != EBlurType::NoBlur) { diff --git a/Runtime/MP1/CPlayerVisor.cpp b/Runtime/MP1/CPlayerVisor.cpp index d15c82775..70721eea4 100644 --- a/Runtime/MP1/CPlayerVisor.cpp +++ b/Runtime/MP1/CPlayerVisor.cpp @@ -14,6 +14,7 @@ namespace urde::MP1 { CPlayerVisor::CPlayerVisor(CStateManager&) +: x108_newScanPane(EFilterType::Blend, CGraphics::g_SpareTexture.get()) { x25_24_visorTransitioning = false; x25_25_ = false; @@ -22,7 +23,7 @@ CPlayerVisor::CPlayerVisor(CStateManager&) xe4_scanFrameCenterTop = g_SimplePool->GetObj("CMDL_ScanFrameCenterTop"); xf0_scanFrameStretchSide = g_SimplePool->GetObj("CMDL_ScanFrameStretchSide"); xfc_scanFrameStretchTop = g_SimplePool->GetObj("CMDL_ScanFrameStretchTop"); - x108_newScanPane = g_SimplePool->GetObj("CMDL_NewScanPane"); + //x108_newScanPane = g_SimplePool->GetObj("CMDL_NewScanPane"); x114_scanShield = g_SimplePool->GetObj("CMDL_ScanShield"); x124_scanIconNoncritical = g_SimplePool->GetObj("CMDL_ScanIconNoncritical"); x130_scanIconCritical = g_SimplePool->GetObj("CMDL_ScanIconCritical"); @@ -68,7 +69,7 @@ bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const if (!x114_scanShield.IsLoaded()) return false; - CGraphics::SetDepthRange(0.125f, 1.f); + CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); g_Renderer->SetViewportOrtho(true, 0.f, 4096.f); CGraphics::SetModelMatrix( @@ -144,7 +145,7 @@ bool CPlayerVisor::DrawScanObjectIndicators(const CStateManager& mgr) const } } - CGraphics::SetDepthRange(0.015625f, 0.03125f); + CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); return true; } @@ -335,7 +336,7 @@ void CPlayerVisor::LockUnlockAssets() xe4_scanFrameCenterTop.Lock(); xf0_scanFrameStretchSide.Lock(); xfc_scanFrameStretchTop.Lock(); - x108_newScanPane.Lock(); + //x108_newScanPane.Lock(); x114_scanShield.Lock(); x124_scanIconNoncritical.Lock(); x130_scanIconCritical.Lock(); @@ -347,7 +348,7 @@ void CPlayerVisor::LockUnlockAssets() xe4_scanFrameCenterTop.Unlock(); xf0_scanFrameStretchSide.Unlock(); xfc_scanFrameStretchTop.Unlock(); - x108_newScanPane.Unlock(); + //x108_newScanPane.Unlock(); x114_scanShield.Unlock(); x124_scanIconNoncritical.Unlock(); x130_scanIconCritical.Unlock(); @@ -359,9 +360,9 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana bool indicatorsDrawn = DrawScanObjectIndicators(mgr); if (tgtMgr && indicatorsDrawn) { - CGraphics::SetDepthRange(0.12500012f, 0.12500012f); + CGraphics::SetDepthRange(DEPTH_TARGET_MANAGER, DEPTH_TARGET_MANAGER); tgtMgr->Draw(mgr, false); - CGraphics::SetDepthRange(0.015625f, 0.03125f); + CGraphics::SetDepthRange(DEPTH_SCREEN_ACTORS, DEPTH_GUN); } float transFactor = mgr.GetPlayerState()->GetVisorTransitionFactor(); @@ -374,11 +375,13 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana else t = (x3c_windowInterpTimer > scanSidesStart) ? 1.f : x3c_windowInterpTimer / scanSidesStart; + float vpScale = g_Viewport.xc_height / 448.f; float divisor = (transFactor * ((1.f - t) * x58_scanMagInterp + t * g_tweakGui->GetScanWindowScanningAspect()) + (1.f - transFactor)); - float vpW = 169.218f * x48_interpWindowDims.x / divisor; - vpW = zeus::clamp(0.f, vpW, 640.f) * g_Viewport.x8_width / 640.f; - float vpH = 152.218f * x48_interpWindowDims.y / divisor; - vpH = zeus::clamp(0.f, vpH, 448.f) * g_Viewport.xc_height / 448.f; + divisor = 1.f / divisor; + float vpW = 169.218f * x48_interpWindowDims.x * divisor; + vpW = zeus::clamp(0.f, vpW, 640.f) * vpScale; + float vpH = 152.218f * x48_interpWindowDims.y * divisor; + vpH = zeus::clamp(0.f, vpH, 448.f) * vpScale; SClipScreenRect rect; rect.x4_left = (g_Viewport.x8_width - vpW) / 2.f; @@ -392,20 +395,17 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana g_Renderer->SetViewportOrtho(true, -1.f, 1.f); zeus::CTransform windowScale = zeus::CTransform::Scale(x48_interpWindowDims.x, 1.f, x48_interpWindowDims.y); - zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f, 1.f, 17.f); + zeus::CTransform seventeenScale = zeus::CTransform::Scale(17.f * vpScale, 1.f, 17.f * vpScale); CGraphics::SetModelMatrix(seventeenScale * windowScale); - if (x108_newScanPane.IsLoaded()) + CTexturedQuadFilter::Vert rttVerts[4] = { - if (!m_newScanPaneInst) - { - CPlayerVisor* ncThis = const_cast(this); - boo::ObjToken texs[8] = {CGraphics::g_SpareTexture.get()}; - ncThis->m_newScanPaneInst = ncThis->x108_newScanPane->MakeNewInstance(0, 1, texs); - ncThis->m_newScanPaneInst->VerifyCurrentShader(0); - } - m_newScanPaneInst->Draw(CModelFlags(5, 0, 3 | 4, zeus::CColor(1.f, transFactor)), nullptr, nullptr); - } + {{-5.f, 0.f, 4.45f}, {rect.x4_left / float(g_Viewport.x8_width), rect.x8_top / float(g_Viewport.xc_height)}}, + {{ 5.f, 0.f, 4.45f}, {(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width), rect.x8_top / float(g_Viewport.xc_height)}}, + {{-5.f, 0.f, -4.45f}, {rect.x4_left / float(g_Viewport.x8_width), (rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height)}}, + {{ 5.f, 0.f, -4.45f}, {(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width), (rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height)}} + }; + const_cast(x108_newScanPane).drawVerts(zeus::CColor(1.f, transFactor), rttVerts); // No cull faces @@ -418,6 +418,7 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, const CTargetingMana CModelFlags flags(5, 0, 0, frameColor + g_tweakGuiColors->GetScanFrameImpulseColor() * zeus::CColor(x550_frameColorImpulseInterp, x550_frameColorImpulseInterp)); + flags.m_noCull = true; zeus::CTransform verticalFlip = zeus::CTransform::Scale(1.f, 1.f, -1.f); zeus::CTransform horizontalFlip = zeus::CTransform::Scale(-1.f, 1.f, 1.f); diff --git a/Runtime/MP1/CPlayerVisor.hpp b/Runtime/MP1/CPlayerVisor.hpp index fa7f1b0f7..e2a1f60fd 100644 --- a/Runtime/MP1/CPlayerVisor.hpp +++ b/Runtime/MP1/CPlayerVisor.hpp @@ -8,6 +8,7 @@ #include "CPlayerState.hpp" #include "Graphics/CModel.hpp" #include "Graphics/Shaders/CColoredQuadFilter.hpp" +#include "Graphics/Shaders/CTexturedQuadFilter.hpp" namespace urde { @@ -61,7 +62,8 @@ class CPlayerVisor TCachedToken xe4_scanFrameCenterTop; TCachedToken xf0_scanFrameStretchSide; TCachedToken xfc_scanFrameStretchTop; - TCachedToken x108_newScanPane; + //TCachedToken x108_newScanPane; + CTexturedQuadFilter x108_newScanPane; TCachedToken x114_scanShield; int x120_assetLockCountdown = 0; TCachedToken x124_scanIconNoncritical; @@ -71,8 +73,6 @@ class CPlayerVisor float x54c_frameColorInterp = 0.f; float x550_frameColorImpulseInterp = 0.f; - std::unique_ptr m_newScanPaneInst; - int FindEmptyInactiveScanTarget() const; int FindCachedInactiveScanTarget(TUniqueId uid) const; bool DrawScanObjectIndicators(const CStateManager& mgr) const; diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index b1679075c..dd11f712d 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -2481,7 +2481,7 @@ void CPlayerGun::Render(const CStateManager& mgr, const zeus::CVector3f& pos, co beamFlags.x4_color = zeus::CColor::lerp(zeus::CColor::skWhite, zeus::CColor::skBlack, x39c_phazonMorphT); const CGameCamera* cam = mgr.GetCameraManager()->GetCurrentCamera(mgr); - CGraphics::SetDepthRange(0.03125f, 0.125f); + CGraphics::SetDepthRange(DEPTH_GUN, DEPTH_WORLD); zeus::CTransform offsetWorldXf = zeus::CTransform::Translate(pos) * x4a8_gunWorldXf; zeus::CTransform elbowOffsetXf = offsetWorldXf * x508_elbowLocalXf; if (x32c_chargePhase != EChargePhase::NotCharging && (x2f8_stateFlags & 0x10) != 0x10) @@ -2568,7 +2568,7 @@ void CPlayerGun::Render(const CStateManager& mgr, const zeus::CVector3f& pos, co RenderEnergyDrainEffects(mgr); - CGraphics::SetDepthRange(0.125f, 1.f); + CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); CGraphics::SetProjectionState(projState); } diff --git a/Runtime/World/CMorphBallShadow.cpp b/Runtime/World/CMorphBallShadow.cpp index 0acc437e5..47a8cdf85 100644 --- a/Runtime/World/CMorphBallShadow.cpp +++ b/Runtime/World/CMorphBallShadow.cpp @@ -49,7 +49,7 @@ void CMorphBallShadow::RenderIdBuffer(const zeus::CAABox& aabb, const CStateMana (aabb.min.y + aabb.max.y) * 0.5f, aabb.max.z)); - CGraphics::SetDepthRange(0.f, 1.f); + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR); float vpX = (aabb.max.x - aabb.min.x) * 0.5f; float vpY = (aabb.max.y - aabb.min.y) * 0.5f; float vpZ = (aabb.max.z - aabb.min.z) + FLT_EPSILON; diff --git a/Runtime/World/CScriptSpawnPoint.cpp b/Runtime/World/CScriptSpawnPoint.cpp index c69c06b53..9b007760f 100644 --- a/Runtime/World/CScriptSpawnPoint.cpp +++ b/Runtime/World/CScriptSpawnPoint.cpp @@ -8,9 +8,9 @@ namespace urde { -CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const CEntityInfo& info, - const zeus::CTransform& xf, const std::vector& itemCounts, bool defaultSpawn, - bool active, bool morphed) +CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, + const rstl::reserved_vector& itemCounts, + bool defaultSpawn, bool active, bool morphed) : CEntity(uid, info, active, name), x34_xf(xf), x64_itemCounts(itemCounts) { x10c_24_firstSpawn = defaultSpawn; @@ -76,7 +76,7 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI u32 CScriptSpawnPoint::GetPowerup(CPlayerState::EItemType item) const { int idx = int(item); - if (idx >= x64_itemCounts.size()) + if (idx >= int(CPlayerState::EItemType::Max) || idx < 0) return x64_itemCounts.front(); return x64_itemCounts[idx]; } diff --git a/Runtime/World/CScriptSpawnPoint.hpp b/Runtime/World/CScriptSpawnPoint.hpp index 1dfd5f44d..c6302c2f9 100644 --- a/Runtime/World/CScriptSpawnPoint.hpp +++ b/Runtime/World/CScriptSpawnPoint.hpp @@ -11,7 +11,7 @@ namespace urde class CScriptSpawnPoint : public CEntity { zeus::CTransform x34_xf; - std::vector x64_itemCounts; + rstl::reserved_vector x64_itemCounts; union { struct @@ -22,8 +22,8 @@ class CScriptSpawnPoint : public CEntity u8 _dummy = 0; }; public: - CScriptSpawnPoint(TUniqueId, std::string_view name, const CEntityInfo& info, - const zeus::CTransform& xf, const std::vector& itemCounts, + CScriptSpawnPoint(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, + const rstl::reserved_vector& itemCounts, bool, bool, bool); void Accept(IVisitor& visitor); diff --git a/Runtime/World/CWorld.cpp b/Runtime/World/CWorld.cpp index 15df8cbe8..e47b98c5d 100644 --- a/Runtime/World/CWorld.cpp +++ b/Runtime/World/CWorld.cpp @@ -709,12 +709,12 @@ void CWorld::DrawSky(const zeus::CTransform& xf) const CGraphics::DisableAllLights(); CGraphics::SetModelMatrix(xf); g_Renderer->SetAmbientColor(zeus::CColor::skWhite); - CGraphics::SetDepthRange(0.999f, 1.f); + CGraphics::SetDepthRange(DEPTH_SKY, DEPTH_FAR); CModelFlags flags(0, 0, 1, zeus::CColor::skWhite); model->Draw(flags); - CGraphics::SetDepthRange(0.125f, 1.f); + CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); } void CWorld::StopGlobalSound(u16 id) diff --git a/Runtime/World/CWorldShadow.cpp b/Runtime/World/CWorldShadow.cpp index 1a72f52f8..b026f60e4 100644 --- a/Runtime/World/CWorldShadow.cpp +++ b/Runtime/World/CWorldShadow.cpp @@ -73,7 +73,7 @@ void CWorldShadow::BuildLightShadowTexture(const CStateManager& mgr, TAreaId aid zeus::CVector2f backupDepthRange = CGraphics::g_CachedDepthRange; m_shader.bindRenderTarget(); g_Renderer->SetViewport(0, 0, m_shader.GetWidth(), m_shader.GetHeight()); - CGraphics::SetDepthRange(0.f, 1.f); + CGraphics::SetDepthRange(DEPTH_NEAR, DEPTH_FAR); x34_model = zeus::lookAt(centerPoint - zeus::CVector3f(0.f, 0.f, 0.1f), light.GetPosition()); CGraphics::SetModelMatrix(x34_model); diff --git a/Runtime/World/ScriptLoader.cpp b/Runtime/World/ScriptLoader.cpp index 1a85438ac..881a2d74b 100644 --- a/Runtime/World/ScriptLoader.cpp +++ b/Runtime/World/ScriptLoader.cpp @@ -823,10 +823,10 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int zeus::CVector3f rotation; rotation.readBig(in); - std::vector itemCounts; - itemCounts.reserve(propCount - 6); + rstl::reserved_vector itemCounts; + itemCounts.resize(size_t(CPlayerState::EItemType::Max)); for (int i = 0; i < propCount - 6; ++i) - itemCounts.push_back(in.readUint32Big()); + itemCounts[i] = in.readUint32Big(); bool defaultSpawn = in.readBool(); bool active = in.readBool(); diff --git a/hecl b/hecl index 2961e49fb..c29999e1d 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 2961e49fbd209d442b4fa4f3ef9387dc526bcae9 +Subproject commit c29999e1d9e000980c4dfcb3265dd5fee53af044