HUD rendering bug fixes

This commit is contained in:
Jack Andersen 2018-01-05 20:50:42 -10:00
parent a78c4c6b36
commit 168fab6b14
47 changed files with 254 additions and 120 deletions

View File

@ -202,6 +202,8 @@ struct SCAN : BigYAML
void gatherDependencies(std::vector<hecl::ProjectPath>& 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);
}

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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<const CActor*>(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<const CActor*>(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)

View File

@ -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);
}
}

View File

@ -109,7 +109,7 @@ class CCameraBlurPass
mutable std::experimental::optional<CXRayBlurFilter> 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);

View File

@ -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)
{

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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"

View File

@ -39,7 +39,7 @@ static const char* VS =
static const char* FS =
"#include <metal_stdlib>\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"

View File

@ -62,7 +62,7 @@ static const char* VS =
static const char* FS =
"#include <metal_stdlib>\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 <metal_stdlib>\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"

View File

@ -40,7 +40,7 @@ static const char* VS =
static const char* FS1Way =
"#include <metal_stdlib>\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 <metal_stdlib>\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"

View File

@ -28,7 +28,9 @@ enum EExtendedShader : uint8_t
MorphBallShadow,
WorldShadow,
ForcedAlphaNoCull,
ForcedAdditiveNoCull
ForcedAdditiveNoCull,
ForcedAlphaNoCullNoZWrite,
ForcedAdditiveNoCullNoZWrite
};
class CModelShaders

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -39,7 +39,7 @@ static const char* VS =
static const char* FS_TEX =
"#include <metal_stdlib>\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"

View File

@ -49,7 +49,7 @@ static const char* VS =
static const char* IndFS =
"#include <metal_stdlib>\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 <metal_stdlib>\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 <metal_stdlib>\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"

View File

@ -41,7 +41,7 @@ static const char* VS =
static const char* FS =
"#include <metal_stdlib>\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"

View File

@ -50,7 +50,7 @@ static const char* TextVS =
static const char* TextFS =
"#include <metal_stdlib>\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 <metal_stdlib>\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"

View File

@ -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<boo::IShaderPipeline> s_AlphaPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaFlipPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AlphaGEqualFlipPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_AddFlipPipeline;
static boo::ObjToken<boo::IShaderPipeline> s_MultFlipPipeline;
static boo::ObjToken<boo::IShaderPipeline> SelectPipeline(EFilterType type, bool gequal)
static boo::ObjToken<boo::IShaderPipeline> 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<CTexturedQuad
boo::ObjToken<boo::IGraphicsBuffer> bufs[] = {filter.m_uniBuf.get()};
boo::PipelineStage stages[] = {boo::PipelineStage::Vertex};
boo::ObjToken<boo::ITexture> 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<boo::GLDataFactory>()
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<boo::VulkanDataFactory>()
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;

View File

@ -77,7 +77,7 @@ static const char* VSNoFlip =
static const char* FS =
"#include <metal_stdlib>\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 <metal_stdlib>\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"

View File

@ -56,7 +56,7 @@ static const char* VS =
static const char* FS =
"#include <metal_stdlib>\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"

View File

@ -39,7 +39,7 @@ static const char* VS =
static const char* FS =
"#include <metal_stdlib>\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"

View File

@ -49,7 +49,7 @@ static const char* VS =
static const char* FS =
"#include <metal_stdlib>\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"

View File

@ -50,7 +50,8 @@ void CAuiImagePane::Update(float dt)
}
CAuiImagePane::Filters::Filters(TLockedToken<CTexture>& 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<CAuiImagePane*>(this)->m_filters.emplace(const_cast<CAuiImagePane*>(this)->xb8_tex0Tok);
Filters& filters = const_cast<Filters&>(*m_filters);
zeus::CColor color = xa8_color2;

View File

@ -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];

View File

@ -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;

View File

@ -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();

View File

@ -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 && i<len ; ++i, ++str, ++other)
for (int i=0 ; *other && i<len ; ++i, ++str, ++other)
{
if (*str != *other)
return false;
}
return other[i] == u'\0';
return *other == u'\0';
}
bool CTextParser::BeginsWith(const char16_t* str, int len, const char16_t* other)
{
int i=0;
for (; *other && i<len ; ++i, ++str, ++other)
for (int i=0 ; *other && i<len ; ++i, ++str, ++other)
{
if (*str != *other)
return false;

View File

@ -598,7 +598,7 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr)
//if (x3c_pauseScreenBlur->IsGameDraw())
{
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

View File

@ -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);

View File

@ -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);
}
}

