From abca8f6c875c16f10794b90b68c4a862ed2023f6 Mon Sep 17 00:00:00 2001 From: neobrain Date: Sun, 21 Jul 2013 17:56:58 -0700 Subject: [PATCH] Add some more GE state accessors for light/etc. --- GPU/GPUState.h | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/GPU/GPUState.h b/GPU/GPUState.h index f2bfde48b1..69c9225804 100644 --- a/GPU/GPUState.h +++ b/GPU/GPUState.h @@ -113,14 +113,14 @@ struct GPUgstate materialspecularcoef, // 0x5B ambientcolor, // 0x5C ambientalpha, // 0x5D - lmode, - ltype[4], - lpos[12], - ldir[12], - latt[12], - lconv[4], - lcutoff[4], - lcolor[12], + lmode, // 0x5E + ltype[4], // 0x5F-0x62 + lpos[12], // 0x63-0x6E + ldir[12], // 0x6F-0x7A + latt[12], // 0x7B-0x86 + lconv[4], // 0x87-0x8A + lcutoff[4], // 0x8B-0x8E + lcolor[12], // 0x8E-0x99 cullmode, fbptr, fbwidth, @@ -212,10 +212,17 @@ struct GPUgstate bool isDitherEnabled() const { return ditherEnable & 1; } bool isAlphaTestEnabled() const { return alphaTestEnable & 1; } bool isColorTestEnabled() const { return colorTestEnable & 1; } - bool isLightingEnabled() const { return lightingEnable & 1; } - bool isUsingSecondaryColor() const { return lmode & 1; } bool isTextureMapEnabled() const { return textureMapEnable & 1; } + bool isLightingEnabled() const { return lightingEnable & 1; } + bool isLightChanEnabled(int chan) const { return lightEnable[chan] & 1;} + bool isUsingPoweredDiffuseLight(int chan) const { return (ltype[chan] & 0x3) == 0x2; } + bool isUsingSpecularLight(int chan) const { return (ltype[chan] & 0x3) == 0x1 || (ltype[chan] & 0x3) == 0x2; } + bool isUsingSecondaryColor() const { return lmode & 1; } + bool isDirectionalLight(int chan) const { return ((ltype[chan] & 0x30)>>8) == 0; } + bool isPointLight(int chan) const { return ((ltype[chan] & 0x30)>>8) == 1; } + bool isSpotLight(int chan) const { return ((ltype[chan] & 0x30)>>8) == 2; } + unsigned int getAmbientR() const { return ambientcolor&0xFF; } unsigned int getAmbientG() const { return (ambientcolor>>8)&0xFF; } unsigned int getAmbientB() const { return (ambientcolor>>16)&0xFF; } @@ -226,10 +233,18 @@ struct GPUgstate unsigned int getMaterialAmbientB() const { return (materialambient>>16)&0xFF; } unsigned int getMaterialAmbientA() const { return materialalpha&0xFF; } + unsigned int getMaterialDiffuseR() const { return materialdiffuse&0xFF; } + unsigned int getMaterialDiffuseG() const { return (materialdiffuse>>8)&0xFF; } + unsigned int getMaterialDiffuseB() const { return (materialdiffuse>>16)&0xFF; } + unsigned int getMaterialEmissiveR() const { return materialemissive&0xFF; } unsigned int getMaterialEmissiveG() const { return (materialemissive>>8)&0xFF; } unsigned int getMaterialEmissiveB() const { return (materialemissive>>16)&0xFF; } + unsigned int getDiffuseColorR(int chan) const { return lcolor[1+chan*3]&0xFF; } + unsigned int getDiffuseColorG(int chan) const { return (lcolor[1+chan*3]>>8)&0xFF; } + unsigned int getDiffuseColorB(int chan) const { return (lcolor[1+chan*3]>>16)&0xFF; } + // UV gen int getUVGenMode() const { return texmapmode & 3;} // 2 bits int getUVProjMode() const { return (texmapmode >> 8) & 3;} // 2 bits