From a72ba6f154e80b668af29f97bcd859c7eadde530 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Thu, 25 Dec 2025 22:03:30 -0600 Subject: [PATCH] chore(gx): tidy up CShaderEffect --- src/gx/shader/CShaderEffect.cpp | 42 +++++++++++++++++---------------- src/gx/shader/CShaderEffect.hpp | 10 ++++---- 2 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/gx/shader/CShaderEffect.cpp b/src/gx/shader/CShaderEffect.cpp index 8900bb4..267dd6b 100644 --- a/src/gx/shader/CShaderEffect.cpp +++ b/src/gx/shader/CShaderEffect.cpp @@ -176,20 +176,6 @@ void CShaderEffect::SetShaders(uint32_t vertexPermute, uint32_t pixelPermute) { } } -void CShaderEffect::SetTexMtx_Identity(uint32_t a1) { - if (CShaderEffect::s_enableShaders) { - float matrix[] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f - }; - - GxShaderConstantsSet(GxSh_Vertex, 2 * a1 + 6, matrix, 2); - } else { - // TODO - // - non-shader code path - } -} - void CShaderEffect::SetTexMtx(const C44Matrix& matrix, uint32_t tcIndex) { if (CShaderEffect::s_enableShaders) { float constants[] = { @@ -205,18 +191,34 @@ void CShaderEffect::SetTexMtx(const C44Matrix& matrix, uint32_t tcIndex) { // TODO non-shader path } -void CShaderEffect::SetTexMtx_SphereMap(uint32_t a1) { +void CShaderEffect::SetTexMtx_Identity(uint32_t tcIndex) { if (CShaderEffect::s_enableShaders) { - float matrix[] = { + float constants[] = { 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f }; - GxShaderConstantsSet(GxSh_Vertex, 2 * a1 + 6, matrix, 2); - } else { - // TODO - // - non-shader code path + GxShaderConstantsSet(GxSh_Vertex, 2 * tcIndex + 6, constants, 2); + + return; } + + // TODO non-shader path +} + +void CShaderEffect::SetTexMtx_SphereMap(uint32_t tcIndex) { + if (CShaderEffect::s_enableShaders) { + float constants[] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f + }; + + GxShaderConstantsSet(GxSh_Vertex, 2 * tcIndex + 6, constants, 2); + + return; + } + + // TODO non-shader path } void CShaderEffect::UpdateProjMatrix() { diff --git a/src/gx/shader/CShaderEffect.hpp b/src/gx/shader/CShaderEffect.hpp index d810fe5..163a6bb 100644 --- a/src/gx/shader/CShaderEffect.hpp +++ b/src/gx/shader/CShaderEffect.hpp @@ -44,10 +44,10 @@ class CShaderEffect : public TSHashObject { static void SetFogParams(float fogStart, float fogEnd, float fogRate, const CImVector& fogColor); static void SetLocalLighting(CM2Lighting* lighting, int32_t lightEnabled, const C3Vector* a3); static void SetShaders(uint32_t vertexPermute, uint32_t pixelPermute); - static void SetTexMtx(const C44Matrix& matrix, uint32_t a2); - static void SetTexMtx_Identity(uint32_t a1); - static void SetTexMtx_SphereMap(uint32_t a1); - static void UpdateProjMatrix(void); + static void SetTexMtx(const C44Matrix& matrix, uint32_t tcIndex); + static void SetTexMtx_Identity(uint32_t tcIndex); + static void SetTexMtx_SphereMap(uint32_t tcIndex); + static void UpdateProjMatrix(); // Member variables CGxShader* m_vertexShaders[90]; @@ -55,7 +55,7 @@ class CShaderEffect : public TSHashObject { // Member functions void InitEffect(const char* vsName, const char* psName); - void SetCurrent(void); + void SetCurrent(); }; #endif