Skip to content

Commit

Permalink
sokol: Guard null's
Browse files Browse the repository at this point in the history
  • Loading branch information
IonAgorria committed Oct 13, 2024
1 parent 63336ed commit dedda88
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Source/Render/sokol/SokolRenderState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1044,12 +1044,14 @@ void cSokolRender::SetGlobalLight(Vect3f *vLight, sColor4f *Ambient, sColor4f *D
return;
}

if (activeLightDir != *vLight ||
activeLightDiffuse != *Diffuse) {
if ((vLight && activeLightDir != *vLight) ||
(Diffuse && activeLightDiffuse != *Diffuse) ||
(Ambient && activeLightAmbient != *Ambient) ||
(Specular && activeLightSpecular != *Specular)) {
FinishActiveDrawBuffer();
activeLightDir = *vLight;
activeLightDiffuse = *Diffuse;
activeLightAmbient = *Ambient;
activeLightSpecular = *Specular;
if (vLight) activeLightDir = *vLight;
if (Diffuse) activeLightDiffuse = *Diffuse;
if (Ambient) activeLightAmbient = *Ambient;
if (Specular) activeLightSpecular = *Specular;
}
}

0 comments on commit dedda88

Please sign in to comment.