Water rendering order fix, morphball visor fixes

This commit is contained in:
Jack Andersen 2018-06-21 11:04:16 -10:00
parent cd3bba2f0e
commit 718d2cb29e
13 changed files with 40 additions and 32 deletions

View File

@ -113,8 +113,12 @@ struct CTweakBall final : public ITweakBall
CTweakBall(athena::io::IStreamReader& r) CTweakBall(athena::io::IStreamReader& r)
{ {
this->read(r); this->read(r);
x6c_ = -x6c_;
x70_ = -x70_;
x74_ballCameraAnglePerSecond = zeus::degToRad(x74_ballCameraAnglePerSecond); x74_ballCameraAnglePerSecond = zeus::degToRad(x74_ballCameraAnglePerSecond);
x90_ = zeus::degToRad(x90_); x90_ = zeus::degToRad(x90_);
xe4_ballGravity = -xe4_ballGravity;
xe8_ballWaterGravity = -xe8_ballWaterGravity;
x15c_ = zeus::degToRad(x15c_); x15c_ = zeus::degToRad(x15c_);
x16c_ = zeus::degToRad(x16c_); x16c_ = zeus::degToRad(x16c_);
x174_ = zeus::degToRad(x174_); x174_ = zeus::degToRad(x174_);

View File

@ -613,11 +613,11 @@ zeus::CFrustum CStateManager::SetupDrawFrustum(const SViewport& vp) const
zeus::CFrustum ret; zeus::CFrustum ret;
const CGameCamera* cam = x870_cameraManager->GetCurrentCamera(*this); const CGameCamera* cam = x870_cameraManager->GetCurrentCamera(*this);
zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this); zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this);
//int vpWidth = xf2c_viewportScale.x * vp.x8_width; int vpWidth = xf2c_viewportScale.x * vp.x8_width;
//int vpHeight = xf2c_viewportScale.y * vp.xc_height; int vpHeight = xf2c_viewportScale.y * vp.xc_height;
//int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left; int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left;
//int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top; int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top;
//g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight); g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight);
float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y) * 2.f; 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 width = xf2c_viewportScale.x * vp.x8_width;
float height = xf2c_viewportScale.y * vp.xc_height; float height = xf2c_viewportScale.y * vp.xc_height;
@ -633,11 +633,11 @@ zeus::CFrustum CStateManager::SetupViewForDraw(const SViewport& vp) const
zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this); zeus::CTransform camXf = x870_cameraManager->GetCurrentCameraTransform(*this);
g_Renderer->SetWorldViewpoint(camXf); g_Renderer->SetWorldViewpoint(camXf);
CBooModel::SetNewPlayerPositionAndTime(x84c_player->GetTranslation()); CBooModel::SetNewPlayerPositionAndTime(x84c_player->GetTranslation());
//int vpWidth = xf2c_viewportScale.x * vp.x8_width; int vpWidth = xf2c_viewportScale.x * vp.x8_width;
//int vpHeight = xf2c_viewportScale.y * vp.xc_height; int vpHeight = xf2c_viewportScale.y * vp.xc_height;
//int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left; int vpLeft = (vp.x8_width - vpWidth) / 2 + vp.x0_left;
//int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top; int vpTop = (vp.xc_height - vpHeight) / 2 + vp.x4_top;
//g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight); g_Renderer->SetViewport(vpLeft, vpTop, vpWidth, vpHeight);
CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR); CGraphics::SetDepthRange(DEPTH_WORLD, DEPTH_FAR);
float fov = std::atan(std::tan(zeus::degToRad(cam->GetFov()) * 0.5f) * xf2c_viewportScale.y) * 2.f; 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 width = xf2c_viewportScale.x * vp.x8_width;

View File

