mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Put Vec3 norm and bool hasNormal in better place
This commit is contained in:
parent
e0a839d425
commit
76ecaaff5f
1 changed files with 6 additions and 4 deletions
|
@ -276,8 +276,10 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[
|
||||||
|
|
||||||
GELightComputation comp = (GELightComputation)(gstate.ltype[l] & 3);
|
GELightComputation comp = (GELightComputation)(gstate.ltype[l] & 3);
|
||||||
GELightType type = (GELightType)((gstate.ltype[l] >> 8) & 3);
|
GELightType type = (GELightType)((gstate.ltype[l] >> 8) & 3);
|
||||||
Vec3 toLight;
|
|
||||||
|
Vec3 toLight(0,0,0);
|
||||||
|
Vec3 norm(0,0,0);
|
||||||
|
|
||||||
if (type == GE_LIGHTTYPE_DIRECTIONAL)
|
if (type == GE_LIGHTTYPE_DIRECTIONAL)
|
||||||
toLight = Vec3(gstate_c.lightpos[l]); // lightdir is for spotlights
|
toLight = Vec3(gstate_c.lightpos[l]); // lightdir is for spotlights
|
||||||
else
|
else
|
||||||
|
@ -285,10 +287,10 @@ void Lighter::Light(float colorOut0[4], float colorOut1[4], const float colorIn[
|
||||||
|
|
||||||
bool doSpecular = (comp != GE_LIGHTCOMP_ONLYDIFFUSE);
|
bool doSpecular = (comp != GE_LIGHTCOMP_ONLYDIFFUSE);
|
||||||
bool poweredDiffuse = comp == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE;
|
bool poweredDiffuse = comp == GE_LIGHTCOMP_BOTHWITHPOWDIFFUSE;
|
||||||
|
bool hasNormal = (gstate.vertType & GE_VTYPE_NRM_MASK) != 0;
|
||||||
|
|
||||||
float distanceToLight = toLight.Length();
|
float distanceToLight = toLight.Length();
|
||||||
float dot = 0.0f;
|
float dot = 0.0f;
|
||||||
Vec3 norm(0,0,0);
|
|
||||||
|
|
||||||
if (hasNormal)
|
if (hasNormal)
|
||||||
norm = normal.Normalized();
|
norm = normal.Normalized();
|
||||||
|
|
Loading…
Add table
Reference in a new issue