Make vector constants class-scope

This commit is contained in:
Jack Andersen 2017-02-11 17:51:59 -10:00
parent 6887d351fb
commit fbbd24f96e
8 changed files with 26 additions and 16 deletions

View File

@ -155,8 +155,8 @@ const CGameCamera* CCameraManager::GetCurrentCamera(const CStateManager& stateMg
float CCameraManager::sub80009148() const
{
const zeus::CVector3f uVec = x7c_fpCamera->GetTransform().upVector();
return 1.f - std::min(std::fabs(std::min(std::fabs(uVec.dot(zeus::kUpVec)), 1.f) / std::cos(zeus::degToRad(30.f))),
1.f);
return 1.f - std::min(std::fabs(std::min(std::fabs(uVec.dot(zeus::CVector3f::skUp)), 1.f) /
std::cos(zeus::degToRad(30.f))), 1.f);
}
void CCameraManager::sub800097AC(float, CStateManager& mgr)

View File

@ -79,7 +79,8 @@ zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& a,
if ((a.rightVector().magnitude() - 1.f) >= epsilon || (a.frontVector().magnitude() - 1.f) >= epsilon ||
(a.upVector().magnitude() - 1.f) >= epsilon)
xfCpy.orthonormalize();
float f2 = zeus::kUpVec.x + a.upVector().x * a.upVector().y * a.upVector().z * zeus::kUpVec.y + zeus::kUpVec.z;
float f2 = zeus::CVector3f::skUp.x + a.upVector().x * a.upVector().y * a.upVector().z *
zeus::CVector3f::skUp.y + zeus::CVector3f::skUp.z;
if (std::fabs(f2) > 1.0f)
f2 = (f2 >= -0.f ? -1.0f : 1.0f);
if (std::fabs(f2) > 0.999f)

View File

@ -1,4 +1,5 @@
#include "CSamusFaceReflection.hpp"
#include "GameGlobalObjects.hpp"
namespace urde
{
@ -6,9 +7,13 @@ namespace MP1
{
CSamusFaceReflection::CSamusFaceReflection(CStateManager& stateMgr)
: x4c_lights(8, zeus::CVector3f::skZero, 4, 4, false, 0, 0, 0.1f)
: x0_modelData(CAnimRes(g_ResFactory->GetResourceIdByName("ACS_SamusFace")->id,
0, zeus::CVector3f::skOne, 0, true)),
x4c_lights(std::make_unique<CActorLights>(8, zeus::CVector3f::skZero, 4, 4, false, 0, 0, 0.1f))
{
x60_ = zeus::CVector3f::skForward;
CAnimPlaybackParms parms(0, -1, 1.f, true);
x0_modelData.AnimationData()->SetAnimation(parms, false);
}
}

View File

@ -12,7 +12,11 @@ namespace MP1
class CSamusFaceReflection
{
CModelData x0_modelData;
CActorLights x4c_lights;
std::unique_ptr<CActorLights> x4c_lights;
zeus::CQuaternion x50_;
zeus::CVector3f x60_;
u32 x6c_ = 0;
bool x70_ = true;
public:
CSamusFaceReflection(CStateManager& stateMgr);
};

View File

@ -124,7 +124,7 @@ void CPlayerCameraBob::UpdateViewWander(float dt, CStateManager& mgr)
xb0_wanderPitches[(xcc_wanderIndex + 2) & 3],
xb0_wanderPitches[(xcc_wanderIndex + 3) & 3], dt) *
x100_));
xd0_viewWanderXf = zeus::lookAt(pt, zeus::CVector3f::skZero, zeus::kUpVec) * orient;
xd0_viewWanderXf = zeus::lookAt(pt, zeus::CVector3f::skZero, zeus::CVector3f::skUp) * orient;
xc4_wanderTime = (xc8_viewWanderSpeed * xc4_wanderTime) + dt;
if (xc4_wanderTime > 1.f)
@ -184,7 +184,7 @@ void CPlayerCameraBob::Update(float dt, CStateManager& mgr)
x78_ = tmp;
x2c_cameraBobTransform = GetViewWanderTransform() * CalculateCameraBobTransformation() *
zeus::lookAt(zeus::CVector3f::skZero, {0.f, 2.f, x78_}, zeus::kUpVec);
zeus::lookAt(zeus::CVector3f::skZero, {0.f, 2.f, x78_}, zeus::CVector3f::skUp);
}
zeus::CVector3f CPlayerCameraBob::CalculateRandomViewWanderPosition(CStateManager& mgr)

View File

@ -52,7 +52,7 @@ void CWorldTransManager::UpdateLights(float dt)
x4_modelData->x1a0_lights.clear();
zeus::CVector3f lightPos(0.f, 10.f, 0.f);
CLight spot = CLight::BuildSpot(lightPos, zeus::kBackVec, zeus::CColor::skWhite, 90.f);
CLight spot = CLight::BuildSpot(lightPos, zeus::CVector3f::skBack, zeus::CColor::skWhite, 90.f);
spot.SetAttenuation(1.f, 0.f, 0.f);
CLight s1 = spot;

View File

@ -1087,17 +1087,17 @@ u32 TransformDamagableTriggerFlags(CStateManager& mgr, TAreaId aId, u32 flags)
u32 ret = 0;
if (flags & 0x01)
ret |= ClassifyVector(rotation * zeus::kForwardVec);
ret |= ClassifyVector(rotation * zeus::CVector3f::skForward);
if (flags & 0x02)
ret |= ClassifyVector(rotation * zeus::kBackVec);
ret |= ClassifyVector(rotation * zeus::CVector3f::skBack);
if (flags & 0x04)
ret |= ClassifyVector(rotation * zeus::kLeftVec);
ret |= ClassifyVector(rotation * zeus::CVector3f::skLeft);
if (flags & 0x08)
ret |= ClassifyVector(rotation * zeus::kRightVec);
ret |= ClassifyVector(rotation * zeus::CVector3f::skRight);
if (flags & 0x10)
ret |= ClassifyVector(rotation * zeus::kUpVec);
ret |= ClassifyVector(rotation * zeus::CVector3f::skUp);
if (flags & 0x20)
ret |= ClassifyVector(rotation * zeus::kDownVec);
ret |= ClassifyVector(rotation * zeus::CVector3f::skDown);
return ret;
}

@ -1 +1 @@
Subproject commit 7cb049f093f9d1d91c501fbabfd12009a5bb0995
Subproject commit 03d074af13e902cebdf05d6f5ec5e4c2cbf569ee