@ -11,6 +11,7 @@
#include "zeus/CUnitVector.hpp" #include "zeus/CUnitVector.hpp"
#include "Graphics/CSkinnedModel.hpp" #include "Graphics/CSkinnedModel.hpp"
#include "zeus/CVector3d.hpp" #include "zeus/CVector3d.hpp"
#include "World/CActor.hpp"
#define FOGVOL_RAMP_RES 256 #define FOGVOL_RAMP_RES 256
#define FOGVOL_FAR 750.0 #define FOGVOL_FAR 750.0
@ -109,6 +110,7 @@ void Buckets::Sort()
cont = planeObj.x3c_24_invertTest ? (!partial || !full) : (partial || full); cont = planeObj.x3c_24_invertTest ? (!partial || !full) : (partial || full);
if (!cont) if (!cont)
break; break;
slot += precision;
} }
} }

View File

@ -50,7 +50,7 @@ public:
static void Init(); static void Init();
}; };
class CBooRenderer : public IRenderer class CBooRenderer final : public IRenderer
{ {
friend class CBooModel; friend class CBooModel;
friend class CModel; friend class CModel;

View File

@ -322,8 +322,8 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
/* Depth GEqual no Z-write */ /* Depth GEqual no Z-write */
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"}, ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original, 3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::GEqual, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::GEqual,
hecl::Backend::CullMode::Backface, true, false, true); hecl::Backend::CullMode::Backface, true, false, true);
return ext; return ext;

View File

@ -302,8 +302,8 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
/* Depth GEqual no Z-write */ /* Depth GEqual no Z-write */
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"}, ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::Original, 0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::GEqual, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::GEqual,
hecl::Backend::CullMode::Backface, true, false, true); hecl::Backend::CullMode::Backface, true, false, true);
return ext; return ext;

View File

@ -312,8 +312,8 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
/* Depth GEqual no Z-write */ /* Depth GEqual no Z-write */
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"}, ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::Original, 1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::GEqual, hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::GEqual,
hecl::Backend::CullMode::Backface, true, false, true); hecl::Backend::CullMode::Backface, true, false, true);
return ext; return ext;

View File

@ -118,7 +118,7 @@ public:
const zeus::CColor& GetGeometryColor() const { return xa8_color2; } const zeus::CColor& GetGeometryColor() const { return xa8_color2; }
void SetIdlePosition(const zeus::CVector3f& pos, bool reapply); void SetIdlePosition(const zeus::CVector3f& pos, bool reapply);
void ReapplyXform(); void ReapplyXform();
void SetIsVisible(bool); virtual void SetIsVisible(bool);
void SetIsActive(bool); void SetIsActive(bool);
bool GetIsSelectable() const { return xb6_27_isSelectable; } bool GetIsSelectable() const { return xb6_27_isSelectable; }
void SetIsSelectable(bool v) { xb6_27_isSelectable = v; } void SetIsSelectable(bool v) { xb6_27_isSelectable = v; }

View File

@ -269,18 +269,16 @@ void CHudVisorBeamMenu::Update(float dt, bool init)
UpdateMenuWidgetTransform(x8_selectedItem, *x24_model_ghost, x28_menuItems[x8_selectedItem].x8_positioner); UpdateMenuWidgetTransform(x8_selectedItem, *x24_model_ghost, x28_menuItems[x8_selectedItem].x8_positioner);
} }
if (x1c_basewidget_menutitle->GetGeometryColor().a) if (!x14_24_visibleDebug || !x14_25_visibleGame)
x1c_basewidget_menutitle->SetVisibility(true, ETraversalMode::Children); return;
else
x1c_basewidget_menutitle->SetVisibility(false, ETraversalMode::Children); x1c_basewidget_menutitle->SetVisibility
(x1c_basewidget_menutitle->GetGeometryColor().a != 0.f, ETraversalMode::Children);
for (int i=0 ; i<4 ; ++i) for (int i=0 ; i<4 ; ++i)
{ {
SMenuItem& item = x28_menuItems[i]; SMenuItem& item = x28_menuItems[i];
if (item.x4_model_icon->GetGeometryColor().a) item.x4_model_icon->SetIsVisible(item.x4_model_icon->GetGeometryColor().a != 0.f);
item.x4_model_icon->SetIsVisible(true);
else
item.x4_model_icon->SetIsVisible(false);
} }
} }

