summaryrefslogtreecommitdiff
path: root/src/egg/gfx
diff options
context:
space:
mode:
authorrobojumper <robojumper@gmail.com>2026-05-07 21:23:47 +0200
committerGitHub <noreply@github.com>2026-05-07 21:23:47 +0200
commitf7b4c029fd5176e817e3de7209727480c445a3d2 (patch)
tree9cddc9fa36ec13e7dac76c54d74257c61fe20b47 /src/egg/gfx
parentddb116187922a3f73ae3c97a136f499b7d724a2c (diff)
parentf4d163797f3c21e5a705b75043e0a8fbe7dc2460 (diff)
Merge pull request #313 from robojumper/vec-mtx-cleanup
Cleanup
Diffstat (limited to 'src/egg/gfx')
-rw-r--r--src/egg/gfx/eggCpuTexture.cpp2
-rw-r--r--src/egg/gfx/eggDrawGX.cpp34
-rw-r--r--src/egg/gfx/eggDrawPathLightMap.cpp4
-rw-r--r--src/egg/gfx/eggG3DUtility.cpp2
-rw-r--r--src/egg/gfx/eggGlobalDrawState.cpp2
-rw-r--r--src/egg/gfx/eggIScnProc.cpp2
-rw-r--r--src/egg/gfx/eggLightManager.cpp2
-rw-r--r--src/egg/gfx/eggLightObject.cpp12
-rw-r--r--src/egg/gfx/eggLightTexture.cpp2
-rw-r--r--src/egg/gfx/eggLightTextureMgr.cpp2
-rw-r--r--src/egg/gfx/eggModelEx.cpp4
-rw-r--r--src/egg/gfx/eggPostEffectBase.cpp2
-rw-r--r--src/egg/gfx/eggPostEffectBlur.cpp2
-rw-r--r--src/egg/gfx/eggPostEffectMaskDOF.cpp4
-rw-r--r--src/egg/gfx/eggPostEffectUnk2.cpp4
-rw-r--r--src/egg/gfx/eggScreen.cpp2
-rw-r--r--src/egg/gfx/eggScreenEffectBlur.cpp4
-rw-r--r--src/egg/gfx/eggStateEfb.cpp2
18 files changed, 44 insertions, 44 deletions
diff --git a/src/egg/gfx/eggCpuTexture.cpp b/src/egg/gfx/eggCpuTexture.cpp
index c0d9cd8e..c422b17d 100644
--- a/src/egg/gfx/eggCpuTexture.cpp
+++ b/src/egg/gfx/eggCpuTexture.cpp
@@ -188,7 +188,7 @@ void CpuTexture::fillNormalMapSphere(f32 f1, f32 f2) {
// TODO: std::sqrtf?
vec(2) = fz < Math<f32>::zero() ? Math<f32>::zero() : (f32)sqrt(fz);
- PSVECNormalize(vec, vec);
+ VECNormalize(vec, vec);
GXUtility::getNormalColor(c, vec);
c.r = c.a;
setColor(x, y, c);
diff --git a/src/egg/gfx/eggDrawGX.cpp b/src/egg/gfx/eggDrawGX.cpp
index 8ab23ff1..b0ddc2e5 100644
--- a/src/egg/gfx/eggDrawGX.cpp
+++ b/src/egg/gfx/eggDrawGX.cpp
@@ -72,8 +72,8 @@ static void DrawCircleYPolygonFan(const nw4r::math::MTX34 &mtx, f32 f, u16 numSe
int seg = numSegments + 1;
- PSMTXMultVec(mtx, v1, v1);
- PSMTXMultVec(mtx, v2, v2);
+ MTXMultVec(mtx, v1, v1);
+ MTXMultVec(mtx, v2, v2);
GXBegin(GX_TRIANGLEFAN, GX_VTXFMT0, seg + 1);
@@ -86,7 +86,7 @@ static void DrawCircleYPolygonFan(const nw4r::math::MTX34 &mtx, f32 f, u16 numSe
nw4r::math::VEC3 v3(
0.5f * nw4r::math::SinRad(signedStepSize * i), 0.0f, 0.5f * nw4r::math::CosRad(signedStepSize * i)
);
- PSMTXMultVec(mtx, v3, v3);
+ MTXMultVec(mtx, v3, v3);
GXPosition3f32(v3.x, v3.y, v3.z);
nw4r::math::VEC3 v4(
@@ -98,15 +98,15 @@ static void DrawCircleYPolygonFan(const nw4r::math::MTX34 &mtx, f32 f, u16 numSe
0.5f * nw4r::math::CosRad(signedStepSize * (i + 1))
);
- PSMTXMultVec(mtx, v4, v4);
- PSMTXMultVec(mtx, v5, v5);
+ MTXMultVec(mtx, v4, v4);
+ MTXMultVec(mtx, v5, v5);
nw4r::math::VEC3Sub(&v4, &v4, &v2);
nw4r::math::VEC3Sub(&v5, &v5, &v2);
nw4r::math::VEC3 v6;
- PSVECCrossProduct(v5, v4, v6);
- PSVECNormalize(v6, v6);
+ VECCrossProduct(v5, v4, v6);
+ VECNormalize(v6, v6);
GXPosition3f32(v6.x, v6.y, v6.z);
}
@@ -145,7 +145,7 @@ void DrawGX::Initialize(Heap *pHeap_) {
GXInitTexObj(&CLEAR_Z_TEX_OBJ, s_clear_z_TX, 4, 4, GX_TF_Z24X8, GX_REPEAT, GX_REPEAT, false);
GXInitTexObjLOD(&CLEAR_Z_TEX_OBJ, GX_NEAR, GX_NEAR, 0.0, 0.0, 0.0, 0, 0, GX_ANISO_1);
- PSMTXIdentity(s_cameraMtx.m);
+ MTXIdentity(s_cameraMtx.m);
CreateDisplayList(pHeap);
}
@@ -591,29 +591,29 @@ void DrawGX::CreateDisplayList(EGG::Heap *pHeap) {
GXPosition3f32(2.0f * x, 0.0f, 2.0f * z);
}
nw4r::math::MTX34 mtx;
- PSMTXTrans(mtx, 0.0f, 0.5f, 0.0f);
+ MTXTrans(mtx, 0.0f, 0.5f, 0.0f);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_9]);
- PSMTXIdentity(mtx);
- PSMTXRotRad(mtx, M_PI, 0x7A);
- PSMTXTransApply(mtx, mtx, 0.0f, -0.5f, 0.0f);
+ MTXIdentity(mtx);
+ MTXRotRad(mtx, M_PI, 0x7A);
+ MTXTransApply(mtx, mtx, 0.0f, -0.5f, 0.0f);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_9]);
break;
}
case DL_11:
case DL_12: {
nw4r::math::MTX34 mtx;
- PSMTXIdentity(mtx);
+ MTXIdentity(mtx);
DrawCircleYPolygonFan(mtx, 1.0f, POS_NUM[i - DL_11]);
- PSMTXRotRad(mtx, M_PI, 0x7A);
+ MTXRotRad(mtx, M_PI, 0x7A);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_11]);
break;
}
case DL_7:
case DL_8: {
nw4r::math::MTX34 mtx;
- PSMTXIdentity(mtx);
- PSMTXRotRad(mtx, M_PI / 2.0f, 0x78);
+ MTXIdentity(mtx);
+ MTXRotRad(mtx, M_PI / 2.0f, 0x78);
DrawCircleYPolygonFan(mtx, 0.0f, POS_NUM[i - DL_7]);
break;
}
@@ -725,7 +725,7 @@ void DrawGX::SetBlendMode(enum Blend mode) {
void DrawGX::DrawDLWorld(DL dl, const EGG::Matrix34f &mtx, GXColor color) {
nw4r::math::MTX34 resMtx;
- PSMTXConcat(s_cameraMtx.m, mtx.m, resMtx.m);
+ MTXConcat(s_cameraMtx.m, mtx.m, resMtx.m);
DrawDL(dl, resMtx, color);
}
diff --git a/src/egg/gfx/eggDrawPathLightMap.cpp b/src/egg/gfx/eggDrawPathLightMap.cpp
index 21a0ad6c..da217979 100644
--- a/src/egg/gfx/eggDrawPathLightMap.cpp
+++ b/src/egg/gfx/eggDrawPathLightMap.cpp
@@ -78,7 +78,7 @@ void DrawPathLightMap::internalDraw(u16 idx) {
PostEffectBase::setProjection(GetScreen());
- PSMTXScale(forDL, GetScreen().GetWidth(), GetScreen().GetHeight(), 1.0f);
+ MTXScale(forDL, GetScreen().GetWidth(), GetScreen().GetHeight(), 1.0f);
mpTextureBuffer_0x30->load(GX_TEXMAP0);
DrawGX::BeginDrawScreen(true, true, false);
@@ -113,7 +113,7 @@ void DrawPathLightMap::internalDraw(u16 idx) {
nw4r::math::MTX34 forDL;
PostEffectBase::setProjection(GetScreen());
- PSMTXScale(forDL, GetScreen().GetWidth(), GetScreen().GetHeight(), 1.0f);
+ MTXScale(forDL, GetScreen().GetWidth(), GetScreen().GetHeight(), 1.0f);
GXColor tevColor = {0xFF, 0xFF, 0xFF, mAlpha};
diff --git a/src/egg/gfx/eggG3DUtility.cpp b/src/egg/gfx/eggG3DUtility.cpp
index a61cefc6..dd3a7ed1 100644
--- a/src/egg/gfx/eggG3DUtility.cpp
+++ b/src/egg/gfx/eggG3DUtility.cpp
@@ -66,7 +66,7 @@ void G3DUtility::create(u32 size, Heap *pHeap) {
void G3DUtility::defaultTexMtxFunc(nw4r::math::MTX34 *pMtx, s8 camRef, s8 lightRef) {
const nw4r::math::MTX34 *mtxPtr = nw4r::g3d::G3DState::GetInvCameraMtxPtr();
- PSMTXCopy(mtxPtr->m, pMtx->m);
+ MTXCopy(mtxPtr->m, pMtx->m);
}
bool G3DUtility::setUpLightSet(nw4r::g3d::LightSetting &lightSet, nw4r::g3d::ResAnmScn scn, int refNumber) {
diff --git a/src/egg/gfx/eggGlobalDrawState.cpp b/src/egg/gfx/eggGlobalDrawState.cpp
index bb1f3df3..06e2b383 100644
--- a/src/egg/gfx/eggGlobalDrawState.cpp
+++ b/src/egg/gfx/eggGlobalDrawState.cpp
@@ -19,7 +19,7 @@ GlobalDrawState sState;
void GlobalDrawState::beginDrawView(u16 cameraId, const nw4r::math::MTX34 &mtx, const Screen &screen) {
spScreen = &screen;
sCameraId = cameraId;
- PSMTXCopy(mtx, sMtx);
+ MTXCopy(mtx, sMtx);
StateEfb::Clean();
}
diff --git a/src/egg/gfx/eggIScnProc.cpp b/src/egg/gfx/eggIScnProc.cpp
index 25e3dafa..cb9ae243 100644
--- a/src/egg/gfx/eggIScnProc.cpp
+++ b/src/egg/gfx/eggIScnProc.cpp
@@ -27,7 +27,7 @@ void IScnProc::createScnProc(u16 procNum, MEMAllocator *pAllocator) {
mNumScnProc = procNum;
mpDataSet = new ProcData[mNumScnProc];
nw4r::math::MTX34 mtx;
- PSMTXIdentity(mtx);
+ MTXIdentity(mtx);
for (u16 i = 0; i < getNumScnProc(); i++) {
u32 sp8;
diff --git a/src/egg/gfx/eggLightManager.cpp b/src/egg/gfx/eggLightManager.cpp
index 003b8703..a8c72d7c 100644
--- a/src/egg/gfx/eggLightManager.cpp
+++ b/src/egg/gfx/eggLightManager.cpp
@@ -117,7 +117,7 @@ void LightManager::CalcView(const nw4r::math::MTX34 &viewMtx, u8 lightObjOffset,
DCFlushRange(gxObj, CheckedNumLightObjs(mCounts.mNumEggLightObjects) * sizeof(GXLightObj));
if (root != nullptr) {
nw4r::math::MTX34 tmp;
- PSMTXInverse(viewMtx, tmp);
+ MTXInverse(viewMtx, tmp);
CopyToG3D_View(root, tmp);
}
}
diff --git a/src/egg/gfx/eggLightObject.cpp b/src/egg/gfx/eggLightObject.cpp
index 5bf0b97b..f58493d5 100644
--- a/src/egg/gfx/eggLightObject.cpp
+++ b/src/egg/gfx/eggLightObject.cpp
@@ -114,18 +114,18 @@ void LightObject::CalcView(nw4r::math::MTX34 const &viewMtx) {
} else {
if (getField0x3C() == 1) {
nw4r::math::VEC3 tmp(-viewMtx._20, -viewMtx._21, -viewMtx._22);
- if (PSVECMag(tmp) > 0.0f) {
+ if (VECMag(tmp) > 0.0f) {
nw4r::math::VEC3 angle;
C_VECHalfAngle(mDir, tmp, angle);
nw4r::math::VEC3Scale(&field_0x6C, &angle, -1.0f);
- PSVECNormalize(field_0x6C, field_0x6C);
+ VECNormalize(field_0x6C, field_0x6C);
} else {
field_0x6C.x = field_0x6C.y = 0.0f;
field_0x6C.z = 1.0f;
}
}
- PSMTXMultVec(viewMtx, mPos, mViewPos);
- PSMTXMultVec(viewMtx, mAt, mViewAt);
+ MTXMultVec(viewMtx, mPos, mViewPos);
+ MTXMultVec(viewMtx, mAt, mViewAt);
nw4r::math::VEC3TransformNormal(&field_0x94, &viewMtx, &field_0x6C);
}
}
@@ -238,12 +238,12 @@ void LightObject::CopyToG3D_View(nw4r::g3d::LightObj &g3dObj, const nw4r::math::
break;
}
case 0: {
- PSMTXMultVec(viewMtx, mViewPos, pos);
+ MTXMultVec(viewMtx, mViewPos, pos);
dir.x = dir.y = dir.z = 0.0f;
break;
}
case 2: {
- PSMTXMultVec(viewMtx, mViewPos, pos);
+ MTXMultVec(viewMtx, mViewPos, pos);
nw4r::math::VEC3TransformNormal(&dir, &viewMtx, &field_0x94);
break;
}
diff --git a/src/egg/gfx/eggLightTexture.cpp b/src/egg/gfx/eggLightTexture.cpp
index 3452484b..fbc9e640 100644
--- a/src/egg/gfx/eggLightTexture.cpp
+++ b/src/egg/gfx/eggLightTexture.cpp
@@ -519,7 +519,7 @@ void LightTexture::debugDraw(int i) {
fn_804AC0A0(i, &u1, &u2);
load(GX_TEXMAP0);
nw4r::math::MTX34 mtx;
- PSMTXScale(mtx, sTexWidth, sTexHeight, 1.0f);
+ MTXScale(mtx, sTexWidth, sTexHeight, 1.0f);
mtx._03 = u1;
mtx._13 = sDrawHeight - (u2 + sTexHeight);
diff --git a/src/egg/gfx/eggLightTextureMgr.cpp b/src/egg/gfx/eggLightTextureMgr.cpp
index 09de2e1e..8ae966c0 100644
--- a/src/egg/gfx/eggLightTextureMgr.cpp
+++ b/src/egg/gfx/eggLightTextureMgr.cpp
@@ -247,7 +247,7 @@ void LightTextureManager::drawAndCaptureTexture(f32 ox, f32 oy, f32 sx, f32 sy)
StateGX::GXSetScissor_(x1, y1, x2, y2);
StateGX::GXSetScissorBoxOffset_(0, 0);
nw4r::math::MTX34 identity;
- PSMTXIdentity(identity);
+ MTXIdentity(identity);
DrawGX::BeginDrawScreen(1, 1, 0);
DrawGX::SetBlendMode(DrawGX::BLEND_14);
diff --git a/src/egg/gfx/eggModelEx.cpp b/src/egg/gfx/eggModelEx.cpp
index 14c10293..c38a3aed 100644
--- a/src/egg/gfx/eggModelEx.cpp
+++ b/src/egg/gfx/eggModelEx.cpp
@@ -66,7 +66,7 @@ void ModelEx::getShapeMinMax(u16 shapeIndex, math::VEC3 *pMin, math::VEC3 *pMax,
math::MTX34 *pMtxArr =
reinterpret_cast<math::MTX34 *>(G3DUtility::BumpAlloc(info.GetNumPosNrmMtx() * sizeof(math::MTX34), 1));
if (doCalcWorld) {
- PSMTXIdentity(tmpMtx);
+ MTXIdentity(tmpMtx);
calcWorld(pMtxArr, &tmpMtx);
}
@@ -86,7 +86,7 @@ void ModelEx::getShapeMinMax(u16 shapeIndex, math::VEC3 *pMin, math::VEC3 *pMax,
mtxIdx = defaultMatrixIdx;
}
nw4r::math::VEC3 tmpVec;
- PSMTXMultVec(pMtxArr[mtxIdx], &analyze.getVtxResult().field_0x08, tmpVec);
+ MTXMultVec(pMtxArr[mtxIdx], &analyze.getVtxResult().field_0x08, tmpVec);
if (firstIteration) {
firstIteration = false;
*pMin = *pMax = tmpVec;
diff --git a/src/egg/gfx/eggPostEffectBase.cpp b/src/egg/gfx/eggPostEffectBase.cpp
index e7dbd1cb..4627caad 100644
--- a/src/egg/gfx/eggPostEffectBase.cpp
+++ b/src/egg/gfx/eggPostEffectBase.cpp
@@ -43,7 +43,7 @@ void PostEffectBase::setVtxState() {
void PostEffectBase::drawScreenInternal(f32 offsetX, f32 offsetY, f32 width, f32 height) {
nw4r::math::MTX34 mtx;
- PSMTXScale(mtx, width, height, 1.0f);
+ MTXScale(mtx, width, height, 1.0f);
mtx._03 = offsetX;
mtx._13 = offsetY;
mtx._23 = 0.0f;
diff --git a/src/egg/gfx/eggPostEffectBlur.cpp b/src/egg/gfx/eggPostEffectBlur.cpp
index 934ee0d3..fb302821 100644
--- a/src/egg/gfx/eggPostEffectBlur.cpp
+++ b/src/egg/gfx/eggPostEffectBlur.cpp
@@ -76,7 +76,7 @@ void PostEffectBlur::setMaterialMulti(u8 kernelIdx, u8 p2, f32 f1, f32 f2) {
0.0f, 0.0f, 0.0f, 0.0f
// clang-format on
);
- PSMTXConcat(m, mtx, m);
+ MTXConcat(m, mtx, m);
GXLoadTexMtxImm(m, texMtxId, GX_MTX2x4);
unk_00_scale++;
}
diff --git a/src/egg/gfx/eggPostEffectMaskDOF.cpp b/src/egg/gfx/eggPostEffectMaskDOF.cpp
index b340038b..987d36c1 100644
--- a/src/egg/gfx/eggPostEffectMaskDOF.cpp
+++ b/src/egg/gfx/eggPostEffectMaskDOF.cpp
@@ -101,8 +101,8 @@ void PostEffectMaskDOF::draw(f32 width, f32 height) {
GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX1, GX_TEX_ST, GX_F32, 0);
GXSetVtxDesc(GX_VA_TEX1, GX_DIRECT);
nw4r::math::MTX34 mtx;
- PSMTXScale(mtx, width * mScaleX, height * mScaleY, 1.f);
- PSMTXTransApply(mtx, mtx, mOffsetX, mOffsetY, 0.f);
+ MTXScale(mtx, width * mScaleX, height * mScaleY, 1.f);
+ MTXTransApply(mtx, mtx, mOffsetX, mOffsetY, 0.f);
GXLoadPosMtxImm(mtx, GX_PNMTX0);
GXBegin(GX_QUADS, GX_VTXFMT0, 4);
GXPosition2u8(0, 0);
diff --git a/src/egg/gfx/eggPostEffectUnk2.cpp b/src/egg/gfx/eggPostEffectUnk2.cpp
index 8156ba5d..e2194b01 100644
--- a/src/egg/gfx/eggPostEffectUnk2.cpp
+++ b/src/egg/gfx/eggPostEffectUnk2.cpp
@@ -61,8 +61,8 @@ void PostEffectUnk2::draw(f32 width, f32 height) {
GXSetVtxDesc(GX_VA_TEX1, GX_DIRECT);
nw4r::math::MTX34 mtx;
- PSMTXScale(mtx, width * mScaleX, height * mScaleY, 1.0f);
- PSMTXTransApply(mtx, mtx, mOffsetX, mOffsetY, 0.0f);
+ MTXScale(mtx, width * mScaleX, height * mScaleY, 1.0f);
+ MTXTransApply(mtx, mtx, mOffsetX, mOffsetY, 0.0f);
GXLoadPosMtxImm(mtx, 0);
static const f32 floats1[2][2] = {
diff --git a/src/egg/gfx/eggScreen.cpp b/src/egg/gfx/eggScreen.cpp
index 9a9d58cb..e65b3436 100644
--- a/src/egg/gfx/eggScreen.cpp
+++ b/src/egg/gfx/eggScreen.cpp
@@ -264,7 +264,7 @@ bool Screen::IsChangeEfb() const {
}
void Screen::CalcMatrixForDrawQuad(math::MTX34 *mtx, f32 x, f32 y, f32 sx, f32 sy) const {
- PSMTXScale(*mtx, sx, sy, 1.0f);
+ MTXScale(*mtx, sx, sy, 1.0f);
mtx->m[0][3] = x;
mtx->m[1][3] = mCanvasMode == CANVASMODE_0 ? y - sy : y;
diff --git a/src/egg/gfx/eggScreenEffectBlur.cpp b/src/egg/gfx/eggScreenEffectBlur.cpp
index afe15f76..164221a6 100644
--- a/src/egg/gfx/eggScreenEffectBlur.cpp
+++ b/src/egg/gfx/eggScreenEffectBlur.cpp
@@ -96,7 +96,7 @@ void ScreenEffectBlur::fn_804B32B0() {
if (field_0x0C & 1) {
nw4r::math::MTX34 m;
- PSMTXScale(m, sizeY, sizeY, 1.f);
+ MTXScale(m, sizeY, sizeY, 1.f);
pTex0->load(GX_TEXMAP0);
DrawGX::BeginDrawScreen(true, true, false);
DrawGX::SetBlendMode(DrawGX::BLEND_14);
@@ -114,7 +114,7 @@ void ScreenEffectBlur::fn_804B3710() {
// Have to perform a float -> u16 -> float round trip here...
u16 sizeY = sScreen.GetSize().y;
u16 sizeX = sScreen.GetSize().x;
- PSMTXScale(mtx, sizeX, sizeY, 0.0f);
+ MTXScale(mtx, sizeX, sizeY, 0.0f);
mpCpuTexture->load(GX_TEXMAP0);
DrawGX::BeginDrawScreen(true, true, true);
GXSetTevKColor(GX_KCOLOR0, field_0x28);
diff --git a/src/egg/gfx/eggStateEfb.cpp b/src/egg/gfx/eggStateEfb.cpp
index e2a11581..8ca5992d 100644
--- a/src/egg/gfx/eggStateEfb.cpp
+++ b/src/egg/gfx/eggStateEfb.cpp
@@ -184,7 +184,7 @@ void StateEfb::popWorkBuffer(bool b, u32 userData) {
StateGX::GXSetScissorBoxOffset_(0, 0);
nw4r::math::MTX34 mtx;
- PSMTXScale(mtx, parentScreen.GetSize().x, parentScreen.GetSize().y, 1.0f);
+ MTXScale(mtx, parentScreen.GetSize().x, parentScreen.GetSize().y, 1.0f);
DrawGX::BeginDrawScreen(true, isEnableDirtyBufferMode(), false);
DrawGX::SetBlendMode(DrawGX::BLEND_14);