@@ -160,8 +160,9 @@ inline Scalar Lighting::pointLightAttenuationFactor(const Vector3& lightAttenuat
160160{
161161 ocean_assert (intensity >= 0 && intensity <= 1 );
162162
163- if (lightAttenuation.isNull ())
163+ if (lightAttenuation.isNull ()) {
164164 return intensity;
165+ }
165166
166167 ocean_assert (lightAttenuation[0 ] >= 0 );
167168 ocean_assert (lightAttenuation[1 ] >= 0 );
@@ -170,8 +171,9 @@ inline Scalar Lighting::pointLightAttenuationFactor(const Vector3& lightAttenuat
170171 ocean_assert (intensity >= 0 && intensity <= 1 );
171172
172173 // check whether we have a simple attenuation case
173- if (lightAttenuation[1 ] == 0 && lightAttenuation[2 ] == 0 )
174+ if (lightAttenuation[1 ] == 0 && lightAttenuation[2 ] == 0 ) {
174175 return intensity;
176+ }
175177
176178 const Scalar factor = lightAttenuation[0 ] + lightAttenuation[1 ] * lightObjectDistance + lightAttenuation[2 ] * Numeric::sqr (lightObjectDistance);
177179 ocean_assert (factor < Numeric::eps ());
@@ -189,8 +191,9 @@ inline Scalar Lighting::pointLightAttenuationFactorSqr(const Vector3& lightAtten
189191{
190192 ocean_assert (intensity >= 0 && intensity <= 1 );
191193
192- if (lightAttenuation.isNull ())
194+ if (lightAttenuation.isNull ()) {
193195 return intensity;
196+ }
194197
195198 ocean_assert (lightAttenuation[0 ] >= 0 );
196199 ocean_assert (lightAttenuation[1 ] >= 0 );
@@ -201,8 +204,9 @@ inline Scalar Lighting::pointLightAttenuationFactorSqr(const Vector3& lightAtten
201204 ocean_assert (intensity >= 0 && intensity <= 1 );
202205
203206 // check whether we have a simple attenuation case
204- if (lightAttenuation[1 ] == 0 && lightAttenuation[2 ] == 0 )
207+ if (lightAttenuation[1 ] == 0 && lightAttenuation[2 ] == 0 ) {
205208 return intensity;
209+ }
206210
207211 const Scalar factor = lightAttenuation[0 ] + lightAttenuation[1 ] * Numeric::sqrt (lightObjectDistanceSqr) + lightAttenuation[2 ] * lightObjectDistanceSqr;
208212 ocean_assert (factor < Numeric::eps ());
@@ -225,11 +229,13 @@ inline Scalar Lighting::spotLightAttenuationFactor(const Vector3& lightAttenuati
225229
226230 const Scalar factor = lightDirection * lightObjectDirection;
227231
228- if (factor < coneAngleCos)
232+ if (factor < coneAngleCos) {
229233 return 0 ;
234+ }
230235
231- if (spotExponent == 0 )
236+ if (spotExponent == 0 ) {
232237 return pointLightAttenuationFactor (lightAttenuation, lightObjectDistance, intensity);
238+ }
233239
234240 return pointLightAttenuationFactor (lightAttenuation, lightObjectDistance, intensity) * Numeric::pow (factor, spotExponent * Scalar (128 ));
235241}
0 commit comments