2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 13:44:56 +00:00

zeus constexpr refactor and thermal visor fixes

This commit is contained in:
Jack Andersen
2019-02-23 21:15:54 -10:00
parent 1186b8097c
commit 8df0a4913c
226 changed files with 1339 additions and 1305 deletions

View File

@@ -74,7 +74,7 @@ void CDecal::SetGlobalSeed(u16 seed) { sDecalRandom.SetSeed(seed); }
void CDecal::SetMoveRedToAlphaBuffer(bool move) { sMoveRedToAlphaBuffer = move; }
void CDecal::RenderQuad(CQuadDecal& decal, const SQuadDescr& desc) const {
zeus::CColor color = zeus::CColor::skWhite;
zeus::CColor color = zeus::skWhite;
float size = 1.f;
zeus::CVector3f offset;
if (CColorElement* clr = desc.x10_CLR.get())
@@ -166,7 +166,7 @@ void CDecal::RenderQuad(CQuadDecal& decal, const SQuadDescr& desc) const {
void CDecal::RenderMdl() const {
const CDecalDescription& desc = *x0_description;
zeus::CColor color = zeus::CColor::skWhite;
zeus::CColor color = zeus::skWhite;
zeus::CVector3f dmop;
zeus::CTransform rotXf;
@@ -223,7 +223,7 @@ void CDecal::RenderMdl() const {
desc.x38_DMDL.m_token->Draw(flags);
} else {
if (color.a() == 1.f) {
CModelFlags flags(0, 0, 3, zeus::CColor::skWhite);
CModelFlags flags(0, 0, 3, zeus::skWhite);
desc.x38_DMDL.m_token->Draw(flags);
} else {
CModelFlags flags(5, 0, 1, color);

View File

@@ -506,7 +506,7 @@ void CElementGen::CreateNewParticles(int count) {
if (CColorElement* colr = desc->x30_x24_COLR.get())
colr->GetValue(0, particle.x34_color);
else
particle.x34_color = zeus::CColor::skWhite;
particle.x34_color = zeus::skWhite;
if (CEmitterElement* emtr = desc->x40_x2c_EMTR.get()) {
emtr->GetValue(x74_curFrame, particle.x4_pos, particle.x1c_vel);
@@ -771,7 +771,7 @@ void CElementGen::BuildParticleSystemBounds() {
zeus::CVector3f max = box.max + xe8_globalTranslation + scale;
x2f0_systemBounds = zeus::CAABox(min, max);
} else
x2f0_systemBounds = zeus::CAABox::skInvertedBox;
x2f0_systemBounds = zeus::CAABox();
if (accumulated)
x2f0_systemBounds.accumulateBounds(aabb);
@@ -886,7 +886,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
CGraphics::SetShaderDataBinding(m_normalDataBindPmus);
}
zeus::CTransform orient = zeus::CTransform::Identity();
zeus::CTransform orient = zeus::CTransform();
if (desc->x45_25_x31_27_PMOO)
orient = x1d8_orientation;
orient = orient * x22c_globalOrientation;
@@ -898,7 +898,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
zeus::CVector3f trans = (x13c_globalScaleTransformInverse * x1a8_localScaleTransformInverse) * xe8_globalTranslation;
zeus::CTransform rot = zeus::CTransform::Identity();
zeus::CTransform rot = zeus::CTransform();
if (pmrtConst) {
zeus::CVector3f pmrtVal;
pmrt->GetValue(x74_curFrame, pmrtVal);
@@ -1018,7 +1018,7 @@ void CElementGen::RenderModels(const CActorLights* actorLights) {
model->Draw({7, 0, 1, col});
} else {
if (1.f == col.a())
model->Draw({0, 0, 3, zeus::CColor::skWhite});
model->Draw({0, 0, 3, zeus::skWhite});
else
model->Draw({5, 0, 1, col});
}
@@ -1085,7 +1085,7 @@ void CElementGen::RenderLines() {
bool constTexr = true;
bool constUVs = true;
CTexture* cachedTex = nullptr;
zeus::CColor moduColor = zeus::CColor::skWhite;
zeus::CColor moduColor = zeus::skWhite;
if (texr) {
CParticle& target = x30_particles[0];
int partFrame = x74_curFrame - target.x28_startFrame;
@@ -1094,7 +1094,7 @@ void CElementGen::RenderLines() {
/* Set TEXC * RASC */
if (x338_moduColor != zeus::CColor::skBlack) {
if (x338_moduColor != zeus::skBlack) {
/* Add RASC * PREVC pass for MODU color loaded into channel mat-color */
moduColor = x338_moduColor;
}
@@ -1200,7 +1200,7 @@ void CElementGen::RenderParticles() {
cachedTex = texr->GetValueTexture(partFrame).GetObj();
cachedTex->Load(0, CTexture::EClampMode::One);
if (x338_moduColor != zeus::CColor::skBlack) {
if (x338_moduColor != zeus::skBlack) {
/* Add RASC * PREVC pass for MODU color loaded into channel mat-color */
uniformData.moduColor = x338_moduColor;
}
@@ -1397,7 +1397,7 @@ void CElementGen::RenderParticles() {
if (delta.canBeNormalized())
dir = delta.normalized();
else
dir = zeus::CVector3f::skUp;
dir = zeus::skUp;
}
zeus::CVector3f foreVec = particle.x2c_lineLengthOrSize * dir;
@@ -1778,7 +1778,7 @@ void CElementGen::SetGlobalTranslation(const zeus::CVector3f& translation) {
void CElementGen::SetGlobalScale(const zeus::CVector3f& scale) {
x100_globalScale = scale;
x10c_globalScaleTransform = zeus::CTransform::Scale(scale);
x13c_globalScaleTransformInverse = zeus::CTransform::Scale(zeus::CVector3f::skOne / scale);
x13c_globalScaleTransformInverse = zeus::CTransform::Scale(zeus::skOne3f / scale);
for (const std::unique_ptr<CParticleGen>& ch : x290_activePartChildren)
ch->SetGlobalScale(scale);
@@ -1787,7 +1787,7 @@ void CElementGen::SetGlobalScale(const zeus::CVector3f& scale) {
void CElementGen::SetLocalScale(const zeus::CVector3f& scale) {
x16c_localScale = scale;
x178_localScaleTransform = zeus::CTransform::Scale(scale);
x1a8_localScaleTransformInverse = zeus::CTransform::Scale(zeus::CVector3f::skOne / scale);
x1a8_localScaleTransformInverse = zeus::CTransform::Scale(zeus::skOne3f / scale);
for (const std::unique_ptr<CParticleGen>& ch : x290_activePartChildren)
ch->SetLocalScale(scale);

View File

@@ -70,14 +70,14 @@ private:
zeus::CVector3f xe8_globalTranslation;
zeus::CVector3f xf4_POFS;
zeus::CVector3f x100_globalScale = {1.f, 1.f, 1.f};
zeus::CTransform x10c_globalScaleTransform = zeus::CTransform::Identity();
zeus::CTransform x13c_globalScaleTransformInverse = zeus::CTransform::Identity();
zeus::CTransform x10c_globalScaleTransform = zeus::CTransform();
zeus::CTransform x13c_globalScaleTransformInverse = zeus::CTransform();
zeus::CVector3f x16c_localScale = {1.f, 1.f, 1.f};
zeus::CTransform x178_localScaleTransform = zeus::CTransform::Identity();
zeus::CTransform x1a8_localScaleTransformInverse = zeus::CTransform::Identity();
zeus::CTransform x1d8_orientation = zeus::CTransform::Identity();
zeus::CTransform x208_orientationInverse = zeus::CTransform::Identity();
zeus::CTransform x22c_globalOrientation = zeus::CTransform::Identity();
zeus::CTransform x178_localScaleTransform = zeus::CTransform();
zeus::CTransform x1a8_localScaleTransformInverse = zeus::CTransform();
zeus::CTransform x1d8_orientation = zeus::CTransform();
zeus::CTransform x208_orientationInverse = zeus::CTransform();
zeus::CTransform x22c_globalOrientation = zeus::CTransform();
u32 x25c_activeParticleCount = 0;
u32 x260_cumulativeParticles = 0;
@@ -123,9 +123,9 @@ private:
zeus::CVector3f x2d4_aabbMin;
zeus::CVector3f x2e0_aabbMax;
float x2ec_maxSize = 0.f;
zeus::CAABox x2f0_systemBounds = zeus::CAABox::skInvertedBox;
zeus::CAABox x2f0_systemBounds = zeus::CAABox();
LightType x308_lightType;
zeus::CColor x30c_LCLR = zeus::CColor::skWhite;
zeus::CColor x30c_LCLR = zeus::skWhite;
float x310_LINT = 1.f;
zeus::CVector3f x314_LOFF;
zeus::CVector3f x320_LDIR = {1.f, 0.f, 0.f};

View File

@@ -167,7 +167,7 @@ void CParticleElectric::UpdateElectricalEffects() {
if (x450_27_haveSSWH) {
CParticleSwoosh& swoosh = *x1e0_swooshGenerators[elec.x0_idx];
zeus::CColor color = zeus::CColor::skWhite;
zeus::CColor color = zeus::skWhite;
if (CColorElement* colr = x1c_elecDesc->x14_COLR.get())
colr->GetValue(frame, color);
swoosh.SetModulationColor(color * x1b8_moduColor);
@@ -215,7 +215,7 @@ void CParticleElectric::CalculatePoints() {
points.push_back(pos);
}
zeus::CVector3f fpos = zeus::CVector3f::skForward;
zeus::CVector3f fpos = zeus::skForward;
zeus::CVector3f fvel;
if (CEmitterElement* femt = x1c_elecDesc->x1c_FEMT.get())
femt->GetValue(x28_currentFrame, fpos, fvel);
@@ -279,7 +279,7 @@ void CParticleElectric::CalculatePoints() {
zeus::CVector3f v0 = x420_calculatedVerts[0] - x420_calculatedVerts[1];
zeus::CVector3f v1 = x420_calculatedVerts[x420_calculatedVerts.size() - 1] - x420_calculatedVerts[1];
zeus::CVector3f upVec = zeus::CVector3f::skUp;
zeus::CVector3f upVec = zeus::skUp;
if (v0.canBeNormalized() && v1.canBeNormalized()) {
v0.normalize();
v1.normalize();
@@ -343,7 +343,7 @@ void CParticleElectric::CreateNewParticles(int count) {
swoosh.SetGlobalOrientation(cachedRot);
swoosh.SetGlobalScale(xe0_globalScale);
swoosh.SetLocalScale(xec_localScale);
zeus::CColor color = zeus::CColor::skWhite;
zeus::CColor color = zeus::skWhite;
if (CColorElement* colr = x1c_elecDesc->x14_COLR.get())
colr->GetValue(frame, color);
swoosh.SetModulationColor(color * x1b8_moduColor);
@@ -355,7 +355,7 @@ void CParticleElectric::CreateNewParticles(int count) {
line.x0_verts = x420_calculatedVerts;
UpdateLine(allocIdx, 0);
if (x450_27_haveSSWH) {
x130_buildBounds = zeus::CAABox::skInvertedBox;
x130_buildBounds = zeus::CAABox();
for (const zeus::CVector3f& vec : x420_calculatedVerts)
x130_buildBounds.accumulateBounds(vec);
line.x28_aabb = x130_buildBounds;
@@ -415,11 +415,11 @@ void CParticleElectric::AddElectricalEffects() {
void CParticleElectric::BuildBounds() {
if (GetParticleCount() <= 0) {
x160_systemBounds = zeus::CAABox::skInvertedBox;
x160_systemBounds = zeus::CAABox();
return;
}
x160_systemBounds = zeus::CAABox::skInvertedBox;
x160_systemBounds = zeus::CAABox();
if (x450_27_haveSSWH) {
for (CParticleElectricManager& elec : x3e8_electricManagers) {
@@ -428,7 +428,7 @@ void CParticleElectric::BuildBounds() {
x160_systemBounds.accumulateBounds(*bounds);
}
} else if (x450_28_haveLWD) {
zeus::CAABox tmp = zeus::CAABox::skInvertedBox;
zeus::CAABox tmp = zeus::CAABox();
for (CParticleElectricManager& elec : x3e8_electricManagers) {
CLineManager& line = *x2e4_lineManagers[elec.x0_idx];
tmp.accumulateBounds(line.x28_aabb);
@@ -727,7 +727,7 @@ CLight CParticleElectric::GetLight() const {
return x400_gpsmGenerators.front()->GetLight();
else if (x450_26_haveEPSM)
return x410_epsmGenerators.front()->GetLight();
return CLight::BuildLocalAmbient(GetGlobalTranslation(), zeus::CColor::skOrange);
return CLight::BuildLocalAmbient(GetGlobalTranslation(), zeus::skOrange);
}
bool CParticleElectric::GetParticleEmission() const { return x450_24_emitting; }

View File

@@ -20,7 +20,7 @@ public:
std::vector<zeus::CVector3f> x0_verts;
float x10_widths[3] = {1.f, 2.f, 3.f};
zeus::CColor x1c_colors[3];
zeus::CAABox x28_aabb = zeus::CAABox::skInvertedBox;
zeus::CAABox x28_aabb = zeus::CAABox();
};
class CParticleElectricManager {
@@ -47,18 +47,18 @@ private:
zeus::CTransform x74_invOrientation;
zeus::CVector3f xa4_globalTranslation;
zeus::CTransform xb0_globalOrientation;
zeus::CVector3f xe0_globalScale = zeus::CVector3f::skOne;
zeus::CVector3f xec_localScale = zeus::CVector3f::skOne;
zeus::CVector3f xe0_globalScale = zeus::skOne3f;
zeus::CVector3f xec_localScale = zeus::skOne3f;
zeus::CTransform xf8_cachedXf;
float x128 = 0.f;
float x12c = 0.f;
zeus::CAABox x130_buildBounds = zeus::CAABox::skInvertedBox;
zeus::CAABox x130_buildBounds = zeus::CAABox();
CRandom16 x14c_randState;
int x150_SSEG = 8;
int x154_SCNT = 1;
int x158 = 0;
float x15c_genRem = 0.f;
zeus::CAABox x160_systemBounds = zeus::CAABox::skInvertedBox;
zeus::CAABox x160_systemBounds = zeus::CAABox();
rstl::optional<zeus::CVector3f> x178_overrideIPos;
rstl::optional<zeus::CVector3f> x188_overrideIVel;
rstl::optional<zeus::CVector3f> x198_overrideFPos;

View File

@@ -45,11 +45,11 @@ CParticleSwoosh::CParticleSwoosh(const TToken<CSwooshDescription>& desc, int len
x15c_swooshes.clear();
x15c_swooshes.reserve(x1b4_LENG);
for (int i = 0; i < x1b4_LENG; ++i)
x15c_swooshes.emplace_back(zeus::CVector3f::skZero, zeus::CVector3f::skZero, 0.f, 0.f, 0, false,
zeus::CTransform::Identity(), zeus::CVector3f::skZero, 0.f, 0.f,
zeus::CColor::skClear);
x15c_swooshes.emplace_back(zeus::skZero3f, zeus::skZero3f, 0.f, 0.f, 0, false,
zeus::CTransform(), zeus::skZero3f, 0.f, 0.f,
zeus::skClear);
SetOrientation(zeus::CTransform::Identity());
SetOrientation(zeus::CTransform());
x16c_p0.resize(x1b8_SIDE);
x17c_p1.resize(x1b8_SIDE);
@@ -234,7 +234,7 @@ bool CParticleSwoosh::Update(double dt) {
if (CColorElement* colr = x1c_desc->x14_COLR.get())
colr->GetValue(x28_curFrame, x15c_swooshes[x158_curParticle].x6c_color);
else
x15c_swooshes[x158_curParticle].x6c_color = zeus::CColor::skWhite;
x15c_swooshes[x158_curParticle].x6c_color = zeus::skWhite;
int tspn = 0;
if (CIntElement* tspnElem = x1c_desc->x40_TSPN.get())
@@ -452,7 +452,7 @@ void CParticleSwoosh::Render3SidedSolidSpline() {
int curIdx = x158_curParticle;
float curUvSpan = -x1e8_uvSpan;
zeus::CColor prevColor0 = zeus::CColor::skClear;
zeus::CColor prevColor0 = zeus::skClear;
for (int i = 0; i < x15c_swooshes.size(); ++i) {
SSwooshData& swoosh = x15c_swooshes[curIdx];
@@ -517,10 +517,10 @@ void CParticleSwoosh::Render3SidedSolidSpline() {
// int vertCount = (x1b0_SPLN + 1) * 12;
float uv1 = 0.f;
zeus::CColor useColor1 = prevColor1;
zeus::CVector3f v01 = zeus::CVector3f::skZero;
zeus::CVector3f v11 = zeus::CVector3f::skZero;
zeus::CVector3f v21 = zeus::CVector3f::skZero;
zeus::CColor c1 = zeus::CColor::skClear;
zeus::CVector3f v01 = zeus::skZero3f;
zeus::CVector3f v11 = zeus::skZero3f;
zeus::CVector3f v21 = zeus::skZero3f;
zeus::CColor c1 = zeus::skClear;
float uvDelta = prevUvSpan - curUvSpan;
for (int j = 0; j < x1b0_SPLN + 1; ++j) {
float uv0 = uv1;
@@ -578,7 +578,7 @@ void CParticleSwoosh::Render3SidedSolidNoSplineNoGaps() {
int curIdx = x158_curParticle;
bool lastActive = false;
zeus::CColor c0 = zeus::CColor::skClear;
zeus::CColor c0 = zeus::skClear;
float uv0 = -x1e8_uvSpan;
for (int i = 0; i < x15c_swooshes.size(); ++i) {
SSwooshData& swoosh = x15c_swooshes[curIdx];
@@ -726,7 +726,7 @@ void CParticleSwoosh::Render2SidedNoSplineNoGaps() {
((zeus::CTransform::Translate(xa4_globalTranslation) * xb0_globalOrientation * xec_scaleXf).inverse() *
CGraphics::g_ViewMatrix)
.origin;
zeus::CVector3f dotVec = zeus::CVector3f::skZero;
zeus::CVector3f dotVec = zeus::skZero3f;
for (int i = 0; i < x15c_swooshes.size(); ++i) {
SSwooshData& swoosh = x15c_swooshes[curIdx];
@@ -1002,7 +1002,7 @@ u32 CParticleSwoosh::GetParticleCount() const { return x1ac_particleCount; }
bool CParticleSwoosh::SystemHasLight() const { return false; }
CLight CParticleSwoosh::GetLight() const {
return CLight::BuildLocalAmbient(zeus::CVector3f::skZero, zeus::CColor::skWhite);
return CLight::BuildLocalAmbient(zeus::skZero3f, zeus::skWhite);
}
bool CParticleSwoosh::GetParticleEmission() const { return x1d0_24_emitting; }

View File

@@ -98,7 +98,7 @@ class CParticleSwoosh : public CParticleGen {
zeus::CVector3f x1f0_aabbMin;
zeus::CVector3f x1fc_aabbMax;
float x208_maxRadius = 0.f;
zeus::CColor x20c_moduColor = zeus::CColor::skWhite;
zeus::CColor x20c_moduColor = zeus::skWhite;
boo::ObjToken<boo::IShaderDataBinding> m_dataBind;
boo::ObjToken<boo::IGraphicsBufferD> m_vertBuf;
@@ -203,7 +203,7 @@ public:
}
void DoSpiderBallWarmup(zeus::CVector3f& translation, const zeus::CVector3f& transInc) {
SetOrientation(zeus::lookAt(zeus::CVector3f::skZero, transInc));
SetOrientation(zeus::lookAt(zeus::skZero3f, transInc));
for (int i = 0; i < 6; ++i) {
SetTranslation(translation);
x1d0_26_forceOneUpdate = true;

View File

@@ -321,28 +321,28 @@ bool CREConstantRange::GetValue(int frame, float& valOut) const {
}
bool CREGetComponentRed::GetValue(int frame, float& valOut) const {
zeus::CColor a = zeus::CColor::skBlack;
zeus::CColor a = zeus::skBlack;
x4_a->GetValue(frame, a);
valOut = a.r();
return false;
}
bool CREGetComponentGreen::GetValue(int frame, float& valOut) const {
zeus::CColor a = zeus::CColor::skBlack;
zeus::CColor a = zeus::skBlack;
x4_a->GetValue(frame, a);
valOut = a.g();
return false;
}
bool CREGetComponentBlue::GetValue(int frame, float& valOut) const {
zeus::CColor a = zeus::CColor::skBlack;
zeus::CColor a = zeus::skBlack;
x4_a->GetValue(frame, a);
valOut = a.b();
return false;
}
bool CREGetComponentAlpha::GetValue(int frame, float& valOut) const {
zeus::CColor a = zeus::CColor::skBlack;
zeus::CColor a = zeus::skBlack;
x4_a->GetValue(frame, a);
valOut = a.a();
return false;