CModelBoo: Make use of static inline variables

Same behavior, but allows all the initializers to be in one place,
rather than throughout the cpp file.
This commit is contained in:
Lioncash 2020-08-01 23:33:47 -04:00
parent e9084df80b
commit 25c017e0cc
2 changed files with 13 additions and 30 deletions

View File

@ -184,14 +184,14 @@ private:
void WarmupDrawSurfaces() const;
void WarmupDrawSurface(const CBooSurface& surf) const;
static zeus::CVector3f g_PlayerPosition;
static float g_ModSeconds;
static float g_TransformedTime;
static float g_TransformedTime2;
static CBooModel* g_LastModelCached;
static inline zeus::CVector3f g_PlayerPosition;
static inline float g_ModSeconds = 0.0f;
static inline float g_TransformedTime = 0.0f;
static inline float g_TransformedTime2 = 0.0f;
static inline CBooModel* g_LastModelCached = nullptr;
static bool g_DummyTextures;
static bool g_RenderModelBlack;
static inline bool g_DummyTextures = false;
static inline bool g_RenderModelBlack = false;
public:
~CBooModel();
@ -230,25 +230,25 @@ public:
void ClearUniformCounter() { m_uniUpdateCount = 0; }
static void ClearModelUniformCounters();
static bool g_DrawingOccluders;
static inline bool g_DrawingOccluders = false;
static void SetDrawingOccluders(bool occ) { g_DrawingOccluders = occ; }
static void SetNewPlayerPositionAndTime(const zeus::CVector3f& pos);
static zeus::CVector3f g_ReflectViewPos;
static inline zeus::CVector3f g_ReflectViewPos;
static void KillCachedViewDepState();
static void EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf, zeus::CMatrix4f* mtxsOut,
float& alphaOut);
static boo::ObjToken<boo::ITexture> g_shadowMap;
static zeus::CTransform g_shadowTexXf;
static inline boo::ObjToken<boo::ITexture> g_shadowMap;
static inline zeus::CTransform g_shadowTexXf;
static void EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf);
static void DisableShadowMaps();
static boo::ObjToken<boo::ITexture> g_disintegrateTexture;
static inline boo::ObjToken<boo::ITexture> g_disintegrateTexture;
static void SetDisintegrateTexture(const boo::ObjToken<boo::ITexture>& map) { g_disintegrateTexture = map; }
static boo::ObjToken<boo::ITextureCubeR> g_reflectionCube;
static inline boo::ObjToken<boo::ITextureCubeR> g_reflectionCube;
static void SetReflectionCube(const boo::ObjToken<boo::ITextureCubeR>& map) { g_reflectionCube = map; }
static void SetDummyTextures(bool b) { g_DummyTextures = b; }

View File

@ -43,8 +43,6 @@ constexpr zeus::CMatrix4f DisintegratePost{
};
} // Anonymous namespace
bool CBooModel::g_DrawingOccluders = false;
void CBooModel::Shutdown() {
g_shadowMap.reset();
g_disintegrateTexture.reset();
@ -57,10 +55,6 @@ void CBooModel::ClearModelUniformCounters() {
model->ClearUniformCounter();
}
zeus::CVector3f CBooModel::g_PlayerPosition = {};
float CBooModel::g_ModSeconds = 0.f;
float CBooModel::g_TransformedTime = 0.f;
float CBooModel::g_TransformedTime2 = 0.f;
void CBooModel::SetNewPlayerPositionAndTime(const zeus::CVector3f& pos) {
g_PlayerPosition = pos;
KillCachedViewDepState();
@ -73,14 +67,8 @@ void CBooModel::SetNewPlayerPositionAndTime(const zeus::CVector3f& pos) {
g_TransformedTime2 = 1.f / -(0.015f * std::sin(g_ModSeconds * 1.5f + 1.f) - 1.f);
}
CBooModel* CBooModel::g_LastModelCached = nullptr;
void CBooModel::KillCachedViewDepState() { g_LastModelCached = nullptr; }
bool CBooModel::g_DummyTextures = false;
bool CBooModel::g_RenderModelBlack = false;
zeus::CVector3f CBooModel::g_ReflectViewPos = {};
void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf, zeus::CMatrix4f* mtxsOut,
float& alphaOut) {
zeus::CVector3f modelToPlayer = g_PlayerPosition - CGraphics::g_GXModelMatrix.origin;
@ -146,11 +134,6 @@ void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurfa
}
}
boo::ObjToken<boo::ITexture> CBooModel::g_shadowMap;
zeus::CTransform CBooModel::g_shadowTexXf;
boo::ObjToken<boo::ITexture> CBooModel::g_disintegrateTexture;
boo::ObjToken<boo::ITextureCubeR> CBooModel::g_reflectionCube;
void CBooModel::EnableShadowMaps(const boo::ObjToken<boo::ITexture>& map, const zeus::CTransform& texXf) {
g_shadowMap = map;
g_shadowTexXf = texXf;