Merge pull request #189 from lioncash/model

CModelBoo: Make static data constexpr where applicable
This commit is contained in:
Phillip Stephens 2020-03-06 16:14:05 -08:00 committed by GitHub
commit ae25392d19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 20 deletions

View File

@ -18,10 +18,32 @@
#include <logvisor/logvisor.hpp> #include <logvisor/logvisor.hpp>
namespace urde { namespace urde {
static logvisor::Module Log("urde::CBooModel"); namespace {
bool CBooModel::g_DrawingOccluders = false; logvisor::Module Log("urde::CBooModel");
CBooModel* g_FirstModel = nullptr;
static CBooModel* g_FirstModel = nullptr; constexpr zeus::CMatrix4f ReflectBaseMtx{
0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f,
};
constexpr zeus::CMatrix4f ReflectPostGL{
1.f, 0.f, 0.f, 0.f, 0.f, -1.f, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f,
};
constexpr zeus::CMatrix4f MBShadowPost0{
1.f, 0.f, 0.f, 0.f, 0.f, -1.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f,
};
constexpr zeus::CMatrix4f MBShadowPost1{
0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, -0.0625f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f,
};
constexpr zeus::CMatrix4f DisintegratePost{
1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f,
};
} // Anonymous namespace
bool CBooModel::g_DrawingOccluders = false;
void CBooModel::Shutdown() { void CBooModel::Shutdown() {
g_shadowMap.reset(); g_shadowMap.reset();
@ -59,12 +81,6 @@ bool CBooModel::g_RenderModelBlack = false;
zeus::CVector3f CBooModel::g_ReflectViewPos = {}; zeus::CVector3f CBooModel::g_ReflectViewPos = {};
static const zeus::CMatrix4f ReflectBaseMtx = {0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f,
0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 1.f};
static const zeus::CMatrix4f ReflectPostGL = {1.f, 0.f, 0.f, 0.f, 0.f, -1.f, 0.f, 1.f,
0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f};
void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf, zeus::CMatrix4f* mtxsOut, void CBooModel::EnsureViewDepStateCached(const CBooModel& model, const CBooSurface* surf, zeus::CMatrix4f* mtxsOut,
float& alphaOut) { float& alphaOut) {
zeus::CVector3f modelToPlayer = g_PlayerPosition - CGraphics::g_GXModelMatrix.origin; zeus::CVector3f modelToPlayer = g_PlayerPosition - CGraphics::g_GXModelMatrix.origin;
@ -747,17 +763,6 @@ void CBooModel::UVAnimationBuffer::PadOutBuffer(u8*& bufStart, u8*& bufOut) {
bufOut = bufStart + ROUND_UP_256(bufOut - bufStart); bufOut = bufStart + ROUND_UP_256(bufOut - bufStart);
} }
static const zeus::CMatrix4f MBShadowPost0(1.f, 0.f, 0.f, 0.f,
0.f, -1.f, 0.f, 1.f,
0.f, 0.f, 0.f, 1.f,
0.f, 0.f, 0.f, 1.f);
static const zeus::CMatrix4f MBShadowPost1(0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 1.f, -0.0625f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f,
0.f, 1.f);
static const zeus::CMatrix4f DisintegratePost(1.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f, 0.f, 1.f, 0.f, 0.f, 0.f,
1.f);
void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags, void CBooModel::UVAnimationBuffer::Update(u8*& bufOut, const MaterialSet* matSet, const CModelFlags& flags,
const CBooModel* parent) { const CBooModel* parent) {
u8* start = bufOut; u8* start = bufOut;