View File

@ -558,8 +558,8 @@ void CPlayerVisor::BeginTransitionIn(const CStateManager&)
{ {
case CPlayerState::EPlayerVisor::XRay: case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f); x90_xrayBlur.SetBlur(EBlurType::Xray, 0.f, 0.f);
xc4_vpScaleX = 0.9f; //xc4_vpScaleX = 0.9f;
xc8_vpScaleY = 0.9f; //xc8_vpScaleY = 0.9f;
CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId); CSfxManager::SfxStart(1383, x24_visorSfxVol, 0.f, false, 0x7f, false, kInvalidAreaId);
break; break;
case CPlayerState::EPlayerVisor::Scan: case CPlayerState::EPlayerVisor::Scan:
@ -579,8 +579,8 @@ void CPlayerVisor::FinishTransitionOut(const CStateManager&)
{ {
case CPlayerState::EPlayerVisor::XRay: case CPlayerState::EPlayerVisor::XRay:
x90_xrayBlur.DisableBlur(0.f); x90_xrayBlur.DisableBlur(0.f);
xc4_vpScaleX = 1.f; //xc4_vpScaleX = 1.f;
xc8_vpScaleY = 1.f; //xc8_vpScaleY = 1.f;
break; break;
case CPlayerState::EPlayerVisor::Scan: case CPlayerState::EPlayerVisor::Scan:
x64_scanDim.DisableFilter(0.f); x64_scanDim.DisableFilter(0.f);

View File

@ -1268,7 +1268,9 @@ void CSamusHud::Update(float dt, const CStateManager& mgr,
default: break; default: break;
} }
x500_viewportScale.y = 1.f - morphT * g_tweakGui->GetBallViewportYReduction(); float aspect = g_Viewport.x8_width / float(g_Viewport.xc_height);
float scaleMul = 1.f - zeus::clamp(0.f, (aspect - 1.33f) / (1.77f - 1.33f), 1.f);
x500_viewportScale.y = 1.f - scaleMul * morphT * g_tweakGui->GetBallViewportYReduction() * 1.2f;
if (x2b0_ballIntf) if (x2b0_ballIntf)
x2b0_ballIntf->SetBallModeFactor(morphT); x2b0_ballIntf->SetBallModeFactor(morphT);

View File

@ -38,6 +38,7 @@ void CMorphBallShadow::RenderIdBuffer(const zeus::CAABox& aabb, const CStateMana
GatherAreas(mgr); GatherAreas(mgr);
SViewport backupVp = g_Viewport;
g_Renderer->BindBallShadowIdTarget(); g_Renderer->BindBallShadowIdTarget();
CGraphics::g_BooMainCommandQueue->clearTarget(); CGraphics::g_BooMainCommandQueue->clearTarget();
@ -94,6 +95,7 @@ void CMorphBallShadow::RenderIdBuffer(const zeus::CAABox& aabb, const CStateMana
g_Renderer->BindMainDrawTarget(); g_Renderer->BindMainDrawTarget();
CGraphics::SetViewPointMatrix(backupViewMtx); CGraphics::SetViewPointMatrix(backupViewMtx);
CGraphics::SetProjectionState(backupProjection); CGraphics::SetProjectionState(backupProjection);
g_Renderer->SetViewport(backupVp.x0_left, backupVp.x4_top, backupVp.x8_width, backupVp.xc_height);
CGraphics::SetDepthRange(backupDepth[0], backupDepth[1]); CGraphics::SetDepthRange(backupDepth[0], backupDepth[1]);
xd0_hasIds = alphaVal != 4; xd0_hasIds = alphaVal != 4;

2
amuse

@ -1 +1 @@
Subproject commit d7011f0e77c2cce57d0195f07e325e7415794676 Subproject commit 1e8ce19b167c80706ed396d32d1cc573c2b2a7ee