Gfx GX Fn GXInitSpecularDirHAv - wowjinxy/libPorpoise GitHub Wiki

GXInitSpecularDirHAv

  • Category: Lighting
  • Matrix Status: Implemented
  • Matrix Notes: Official macro API; added SDK-compatible dual-vector macro wrapper.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Lighting/GXInitSpecularDirHAv.html
  • Reference header: reference/gx/GXLighting.h
  • SDK behavior:
    • Macro API, not a standalone function:
      • #define GXInitSpecularDirHAv(lo, vecn, vech) (GXInitSpecularDirHA((lo), ...vecn xyz..., ...vech xyz...))
    • vecn supplies light direction input (n), vech supplies user half-angle (h).
    • Accepts f32[3] arrays or structs with first three contiguous f32 members.
    • No direct register load; forwards to GXInitSpecularDirHA.

libPorpoise Implementation

  • Public API header: include/dolphin/gx/GXLighting.h
  • Implementation style:
    • Macro-only wrapper with the same pointer-arithmetic argument expansion as SDK.
    • Forwards to GXInitSpecularDirHA, inheriting its direct half-angle write and infinite-position setup behavior.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: macro (lo, vecn, vech) form.
    • Porpoise: same macro form.
  • Behavioral parity:
    • SDK: extracts 6 contiguous floats (3 from vecn, 3 from vech) and calls GXInitSpecularDirHA.
    • Porpoise: same.
  • Known divergence:
    • None identified for this macro.

Validation Checklist

  • GX demo coverage checked
  • Pikmin usage path checked
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • Verified manual macro text in reference/man/gfx/gx/Lighting/GXInitSpecularDirHAv.html.
  • Verified header parity between reference/gx/GXLighting.h and include/dolphin/gx/GXLighting.h.