View File

@ -28,11 +28,13 @@ void CPauseScreenBase::InitializeFrameGlue()
x6c_basewidget_leftlog = x8_frame.FindWidget("basewidget_leftlog");
x70_tablegroup_leftlog = static_cast<CGuiTableGroup*>(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<CGuiModel*>(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<CGuiTableGroup*>(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<CGuiModel*>(x8_frame.FindWidget("model_righthighlight"));
x90_model_textarrowtop = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textarrowtop"));
x94_model_textarrowbottom = static_cast<CGuiModel*>(x8_frame.FindWidget("model_textarrowbottom"));
@ -44,6 +46,7 @@ void CPauseScreenBase::InitializeFrameGlue()
x178_textpane_title = static_cast<CGuiTextPane*>(x8_frame.FindWidget("textpane_title"));
x178_textpane_title->TextSupport().SetFontColor(g_tweakGuiColors->GetPauseItemAmberColor());
x174_textpane_body = static_cast<CGuiTextPane*>(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);

View File

@ -98,7 +98,7 @@ void CPauseScreenBlur::Update(float dt, const CStateManager& stateMgr, bool b)
void CPauseScreenBlur::Draw(const CStateManager&) const
{
const_cast<CCameraBlurPass&>(x1c_camBlur).Draw();
const_cast<CCameraBlurPass&>(x1c_camBlur).Draw(true);
float t = std::fabs(x18_blurAmt);
if (x1c_camBlur.GetCurrType() != EBlurType::NoBlur)
{

View File

@ -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<CPlayerVisor*>(this);
boo::ObjToken<boo::ITexture> 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<CTexturedQuadFilter&>(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);

View File

@ -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<CModel> xe4_scanFrameCenterTop;
TCachedToken<CModel> xf0_scanFrameStretchSide;
TCachedToken<CModel> xfc_scanFrameStretchTop;
TCachedToken<CModel> x108_newScanPane;
//TCachedToken<CModel> x108_newScanPane;
CTexturedQuadFilter x108_newScanPane;
TCachedToken<CModel> x114_scanShield;
int x120_assetLockCountdown = 0;
TCachedToken<CModel> x124_scanIconNoncritical;
@ -71,8 +73,6 @@ class CPlayerVisor
float x54c_frameColorInterp = 0.f;
float x550_frameColorImpulseInterp = 0.f;
std::unique_ptr<CBooModel> m_newScanPaneInst;
int FindEmptyInactiveScanTarget() const;
int FindCachedInactiveScanTarget(TUniqueId uid) const;
bool DrawScanObjectIndicators(const CStateManager& mgr) const;

View File

@ -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);
}

View File

@ -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;

View File

@ -8,9 +8,9 @@
namespace urde
{
CScriptSpawnPoint::CScriptSpawnPoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& xf, const std::vector<u32>& 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<u32, int(CPlayerState::EItemType::Max)>& 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];
}

View File

@ -11,7 +11,7 @@ namespace urde
class CScriptSpawnPoint : public CEntity
{
zeus::CTransform x34_xf;
std::vector<u32> x64_itemCounts;
rstl::reserved_vector<u32, int(CPlayerState::EItemType::Max)> 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<u32>& itemCounts,
CScriptSpawnPoint(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
const rstl::reserved_vector<u32, int(CPlayerState::EItemType::Max)>& itemCounts,
bool, bool, bool);
void Accept(IVisitor& visitor);

View File

@ -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)

View File

@ -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);

View File

@ -823,10 +823,10 @@ CEntity* ScriptLoader::LoadSpawnPoint(CStateManager& mgr, CInputStream& in, int
zeus::CVector3f rotation;
rotation.readBig(in);
std::vector<u32> itemCounts;
itemCounts.reserve(propCount - 6);
rstl::reserved_vector<u32, int(CPlayerState::EItemType::Max)> 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();

2
hecl

@ -1 +1 @@
Subproject commit 2961e49fbd209d442b4fa4f3ef9387dc526bcae9
Subproject commit c29999e1d9e000980c4dfcb3265dd5fee53af044