chore(gx): tidy up CShaderEffect

This commit is contained in:
fallenoak 2025-12-25 22:03:30 -06:00
parent 1ceb396b3d
commit a72ba6f154
No known key found for this signature in database
GPG Key ID: 7628F8E61AEA070D
2 changed files with 27 additions and 25 deletions

View File

@ -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() {

View File

@ -44,10 +44,10 @@ class CShaderEffect : public TSHashObject<CShaderEffect, HASHKEY_STRI> {
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<CShaderEffect, HASHKEY_STRI> {
// Member functions
void InitEffect(const char* vsName, const char* psName);
void SetCurrent(void);
void SetCurrent();
};
#endif