mirror of https://github.com/AxioDL/metaforce.git
Various fixes
This commit is contained in:
parent
5e03278eff
commit
8901ac2150
|
@ -811,7 +811,7 @@ bool MREA::CookPath(const hecl::ProjectPath& outPath,
|
||||||
PATH::UnknownStruct& s = path.unkStructs.back();
|
PATH::UnknownStruct& s = path.unkStructs.back();
|
||||||
s.unk1 = 1;
|
s.unk1 = 1;
|
||||||
s.unk2[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX};
|
s.unk2[0] = atVec3f{FLT_MAX, FLT_MAX, FLT_MAX};
|
||||||
s.unk2[1] = atVec3f{FLT_MIN, FLT_MIN, FLT_MIN};
|
s.unk2[1] = atVec3f{-FLT_MAX, -FLT_MAX, -FLT_MAX};
|
||||||
s.unk2[2] = atVec3f{0.f, 0.f, 0.f};
|
s.unk2[2] = atVec3f{0.f, 0.f, 0.f};
|
||||||
for (int i=0 ; i<8 ; ++i)
|
for (int i=0 ; i<8 ; ++i)
|
||||||
s.unk3[i] = ~0;
|
s.unk3[i] = ~0;
|
||||||
|
|
|
@ -741,7 +741,7 @@ void CMapWorld::RecalculateWorldSphere(const CMapWorldInfo& mwInfo, const IWorld
|
||||||
std::vector<zeus::CVector2f> coords;
|
std::vector<zeus::CVector2f> coords;
|
||||||
coords.reserve(x0_areas.size() * 8);
|
coords.reserve(x0_areas.size() * 8);
|
||||||
float zMin = FLT_MAX;
|
float zMin = FLT_MAX;
|
||||||
float zMax = FLT_MIN;
|
float zMax = -FLT_MAX;
|
||||||
for (int i=0 ; i<x0_areas.size() ; ++i)
|
for (int i=0 ; i<x0_areas.size() ; ++i)
|
||||||
{
|
{
|
||||||
if (IsMapAreaValid(wld, i, true))
|
if (IsMapAreaValid(wld, i, true))
|
||||||
|
|
|
@ -17,6 +17,8 @@ static bool BoxLineTest(const zeus::CAABox& aabb, const zeus::CLine& line, float
|
||||||
const float* aabbMax = &aabb.max.x;
|
const float* aabbMax = &aabb.max.x;
|
||||||
const float* lorigin = &line.origin.x;
|
const float* lorigin = &line.origin.x;
|
||||||
const float* ldir = &line.dir.x;
|
const float* ldir = &line.dir.x;
|
||||||
|
lT = -FLT_MAX;
|
||||||
|
hT = FLT_MAX;
|
||||||
|
|
||||||
for (int i=0 ; i<3 ; ++i)
|
for (int i=0 ; i<3 ; ++i)
|
||||||
{
|
{
|
||||||
|
@ -27,16 +29,16 @@ static bool BoxLineTest(const zeus::CAABox& aabb, const zeus::CLine& line, float
|
||||||
if (*ldir < 0.f)
|
if (*ldir < 0.f)
|
||||||
{
|
{
|
||||||
if (*aabbMax - *lorigin < lT * *ldir)
|
if (*aabbMax - *lorigin < lT * *ldir)
|
||||||
lT = *aabbMax - *lorigin * 1.f / *ldir;
|
lT = (*aabbMax - *lorigin) * 1.f / *ldir;
|
||||||
if (*aabbMin - *lorigin > hT * *ldir)
|
if (*aabbMin - *lorigin > hT * *ldir)
|
||||||
hT = *aabbMin - *lorigin * 1.f / *ldir;
|
hT = (*aabbMin - *lorigin) * 1.f / *ldir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (*aabbMin - *lorigin > lT * *ldir)
|
if (*aabbMin - *lorigin > lT * *ldir)
|
||||||
lT = *aabbMin - *lorigin * 1.f / *ldir;
|
lT = (*aabbMin - *lorigin) * 1.f / *ldir;
|
||||||
if (*aabbMax - *lorigin < hT * *ldir)
|
if (*aabbMax - *lorigin < hT * *ldir)
|
||||||
hT = *aabbMax - *lorigin * 1.f / *ldir;
|
hT = (*aabbMax - *lorigin) * 1.f / *ldir;
|
||||||
}
|
}
|
||||||
|
|
||||||
++aabbMin;
|
++aabbMin;
|
||||||
|
|
|
@ -381,12 +381,14 @@ CGameCollision::RayWorldIntersection(const CStateManager& mgr, TUniqueId& idOut,
|
||||||
CRayCastResult staticRes = RayStaticIntersection(mgr, pos, dir, mag, filter);
|
CRayCastResult staticRes = RayStaticIntersection(mgr, pos, dir, mag, filter);
|
||||||
CRayCastResult dynamicRes = RayDynamicIntersection(mgr, idOut, pos, dir, mag, filter, nearList);
|
CRayCastResult dynamicRes = RayDynamicIntersection(mgr, idOut, pos, dir, mag, filter, nearList);
|
||||||
|
|
||||||
if (!dynamicRes.IsInvalid() && staticRes.IsInvalid())
|
if (dynamicRes.IsValid())
|
||||||
return dynamicRes;
|
{
|
||||||
else if (staticRes.GetT() >= dynamicRes.GetT())
|
if (staticRes.IsInvalid())
|
||||||
return dynamicRes;
|
return dynamicRes;
|
||||||
else
|
else if (staticRes.GetT() >= dynamicRes.GetT())
|
||||||
return staticRes;
|
return dynamicRes;
|
||||||
|
}
|
||||||
|
return staticRes;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CGameCollision::RayStaticIntersectionArea(const CGameArea& area, const zeus::CVector3f& pos,
|
bool CGameCollision::RayStaticIntersectionArea(const CGameArea& area, const zeus::CVector3f& pos,
|
||||||
|
|
|
@ -26,7 +26,9 @@ enum EExtendedShader : uint8_t
|
||||||
SolidColorBackfaceCullLEqualAlphaOnly,
|
SolidColorBackfaceCullLEqualAlphaOnly,
|
||||||
SolidColorBackfaceCullGreaterAlphaOnly, // No Z-write
|
SolidColorBackfaceCullGreaterAlphaOnly, // No Z-write
|
||||||
MorphBallShadow,
|
MorphBallShadow,
|
||||||
WorldShadow
|
WorldShadow,
|
||||||
|
ForcedAlphaNoCull,
|
||||||
|
ForcedAdditiveNoCull
|
||||||
};
|
};
|
||||||
|
|
||||||
class CModelShaders
|
class CModelShaders
|
||||||
|
|
|
@ -186,61 +186,61 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
|
||||||
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::Original,
|
||||||
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Thermal Visor shading */
|
/* Thermal Visor shading */
|
||||||
ext.registerExtensionSlot({}, {ThermalPostGLSL, "ThermalPostFunc"}, 3, ThermalBlockNames,
|
ext.registerExtensionSlot({}, {ThermalPostGLSL, "ThermalPostFunc"}, 3, ThermalBlockNames,
|
||||||
1, ThermalTextures, hecl::Backend::BlendFactor::One,
|
1, ThermalTextures, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Forced alpha shading */
|
/* Forced alpha shading */
|
||||||
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
|
||||||
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Forced additive shading */
|
/* Forced additive shading */
|
||||||
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingGLSL, "LightingFunc"}, {MainPostGLSL, "MainPostFunc"},
|
||||||
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
3, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
||||||
false, true, false, true);
|
hecl::Backend::CullMode::Backface, true, false, true);
|
||||||
|
|
||||||
/* Solid color */
|
/* Solid color */
|
||||||
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
||||||
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
|
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
||||||
false, false, false, false);
|
hecl::Backend::CullMode::Backface, false, false, false);
|
||||||
|
|
||||||
/* Solid color additive */
|
/* Solid color additive */
|
||||||
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
||||||
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
false, true, false, true);
|
hecl::Backend::CullMode::Backface, true, false, true);
|
||||||
|
|
||||||
/* Alpha-only Solid color frontface cull, LEqual */
|
/* Alpha-only Solid color frontface cull, LEqual */
|
||||||
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
||||||
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
true, false, true, false);
|
hecl::Backend::CullMode::Frontface, false, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color frontface cull, Always, No Z-write */
|
/* Alpha-only Solid color frontface cull, Always, No Z-write */
|
||||||
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
||||||
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None,
|
||||||
true, true, true, false);
|
hecl::Backend::CullMode::Frontface, true, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color backface cull, LEqual */
|
/* Alpha-only Solid color backface cull, LEqual */
|
||||||
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
||||||
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
false, false, true, false);
|
hecl::Backend::CullMode::Backface, false, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color backface cull, Greater, No Z-write */
|
/* Alpha-only Solid color backface cull, Greater, No Z-write */
|
||||||
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostGLSL, "SolidPostFunc"},
|
||||||
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
3, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater,
|
||||||
false, true, true, false);
|
hecl::Backend::CullMode::Backface, true, true, false);
|
||||||
|
|
||||||
/* MorphBall shadow shading */
|
/* MorphBall shadow shading */
|
||||||
ext.registerExtensionSlot({}, {MBShadowPostGLSL, "MBShadowPostFunc"},
|
ext.registerExtensionSlot({}, {MBShadowPostGLSL, "MBShadowPostFunc"},
|
||||||
|
@ -248,13 +248,25 @@ CModelShaders::GetShaderExtensionsGLSL(boo::IGraphicsDataFactory::Platform plat)
|
||||||
hecl::Backend::BlendFactor::SrcAlpha,
|
hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha,
|
hecl::Backend::BlendFactor::InvSrcAlpha,
|
||||||
hecl::Backend::ZTest::Equal,
|
hecl::Backend::ZTest::Equal,
|
||||||
false, false, false, true, true);
|
hecl::Backend::CullMode::Backface, false, false, true, true);
|
||||||
|
|
||||||
/* World shadow shading (modified lighting) */
|
/* World shadow shading (modified lighting) */
|
||||||
ext.registerExtensionSlot({LightingShadowGLSL, "LightingShadowFunc"}, {MainPostGLSL, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingShadowGLSL, "LightingShadowFunc"}, {MainPostGLSL, "MainPostFunc"},
|
||||||
3, BlockNames, 1, WorldShadowTextures, hecl::Backend::BlendFactor::Original,
|
3, BlockNames, 1, WorldShadowTextures, hecl::Backend::BlendFactor::Original,
|
||||||
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
|
/* Forced alpha shading without culling */
|
||||||
|
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, 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, true, false, true);
|
||||||
|
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,61 +169,61 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
|
||||||
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::Original,
|
||||||
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Thermal Visor shading */
|
/* Thermal Visor shading */
|
||||||
ext.registerExtensionSlot({}, {ThermalPostHLSL, "ThermalPostFunc"}, 0, nullptr,
|
ext.registerExtensionSlot({}, {ThermalPostHLSL, "ThermalPostFunc"}, 0, nullptr,
|
||||||
1, ThermalTextures, hecl::Backend::BlendFactor::One,
|
1, ThermalTextures, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Forced alpha shading */
|
/* Forced alpha shading */
|
||||||
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Forced additive shading */
|
/* Forced additive shading */
|
||||||
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingHLSL, "LightingFunc"}, {MainPostHLSL, "MainPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
||||||
false, true, false, true);
|
hecl::Backend::CullMode::Backface, true, false, true);
|
||||||
|
|
||||||
/* Solid color */
|
/* Solid color */
|
||||||
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
||||||
false, false, false, false);
|
hecl::Backend::CullMode::Backface, false, false, false);
|
||||||
|
|
||||||
/* Solid color additive */
|
/* Solid color additive */
|
||||||
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
false, true, false, true);
|
hecl::Backend::CullMode::Backface, true, false, true);
|
||||||
|
|
||||||
/* Alpha-only Solid color frontface cull, LEqual */
|
/* Alpha-only Solid color frontface cull, LEqual */
|
||||||
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
||||||
true, false, true, false);
|
hecl::Backend::CullMode::Frontface, false, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color frontface cull, Always, No Z-write */
|
/* Alpha-only Solid color frontface cull, Always, No Z-write */
|
||||||
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::None,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::None,
|
||||||
true, true, true, false);
|
hecl::Backend::CullMode::Frontface, true, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color backface cull, LEqual */
|
/* Alpha-only Solid color backface cull, LEqual */
|
||||||
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
||||||
false, false, true, false);
|
hecl::Backend::CullMode::Backface, false, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color backface cull, Greater, No Z-write */
|
/* Alpha-only Solid color backface cull, Greater, No Z-write */
|
||||||
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostHLSL, "SolidPostFunc"},
|
||||||
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
0, nullptr, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::Greater,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::Greater,
|
||||||
false, true, true, false);
|
hecl::Backend::CullMode::Backface, true, true, false);
|
||||||
|
|
||||||
/* MorphBall shadow shading */
|
/* MorphBall shadow shading */
|
||||||
ext.registerExtensionSlot({}, {MBShadowPostHLSL, "MBShadowPostFunc"},
|
ext.registerExtensionSlot({}, {MBShadowPostHLSL, "MBShadowPostFunc"},
|
||||||
|
@ -231,13 +231,25 @@ CModelShaders::GetShaderExtensionsHLSL(boo::IGraphicsDataFactory::Platform plat)
|
||||||
hecl::Backend::BlendFactor::SrcAlpha,
|
hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha,
|
hecl::Backend::BlendFactor::InvSrcAlpha,
|
||||||
hecl::Backend::ZTest::Equal,
|
hecl::Backend::ZTest::Equal,
|
||||||
false, false, false, true, true);
|
hecl::Backend::CullMode::Backface, false, false, true, true);
|
||||||
|
|
||||||
/* World shadow shading (modified lighting) */
|
/* World shadow shading (modified lighting) */
|
||||||
ext.registerExtensionSlot({LightingShadowHLSL, "LightingShadowFunc"}, {MainPostHLSL, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingShadowHLSL, "LightingShadowFunc"}, {MainPostHLSL, "MainPostFunc"},
|
||||||
0, nullptr, 1, WorldShadowTextures, hecl::Backend::BlendFactor::Original,
|
0, nullptr, 1, WorldShadowTextures, hecl::Backend::BlendFactor::Original,
|
||||||
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
|
/* Forced alpha shading without culling */
|
||||||
|
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, 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, true, false, true);
|
||||||
|
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,61 +176,61 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
|
||||||
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::Original,
|
||||||
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Thermal Visor shading */
|
/* Thermal Visor shading */
|
||||||
ext.registerExtensionSlot({}, {ThermalPostMetal, "EXTThermalPostFunc"}, 1, ThermalBlockNames,
|
ext.registerExtensionSlot({}, {ThermalPostMetal, "EXTThermalPostFunc"}, 1, ThermalBlockNames,
|
||||||
1, ThermalTextures, hecl::Backend::BlendFactor::One,
|
1, ThermalTextures, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Forced alpha shading */
|
/* Forced alpha shading */
|
||||||
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
|
||||||
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::InvSrcAlpha, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
/* Forced additive shading */
|
/* Forced additive shading */
|
||||||
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingMetal, "LightingFunc"}, {MainPostMetal, "MainPostFunc"},
|
||||||
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
1, BlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Original,
|
||||||
false, true, false, true);
|
hecl::Backend::CullMode::Backface, true, false, true);
|
||||||
|
|
||||||
/* Solid color */
|
/* Solid color */
|
||||||
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
||||||
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
|
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::One,
|
||||||
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::Zero, hecl::Backend::ZTest::LEqual,
|
||||||
false, false, false, false);
|
hecl::Backend::CullMode::Backface, false, false, false);
|
||||||
|
|
||||||
/* Solid color additive */
|
/* Solid color additive */
|
||||||
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
||||||
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
false, true, false, true);
|
hecl::Backend::CullMode::Backface, true, false, true);
|
||||||
|
|
||||||
/* Alpha-only Solid color frontface cull, LEqual */
|
/* Alpha-only Solid color frontface cull, LEqual */
|
||||||
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
||||||
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
true, false, true, false);
|
hecl::Backend::CullMode::Frontface, false, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color frontface cull, Always, No Z-write */
|
/* Alpha-only Solid color frontface cull, Always, No Z-write */
|
||||||
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
||||||
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::None,
|
||||||
true, true, true, false);
|
hecl::Backend::CullMode::Frontface, true, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color backface cull, LEqual */
|
/* Alpha-only Solid color backface cull, LEqual */
|
||||||
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
||||||
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::LEqual,
|
||||||
false, false, true, false);
|
hecl::Backend::CullMode::Backface, false, true, false);
|
||||||
|
|
||||||
/* Alpha-only Solid color backface cull, Greater, No Z-write */
|
/* Alpha-only Solid color backface cull, Greater, No Z-write */
|
||||||
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
ext.registerExtensionSlot({}, {SolidPostMetal, "SolidPostFunc"},
|
||||||
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
1, SolidBlockNames, 0, nullptr, hecl::Backend::BlendFactor::Zero,
|
||||||
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater,
|
hecl::Backend::BlendFactor::One, hecl::Backend::ZTest::Greater,
|
||||||
false, true, true, false);
|
hecl::Backend::CullMode::Backface, true, true, false);
|
||||||
|
|
||||||
/* MorphBall shadow shading */
|
/* MorphBall shadow shading */
|
||||||
ext.registerExtensionSlot({}, {MBShadowPostMetal, "EXTMBShadowPostFunc"},
|
ext.registerExtensionSlot({}, {MBShadowPostMetal, "EXTMBShadowPostFunc"},
|
||||||
|
@ -238,13 +238,25 @@ CModelShaders::GetShaderExtensionsMetal(boo::IGraphicsDataFactory::Platform plat
|
||||||
hecl::Backend::BlendFactor::SrcAlpha,
|
hecl::Backend::BlendFactor::SrcAlpha,
|
||||||
hecl::Backend::BlendFactor::InvSrcAlpha,
|
hecl::Backend::BlendFactor::InvSrcAlpha,
|
||||||
hecl::Backend::ZTest::Equal,
|
hecl::Backend::ZTest::Equal,
|
||||||
false, false, false, true, true);
|
hecl::Backend::CullMode::Backface, false, false, true, true);
|
||||||
|
|
||||||
/* World shadow shading (modified lighting) */
|
/* World shadow shading (modified lighting) */
|
||||||
ext.registerExtensionSlot({LightingShadowMetal, "EXTLightingShadowFunc"}, {MainPostMetal, "MainPostFunc"},
|
ext.registerExtensionSlot({LightingShadowMetal, "EXTLightingShadowFunc"}, {MainPostMetal, "MainPostFunc"},
|
||||||
1, BlockNames, 1, WorldShadowTextures, hecl::Backend::BlendFactor::Original,
|
1, BlockNames, 1, WorldShadowTextures, hecl::Backend::BlendFactor::Original,
|
||||||
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
hecl::Backend::BlendFactor::Original, hecl::Backend::ZTest::Original,
|
||||||
false, false, false, true);
|
hecl::Backend::CullMode::Backface, false, false, true);
|
||||||
|
|
||||||
|
/* Forced alpha shading without culling */
|
||||||
|
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, 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, true, false, true);
|
||||||
|
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,8 +57,8 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
|
||||||
zeus::CColor moduCol = xa8_color2;
|
zeus::CColor moduCol = xa8_color2;
|
||||||
moduCol.a *= parms.x0_alphaMod;
|
moduCol.a *= parms.x0_alphaMod;
|
||||||
xb0_frame->EnableLights(x10c_lightMask, const_cast<CBooModel&>(model->GetInstance()));
|
xb0_frame->EnableLights(x10c_lightMask, const_cast<CBooModel&>(model->GetInstance()));
|
||||||
if (xb6_29_cullFaces)
|
//if (xb6_29_cullFaces)
|
||||||
CGraphics::SetCullMode(ERglCullMode::Front);
|
// CGraphics::SetCullMode(ERglCullMode::Front);
|
||||||
|
|
||||||
switch (xac_drawFlags)
|
switch (xac_drawFlags)
|
||||||
{
|
{
|
||||||
|
@ -79,36 +79,36 @@ void CGuiModel::Draw(const CGuiWidgetDrawParms& parms) const
|
||||||
case EGuiModelDrawFlags::Alpha:
|
case EGuiModelDrawFlags::Alpha:
|
||||||
{
|
{
|
||||||
CModelFlags flags(4, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
CModelFlags flags(4, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
||||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAlpha : EExtendedShader::ForcedAlphaNoCull;
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EGuiModelDrawFlags::Additive:
|
case EGuiModelDrawFlags::Additive:
|
||||||
{
|
{
|
||||||
CModelFlags flags(3, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
CModelFlags flags(3, 0, (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest), moduCol);
|
||||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAdditive : EExtendedShader::ForcedAdditiveNoCull;
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
case EGuiModelDrawFlags::AlphaAdditiveOverdraw:
|
||||||
{
|
{
|
||||||
CModelFlags flags(4, 0, xb6_31_depthTest, moduCol);
|
CModelFlags flags(4, 0, xb6_31_depthTest, moduCol);
|
||||||
flags.m_extendedShader = EExtendedShader::ForcedAlpha;
|
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAlpha : EExtendedShader::ForcedAlphaNoCull;
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
|
|
||||||
flags.x0_blendMode = 5;
|
flags.x0_blendMode = 5;
|
||||||
flags.x1_matSetIdx = 0;
|
flags.x1_matSetIdx = 0;
|
||||||
flags.x2_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
|
flags.x2_flags = (u32(xb7_24_depthWrite) << 1) | u32(xb6_31_depthTest);
|
||||||
flags.x4_color = moduCol;
|
flags.x4_color = moduCol;
|
||||||
flags.m_extendedShader = EExtendedShader::ForcedAdditive;
|
flags.m_extendedShader = xb6_29_cullFaces ? EExtendedShader::ForcedAdditive : EExtendedShader::ForcedAdditiveNoCull;
|
||||||
model->Draw(flags);
|
model->Draw(flags);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xb6_29_cullFaces)
|
//if (xb6_29_cullFaces)
|
||||||
CGraphics::SetCullMode(ERglCullMode::None);
|
// CGraphics::SetCullMode(ERglCullMode::None);
|
||||||
xb0_frame->DisableLights();
|
xb0_frame->DisableLights();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,7 @@ bool CElementGen::InternalUpdate(double dt)
|
||||||
while (t < x78_curSeconds && std::fabs(t - x78_curSeconds) >= 1.0 / 60000.0)
|
while (t < x78_curSeconds && std::fabs(t - x78_curSeconds) >= 1.0 / 60000.0)
|
||||||
{
|
{
|
||||||
x2d4_aabbMin.splat(FLT_MAX);
|
x2d4_aabbMin.splat(FLT_MAX);
|
||||||
x2e0_aabbMax.splat(FLT_MIN);
|
x2e0_aabbMax.splat(-FLT_MAX);
|
||||||
x2ec_maxSize = 0.f;
|
x2ec_maxSize = 0.f;
|
||||||
CParticleGlobals::SetEmitterTime(x74_curFrame);
|
CParticleGlobals::SetEmitterTime(x74_curFrame);
|
||||||
UpdateExistingParticles();
|
UpdateExistingParticles();
|
||||||
|
|
|
@ -125,7 +125,7 @@ void CParticleSwoosh::UpdateTranslationAndOrientation()
|
||||||
{
|
{
|
||||||
x208_maxRadius = 0.f;
|
x208_maxRadius = 0.f;
|
||||||
x1f0_aabbMin = FLT_MAX;
|
x1f0_aabbMin = FLT_MAX;
|
||||||
x1fc_aabbMax = FLT_MIN;
|
x1fc_aabbMax = -FLT_MAX;
|
||||||
CParticleGlobals::SetParticleLifetime(x1b4_LENG);
|
CParticleGlobals::SetParticleLifetime(x1b4_LENG);
|
||||||
CParticleGlobals::SetEmitterTime(x28_curFrame);
|
CParticleGlobals::SetEmitterTime(x28_curFrame);
|
||||||
|
|
||||||
|
|
|
@ -323,7 +323,6 @@ void CActor::SetRotation(const zeus::CQuaternion &q)
|
||||||
|
|
||||||
void CActor::SetTranslation(const zeus::CVector3f& tr)
|
void CActor::SetTranslation(const zeus::CVector3f& tr)
|
||||||
{
|
{
|
||||||
auto old = x34_transform.origin;
|
|
||||||
x34_transform.origin = tr;
|
x34_transform.origin = tr;
|
||||||
xe4_27_notInSortedLists = true;
|
xe4_27_notInSortedLists = true;
|
||||||
xe4_28_ = true;
|
xe4_28_ = true;
|
||||||
|
|
|
@ -2235,7 +2235,7 @@ void CPlayer::UpdateStepCameraZBias(float dt)
|
||||||
{
|
{
|
||||||
if (delta < -GetStepDownHeight())
|
if (delta < -GetStepDownHeight())
|
||||||
newDelta += -delta - GetStepDownHeight();
|
newDelta += -delta - GetStepDownHeight();
|
||||||
newBias = x9cc_stepCameraZBias + newDelta;
|
newBias = x9cc_stepCameraZBias - newDelta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3000,7 +3000,7 @@ void CPlayer::UpdateFootstepSounds(const CFinalInput& input, CStateManager& mgr,
|
||||||
if (x790_footstepSfxSel != EFootstepSfx::None && x78c_footstepSfxTimer > sfxDelay)
|
if (x790_footstepSfxSel != EFootstepSfx::None && x78c_footstepSfxTimer > sfxDelay)
|
||||||
{
|
{
|
||||||
static float EarHeight = GetEyeHeight() - 0.1f;
|
static float EarHeight = GetEyeHeight() - 0.1f;
|
||||||
if (xe6_24_fluidCounter != 0 && x828_distanceUnderWater > 0.f && x828_distanceUnderWater < EarHeight)
|
if (xe6_24_fluidCounter != 0 && x828_distanceUnderWater > 0.f && x828_distanceUnderWater < EarHeight)
|
||||||
{
|
{
|
||||||
if (x82c_inLava)
|
if (x82c_inLava)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,16 +15,19 @@ float CPlayerCameraBob::kMaxOrbitBobScale = 0.8f;
|
||||||
float CPlayerCameraBob::kSlowSpeedPeriodScale = 0.3f;
|
float CPlayerCameraBob::kSlowSpeedPeriodScale = 0.3f;
|
||||||
float CPlayerCameraBob::kTargetMagnitudeTrackingRate = 0.1f;
|
float CPlayerCameraBob::kTargetMagnitudeTrackingRate = 0.1f;
|
||||||
float CPlayerCameraBob::kLandingBobSpringConstant = 150.f;
|
float CPlayerCameraBob::kLandingBobSpringConstant = 150.f;
|
||||||
|
float CPlayerCameraBob::kLandingBobSpringConstant2 = 40.f;
|
||||||
float CPlayerCameraBob::kViewWanderRadius = 2.9f;
|
float CPlayerCameraBob::kViewWanderRadius = 2.9f;
|
||||||
float CPlayerCameraBob::kViewWanderSpeedMin = 0.1f;
|
float CPlayerCameraBob::kViewWanderSpeedMin = 0.1f;
|
||||||
float CPlayerCameraBob::kViewWanderSpeedMax = 0.3f;
|
float CPlayerCameraBob::kViewWanderSpeedMax = 0.3f;
|
||||||
float CPlayerCameraBob::kViewWanderRollVariation = 0.3f;
|
float CPlayerCameraBob::kViewWanderRollVariation = 0.3f;
|
||||||
float CPlayerCameraBob::kGunBobMagnitude = 0.3f;
|
float CPlayerCameraBob::kGunBobMagnitude = 0.3f;
|
||||||
float CPlayerCameraBob::kHelmetBobMagnitude = 2.f;
|
float CPlayerCameraBob::kHelmetBobMagnitude = 2.f;
|
||||||
const float CPlayerCameraBob::kLandingBobDamping = 2.f * zeus::sqrtF(150.f);
|
const float CPlayerCameraBob::kLandingBobDamping = 2.f * std::sqrt(150.f);
|
||||||
|
const float CPlayerCameraBob::kLandingBobDamping2 = 4.f * std::sqrt(40.f);
|
||||||
|
const float CPlayerCameraBob::kCameraDamping = 6.f * std::sqrt(80.f);
|
||||||
|
|
||||||
CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float f1)
|
CPlayerCameraBob::CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float bobPeriod)
|
||||||
: x0_type(type), x4_vec(vec), xc_(f1)
|
: x0_type(type), x4_vec(vec), xc_bobPeriod(bobPeriod)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,10 +35,9 @@ zeus::CTransform CPlayerCameraBob::GetViewWanderTransform() const { return xd0_v
|
||||||
|
|
||||||
zeus::CVector3f CPlayerCameraBob::GetHelmetBobTranslation() const
|
zeus::CVector3f CPlayerCameraBob::GetHelmetBobTranslation() const
|
||||||
{
|
{
|
||||||
|
|
||||||
return {kHelmetBobMagnitude * x2c_cameraBobTransform.origin.x,
|
return {kHelmetBobMagnitude * x2c_cameraBobTransform.origin.x,
|
||||||
kHelmetBobMagnitude * x2c_cameraBobTransform.origin.y,
|
kHelmetBobMagnitude * x2c_cameraBobTransform.origin.y,
|
||||||
kHelmetBobMagnitude * (x2c_cameraBobTransform.origin.z - x78_)};
|
kHelmetBobMagnitude * (x2c_cameraBobTransform.origin.z - x78_camTranslation)};
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CTransform CPlayerCameraBob::GetGunBobTransformation() const
|
zeus::CTransform CPlayerCameraBob::GetGunBobTransformation() const
|
||||||
|
@ -48,20 +50,12 @@ zeus::CTransform CPlayerCameraBob::GetCameraBobTransformation() const { return x
|
||||||
void CPlayerCameraBob::SetPlayerVelocity(const zeus::CVector3f& velocity)
|
void CPlayerCameraBob::SetPlayerVelocity(const zeus::CVector3f& velocity)
|
||||||
{
|
{
|
||||||
x5c_playerVelocity = velocity;
|
x5c_playerVelocity = velocity;
|
||||||
x68_ = zeus::min(x68_, velocity.z);
|
x68_playerPeakFallVel = zeus::min(x68_playerPeakFallVel, velocity.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerCameraBob::SetBobMagnitude(float magnitude)
|
void CPlayerCameraBob::SetBobMagnitude(float magnitude)
|
||||||
{
|
{
|
||||||
#if 0
|
x10_targetBobMagnitude = zeus::clamp(0.f, magnitude, 1.f);
|
||||||
/* Retro Original (This is why underpaid (re: unpaid) interns make crappy programmers) */
|
|
||||||
x10_bobMagnitude = magnitude;
|
|
||||||
x10_bobMagnitude = std::max(0.f, x10_bobMagnitude);
|
|
||||||
x10_bobMagnitude = std::max(1.f, x10_bobMagnitude);
|
|
||||||
#else
|
|
||||||
/* Should fix lightshow */
|
|
||||||
x10_bobMagnitude = zeus::clamp(0.f, magnitude, 1.f);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayerCameraBob::SetBobTimeScale(float ts) { x18_bobTimeScale = zeus::clamp(0.f, ts, 1.f); }
|
void CPlayerCameraBob::SetBobTimeScale(float ts) { x18_bobTimeScale = zeus::clamp(0.f, ts, 1.f); }
|
||||||
|
@ -80,18 +74,15 @@ void CPlayerCameraBob::SetState(CPlayerCameraBob::ECameraBobState state, CStateM
|
||||||
if (x20_oldState == ECameraBobState::InAir)
|
if (x20_oldState == ECameraBobState::InAir)
|
||||||
{
|
{
|
||||||
x28_applyLandingTrans = true;
|
x28_applyLandingTrans = true;
|
||||||
x68_ = std::min(x68_, -35.f);
|
x68_playerPeakFallVel = std::max(x68_playerPeakFallVel, -35.f);
|
||||||
x29_ = (x68_ >= -30.f);
|
x29_hardLand = x68_playerPeakFallVel < -30.f;
|
||||||
if (x29_)
|
if (x29_hardLand)
|
||||||
x74_ += x68_;
|
x74_camVelocity += x68_playerPeakFallVel;
|
||||||
else
|
x6c_landingVelocity += x68_playerPeakFallVel;
|
||||||
{
|
x68_playerPeakFallVel = 0.f;
|
||||||
x6c_ += x68_;
|
|
||||||
x68_ = 0.f;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x24_curState == ECameraBobState::WalkNoBob && x100_ != 0.f)
|
if (x24_curState == ECameraBobState::WalkNoBob && x100_wanderMagnitude != 0.f)
|
||||||
InitViewWander(mgr);
|
InitViewWander(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,13 +109,13 @@ void CPlayerCameraBob::UpdateViewWander(float dt, CStateManager& mgr)
|
||||||
x7c_wanderPoints[xcc_wanderIndex], x7c_wanderPoints[(xcc_wanderIndex + 1) & 3],
|
x7c_wanderPoints[xcc_wanderIndex], x7c_wanderPoints[(xcc_wanderIndex + 1) & 3],
|
||||||
x7c_wanderPoints[(xcc_wanderIndex + 2) & 3], x7c_wanderPoints[(xcc_wanderIndex + 3) & 3], dt);
|
x7c_wanderPoints[(xcc_wanderIndex + 2) & 3], x7c_wanderPoints[(xcc_wanderIndex + 3) & 3], dt);
|
||||||
|
|
||||||
pt.x *= x100_;
|
pt.x *= x100_wanderMagnitude;
|
||||||
pt.z *= x100_;
|
pt.z *= x100_wanderMagnitude;
|
||||||
zeus::CTransform orient = zeus::CTransform::RotateY((
|
zeus::CTransform orient = zeus::CTransform::RotateY((
|
||||||
zeus::getCatmullRomSplinePoint(xb0_wanderPitches[xcc_wanderIndex], xb0_wanderPitches[(xcc_wanderIndex + 1) & 3],
|
zeus::getCatmullRomSplinePoint(xb0_wanderPitches[xcc_wanderIndex], xb0_wanderPitches[(xcc_wanderIndex + 1) & 3],
|
||||||
xb0_wanderPitches[(xcc_wanderIndex + 2) & 3],
|
xb0_wanderPitches[(xcc_wanderIndex + 2) & 3],
|
||||||
xb0_wanderPitches[(xcc_wanderIndex + 3) & 3], dt) *
|
xb0_wanderPitches[(xcc_wanderIndex + 3) & 3], dt) *
|
||||||
x100_));
|
x100_wanderMagnitude));
|
||||||
xd0_viewWanderXf = zeus::lookAt(pt, zeus::CVector3f::skZero, zeus::CVector3f::skUp) * orient;
|
xd0_viewWanderXf = zeus::lookAt(pt, zeus::CVector3f::skZero, zeus::CVector3f::skUp) * orient;
|
||||||
|
|
||||||
xc4_wanderTime = (xc8_viewWanderSpeed * xc4_wanderTime) + dt;
|
xc4_wanderTime = (xc8_viewWanderSpeed * xc4_wanderTime) + dt;
|
||||||
|
@ -141,52 +132,55 @@ void CPlayerCameraBob::UpdateViewWander(float dt, CStateManager& mgr)
|
||||||
|
|
||||||
void CPlayerCameraBob::Update(float dt, CStateManager& mgr)
|
void CPlayerCameraBob::Update(float dt, CStateManager& mgr)
|
||||||
{
|
{
|
||||||
x1c_bobTime = (dt * x18_bobTimeScale) + x1c_bobTime;
|
x1c_bobTime += dt * x18_bobTimeScale;
|
||||||
float landSpring = kLandingBobSpringConstant;
|
|
||||||
float landDampen = kLandingBobDamping;
|
|
||||||
if (x28_applyLandingTrans)
|
if (x28_applyLandingTrans)
|
||||||
{
|
{
|
||||||
landDampen = 4.f * zeus::sqrtF(40.f);
|
float landDampen = kLandingBobDamping;
|
||||||
landSpring = 40.f;
|
float landSpring = kLandingBobSpringConstant;
|
||||||
}
|
if (x29_hardLand)
|
||||||
|
{
|
||||||
|
landDampen = kLandingBobDamping2;
|
||||||
|
landSpring = kLandingBobSpringConstant2;
|
||||||
|
}
|
||||||
|
|
||||||
x6c_ = (dt * -((landSpring * x70_landingTranslation) + -(landDampen * x6c_))) + x6c_;
|
x6c_landingVelocity += dt * (-(landDampen * x6c_landingVelocity) - landSpring * x70_landingTranslation);
|
||||||
x70_landingTranslation = x6c_ * dt + x70_landingTranslation;
|
x70_landingTranslation += x6c_landingVelocity * dt;
|
||||||
x74_ = dt * (-(80.f * x78_) + -((6.f * zeus::sqrtF(80.f)) * x74_)) + x74_;
|
x74_camVelocity += dt * (-(kCameraDamping * x74_camVelocity) - 80.f * x78_camTranslation);
|
||||||
x78_ = x74_ * dt + x78_;
|
x78_camTranslation += x74_camVelocity * dt;
|
||||||
|
|
||||||
if (std::fabs(x6c_) < 0.0049f && std::fabs(x70_landingTranslation) < 0.0049f && std::fabs(x78_) < 0.0049f)
|
if (std::fabs(x6c_landingVelocity) < 0.005f && std::fabs(x70_landingTranslation) < 0.005f &&
|
||||||
{
|
std::fabs(x74_camVelocity) < 0.005f && std::fabs(x78_camTranslation) < 0.005f)
|
||||||
x28_applyLandingTrans = false;
|
{
|
||||||
x70_landingTranslation = 0.f;
|
x28_applyLandingTrans = false;
|
||||||
x78_ = 0.f;
|
x70_landingTranslation = 0.f;
|
||||||
|
x78_camTranslation = 0.f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x24_curState == ECameraBobState::WalkNoBob)
|
if (x24_curState == ECameraBobState::WalkNoBob)
|
||||||
x104_ = 1.f;
|
x104_targetWanderMagnitude = 1.f;
|
||||||
else
|
else
|
||||||
x104_ = 0.f;
|
x104_targetWanderMagnitude = 0.f;
|
||||||
|
|
||||||
float f1 = mgr.GetCameraManager()->GetCameraBobMagnitude();
|
float mag = mgr.GetCameraManager()->GetCameraBobMagnitude();
|
||||||
x70_landingTranslation *= f1;
|
x70_landingTranslation *= mag;
|
||||||
x78_ *= f1;
|
x78_camTranslation *= mag;
|
||||||
x104_ *= f1;
|
x104_targetWanderMagnitude *= mag;
|
||||||
if (mgr.GetPlayer().x38c_doneSidewaysDashing)
|
if (mgr.GetPlayer().x38c_doneSidewaysDashing)
|
||||||
{
|
{
|
||||||
x70_landingTranslation *= 0.2f;
|
x70_landingTranslation *= 0.2f;
|
||||||
x78_ *= 0.2f;
|
x78_camTranslation *= 0.2f;
|
||||||
x104_ *= 0.4f;
|
x104_targetWanderMagnitude *= 0.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
x100_ = kTargetMagnitudeTrackingRate * (x104_ - x100_) + x100_;
|
x100_wanderMagnitude += kTargetMagnitudeTrackingRate * (x104_targetWanderMagnitude - x100_wanderMagnitude);
|
||||||
x100_ = std::max(x100_, 0.f);
|
x100_wanderMagnitude = std::max(x100_wanderMagnitude, 0.f);
|
||||||
float tmp = x14_;
|
x14_bobMagnitude += kTargetMagnitudeTrackingRate * (x10_targetBobMagnitude - x14_bobMagnitude);
|
||||||
x14_ = kTargetMagnitudeTrackingRate * (x10_bobMagnitude - x14_) + x14_;
|
|
||||||
UpdateViewWander(dt, mgr);
|
UpdateViewWander(dt, mgr);
|
||||||
x78_ = tmp;
|
|
||||||
|
|
||||||
x2c_cameraBobTransform = GetViewWanderTransform() * CalculateCameraBobTransformation() *
|
x2c_cameraBobTransform = CalculateCameraBobTransformation() * GetViewWanderTransform() *
|
||||||
zeus::lookAt(zeus::CVector3f::skZero, {0.f, 2.f, x78_}, zeus::CVector3f::skUp);
|
zeus::lookAt(zeus::CVector3f::skZero, {0.f, 2.f, x78_camTranslation}, zeus::CVector3f::skUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
zeus::CVector3f CPlayerCameraBob::CalculateRandomViewWanderPosition(CStateManager& mgr)
|
zeus::CVector3f CPlayerCameraBob::CalculateRandomViewWanderPosition(CStateManager& mgr)
|
||||||
|
@ -205,20 +199,20 @@ void CPlayerCameraBob::CalculateMovingTranslation(float& x, float& y) const
|
||||||
{
|
{
|
||||||
if (x0_type == ECameraBobType::Zero)
|
if (x0_type == ECameraBobType::Zero)
|
||||||
{
|
{
|
||||||
double c = ((M_PIF * 2.f) * std::fmod(x1c_bobTime, 2.0f * xc_) / xc_);
|
double c = ((M_PIF * 2.f) * std::fmod(x1c_bobTime, 2.0f * xc_bobPeriod) / xc_bobPeriod);
|
||||||
x = (x14_ * x4_vec.x) * float(std::sin(c));
|
x = (x14_bobMagnitude * x4_vec.x) * float(std::sin(c));
|
||||||
y = (x14_ * x4_vec.y) * float(std::fabs(std::cos(c * .5)) * std::cos(c * .5));
|
y = (x14_bobMagnitude * x4_vec.y) * float(std::fabs(std::cos(c * .5)) * std::cos(c * .5));
|
||||||
}
|
}
|
||||||
else if (x0_type == ECameraBobType::One)
|
else if (x0_type == ECameraBobType::One)
|
||||||
{
|
{
|
||||||
float fX = std::fmod(x1c_bobTime, 2.f * xc_);
|
float fX = std::fmod(x1c_bobTime, 2.f * xc_bobPeriod);
|
||||||
if (fX > xc_)
|
if (fX > xc_bobPeriod)
|
||||||
x = (2.f - (fX / xc_)) * (x14_ * x4_vec.x);
|
x = (2.f - (fX / xc_bobPeriod)) * (x14_bobMagnitude * x4_vec.x);
|
||||||
else
|
else
|
||||||
x = ((fX / xc_)) * (x14_ * x4_vec.x);
|
x = ((fX / xc_bobPeriod)) * (x14_bobMagnitude * x4_vec.x);
|
||||||
|
|
||||||
auto sY = float(std::sin(std::fmod((M_PI * fX) / xc_, M_PI)));
|
auto sY = float(std::sin(std::fmod((M_PI * fX) / xc_bobPeriod, M_PI)));
|
||||||
y = (1.f - sY) * (x14_ * x4_vec.y) * 0.5f + (0.5f * -((sY * sY) - 1.f) * (x14_ * x4_vec.y));
|
y = (1.f - sY) * (x14_bobMagnitude * x4_vec.y) * 0.5f + (0.5f * -((sY * sY) - 1.f) * (x14_bobMagnitude * x4_vec.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
static float kSlowSpeedPeriodScale;
|
static float kSlowSpeedPeriodScale;
|
||||||
static float kTargetMagnitudeTrackingRate;
|
static float kTargetMagnitudeTrackingRate;
|
||||||
static float kLandingBobSpringConstant;
|
static float kLandingBobSpringConstant;
|
||||||
|
static float kLandingBobSpringConstant2;
|
||||||
static float kViewWanderRadius;
|
static float kViewWanderRadius;
|
||||||
static float kViewWanderSpeedMin;
|
static float kViewWanderSpeedMin;
|
||||||
static float kViewWanderSpeedMax;
|
static float kViewWanderSpeedMax;
|
||||||
|
@ -47,37 +48,39 @@ public:
|
||||||
static float kGunBobMagnitude;
|
static float kGunBobMagnitude;
|
||||||
static float kHelmetBobMagnitude;
|
static float kHelmetBobMagnitude;
|
||||||
static const float kLandingBobDamping;
|
static const float kLandingBobDamping;
|
||||||
|
static const float kLandingBobDamping2;
|
||||||
|
static const float kCameraDamping;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ECameraBobType x0_type;
|
ECameraBobType x0_type;
|
||||||
zeus::CVector2f x4_vec;
|
zeus::CVector2f x4_vec;
|
||||||
float xc_;
|
float xc_bobPeriod;
|
||||||
float x10_bobMagnitude = 0.f;
|
float x10_targetBobMagnitude = 0.f;
|
||||||
float x14_ = 0.f;
|
float x14_bobMagnitude = 0.f;
|
||||||
float x18_bobTimeScale = 0.f;
|
float x18_bobTimeScale = 0.f;
|
||||||
float x1c_bobTime = 0.f;
|
float x1c_bobTime = 0.f;
|
||||||
ECameraBobState x20_oldState = ECameraBobState::Unspecified;
|
ECameraBobState x20_oldState = ECameraBobState::Unspecified;
|
||||||
ECameraBobState x24_curState = ECameraBobState::Unspecified;
|
ECameraBobState x24_curState = ECameraBobState::Unspecified;
|
||||||
bool x28_applyLandingTrans = false;
|
bool x28_applyLandingTrans = false;
|
||||||
bool x29_ = false;
|
bool x29_hardLand = false;
|
||||||
zeus::CTransform x2c_cameraBobTransform;
|
zeus::CTransform x2c_cameraBobTransform;
|
||||||
zeus::CVector3f x5c_playerVelocity;
|
zeus::CVector3f x5c_playerVelocity;
|
||||||
float x68_ = 0.f;
|
float x68_playerPeakFallVel = 0.f;
|
||||||
float x6c_ = 0.f;
|
float x6c_landingVelocity = 0.f;
|
||||||
float x70_landingTranslation = 0.f;
|
float x70_landingTranslation = 0.f;
|
||||||
float x74_ = 0.f;
|
float x74_camVelocity = 0.f;
|
||||||
float x78_ = 0.f;
|
float x78_camTranslation = 0.f;
|
||||||
zeus::CVector3f x7c_wanderPoints[4] = {zeus::CVector3f{0.f, 1.f, 0.f}};
|
zeus::CVector3f x7c_wanderPoints[4] = {zeus::CVector3f{0.f, 1.f, 0.f}};
|
||||||
float xb0_wanderPitches[4] = {0.f};
|
float xb0_wanderPitches[4] = {0.f};
|
||||||
float xc4_wanderTime = 0.f;
|
float xc4_wanderTime = 0.f;
|
||||||
float xc8_viewWanderSpeed = kViewWanderSpeedMin;
|
float xc8_viewWanderSpeed = kViewWanderSpeedMin;
|
||||||
u32 xcc_wanderIndex = 0;
|
u32 xcc_wanderIndex = 0;
|
||||||
zeus::CTransform xd0_viewWanderXf;
|
zeus::CTransform xd0_viewWanderXf;
|
||||||
float x100_ = FLT_EPSILON;
|
float x100_wanderMagnitude = FLT_EPSILON;
|
||||||
float x104_ = 0.f;
|
float x104_targetWanderMagnitude = 0.f;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float);
|
CPlayerCameraBob(ECameraBobType type, const zeus::CVector2f& vec, float bobPeriod);
|
||||||
|
|
||||||
zeus::CTransform GetViewWanderTransform() const;
|
zeus::CTransform GetViewWanderTransform() const;
|
||||||
zeus::CVector3f GetHelmetBobTranslation() const;
|
zeus::CVector3f GetHelmetBobTranslation() const;
|
||||||
|
|
2
hecl
2
hecl
|
@ -1 +1 @@
|
||||||
Subproject commit 914545051e9be680ea6bd85c0143f3fbd5f3ebf9
|
Subproject commit 3650eccc26d5d245cb964a3d16e2a9905de82fa7
|
Loading…
Reference in New Issue