Gfx MTX API Matrix - wowjinxy/libPorpoise GitHub Wiki

Gfx - MTX API Matrix

Function-by-function tracking list for libPorpoise MTX/Vec coverage.

Legend:

  • Status: Untriaged / Implemented / Partial / Stub / Missing
  • Check the box when status + notes are verified against behavior and tests.

General

  • MTXConcat - Status: Implemented - Notes: Verified 3x4 affine matrix concatenation in src/mtx/mtx.c.
  • MTXCopy - Status: Implemented - Notes: Verified direct matrix copy helper in src/mtx/mtx.c.
  • MTXIdentity - Status: Implemented - Notes: Verified identity matrix initialization in src/mtx/mtx.c.
  • MTXInverse - Status: Implemented - Notes: Verified wrapper to PSMTXInverse with success/fail return semantics.
  • MTXMultVec - Status: Implemented - Notes: Verified 3x4 vector transform (includes translation term).
  • MTXMultVecSR - Status: Implemented - Notes: Verified 3x3 scale/rotate-only transform (no translation).
  • MTXMultVecArray - Status: Implemented - Notes: Added SDK-compatible array transform loop API (srcBase/dstBase/count) in src/mtx/mtx.c.
  • MTXMultVecArraySR - Status: Implemented - Notes: Added SDK-compatible array transform loop API for SR-only path in src/mtx/mtx.c.
  • MTXRowCol - Status: Implemented - Notes: Verified macro definition in include/dolphin/mtx.h.
  • MTXTranspose - Status: Implemented - Notes: Verified wrapper to PSMTXTranspose in src/mtx/mtx.c.

Model

  • MTXQuat - Status: Implemented - Notes: Added quaternion-to-matrix conversion (x,y,z,w) with zero-norm fallback to identity.
  • MTXRotAxisDeg - Status: Implemented - Notes: Verified degree wrapper around MTXRotAxisRad.
  • MTXRotAxisRad - Status: Implemented - Notes: Verified arbitrary-axis rotation (normalizes axis, Rodrigues formulation).
  • MTXRotDeg - Status: Implemented - Notes: Verified degree wrapper around MTXRotRad.
  • MTXRotRad - Status: Implemented - Notes: Added axis-aligned rotation API in radians; routes through MTXRotTrig.
  • MTXRotTrig - Status: Implemented - Notes: Added axis-aligned rotation API from sine/cosine pairs.
  • MTXScale - Status: Implemented - Notes: Verified scale matrix construction.
  • MTXTrans - Status: Implemented - Notes: Verified translation matrix construction.

View

  • MTXLookAt - Status: Implemented - Notes: Verified camera view builder (look=cam-target, right=up x look, normalized basis, affine translation).

Projection

  • MTXFrustum - Status: Implemented - Notes: Verified canonical GC/Wii frustum projection form in src/mtx/mtx.c.
  • MTXOrtho - Status: Implemented - Notes: Verified orthographic projection matrix generation in src/mtx/mtx.c.
  • MTXPerspective - Status: Implemented - Notes: Verified FOV/aspect perspective matrix (degree input) matching MTXFrustum conventions.

Stack

  • MTXAllocStack - Status: Implemented - Notes: Added SDK-style macro in include/dolphin/mtx.h (stackBase = (MtxPtr)OSAlloc(numMtx*sizeof(Mtx))).
  • MTXFreeStack - Status: Implemented - Notes: Added SDK-style macro in include/dolphin/mtx.h (OSFree(stackBase)).
  • MTXGetStackPtr - Status: Implemented - Notes: Added implementation returning current top-of-stack pointer (or NULL).
  • MTXInitStack - Status: Implemented - Notes: Added implementation setting numMtx and initializing stackPtr = NULL (empty stack).
  • MTXPop - Status: Implemented - Notes: Added pop semantics per docs (-MTX_PTR_OFFSET; base -> NULL empty).
  • MTXPush - Status: Implemented - Notes: Added direct copy push semantics (empty->base, otherwise stackPtr+MTX_PTR_OFFSET) with overflow assert guard.
  • MTXPushFwd - Status: Implemented - Notes: Added forward composite push (MTXConcat(top, m, next)), matching documented post-order concat.
  • MTXPushInv - Status: Implemented - Notes: Added inverse composite push (MTXConcat(inverse(m), top, next)) with singular-matrix guard.
  • MTXPushInvXpose - Status: Implemented - Notes: Added inverse-transpose forward push (MTXConcat(top, transpose(inverse(m)), next)) with singular-matrix guard.

Vector

  • VECAdd - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • VECCrossProduct - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • VECDistance - Status: Implemented - Notes: Added Euclidean distance helper (sqrt(VECSquareDistance)).
  • VECDotProduct - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • VECHalfAngle - Status: Implemented - Notes: Added half-angle unit vector builder using negated/normalized light+view vectors.
  • VECMag - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • VECNormalize - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • VECReflect - Status: Implemented - Notes: Added normalized reflection vector (src - 2*(src·n)*n, normalized output).
  • VECScale - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • VECSquareDistance - Status: Implemented - Notes: Added squared-distance helper ((a-b)^2 without sqrt).
  • VECSquareMag - Status: Implemented - Notes: Added squared-magnitude helper (x*x + y*y + z*z).
  • VECSubtract - Status: Implemented - Notes: Added subtraction helper (a - b) with alias-safe scalar temporaries.

Texture Projection

  • MTXLightFrustum - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • MTXLightOrtho - Status: Implemented - Notes: Added orthographic texture projection matrix builder with S/T scale+translation controls.
  • MTXLightPerspective - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).

Paired Single Operations

  • PSMTXConcat - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • PSMTXMultVecArray - Status: Implemented - Notes: Added PC fallback shim to MTXMultVecArray.
  • PSMTXReorder - Status: Implemented - Notes: Added row-major Mtx -> column-major ROMtx reorder helper.
  • PSMTXROMultVecArray - Status: Implemented - Notes: Added reordered-matrix vector-array multiply helper (PC C-path implementation).

Unit Conversion

  • MTXDegToRad - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • MTXRadToDeg - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).

Structures

  • Mtx,MtxPtr - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • Mtx44,Mtx44Ptr - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • MtxStack,MtxStackPtr - Status: Implemented - Notes: Added struct/typedef in include/dolphin/mtx.h with numMtx, stackBase, stackPtr.
  • Point3d,Point3dPtr - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • Quaternion,QuaternionPtr - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • ROMtx, ROMtxPtr - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).
  • Vec,VecPtr - Status: Implemented - Notes: Symbol found in include/src (first-pass scan).