@@ -130,7 +130,12 @@ void main()
130130
131131 // compute light color from light grid
132132 vec3 ambientColor, lightColor;
133- ReadLightGrid(texture3D (u_LightGrid1, lightGridPos), ambientColor, lightColor);
133+ #if defined(USE_GRID_LIGHTING) || defined(USE_GRID_DELUXE_MAPPING)
134+ ReadLightGrid(texture3D (u_LightGrid1, lightGridPos), ambientColor, lightColor);
135+ #else // !( defined(USE_GRID_LIGHTING) && defined(USE_GRID_DELUXE_MAPPING) )
136+ ambientColor = vec3 ( 0.0 , 0.0 , 0.0 );
137+ lightColor = vec3 ( 0.0 , 0.0 , 0.0 );
138+ #endif
134139
135140 // compute light direction in world space
136141 vec4 texel = texture3D (u_LightGrid2, lightGridPos);
@@ -139,11 +144,15 @@ void main()
139144 vec4 diffuse = vec4 (0.0 , 0.0 , 0.0 , 1.0 );
140145
141146 // compute the specular term
142- #if defined(USE_REFLECTIVE_SPECULAR)
143- computeDeluxeLight(lightDir, normal, viewDir, lightColor, diffuse, reflectColor, color, u_EnvironmentMap0, u_EnvironmentMap1);
144- #else // !USE_REFLECTIVE_SPECULAR
145- computeDeluxeLight(lightDir, normal, viewDir, lightColor, diffuse, reflectColor, color);
146- #endif // !USE_REFLECTIVE_SPECULAR
147+ #if defined(USE_DELUXE_MAPPING) || defined(USE_GRID_DELUXE_MAPPING)
148+ #if defined(USE_REFLECTIVE_SPECULAR)
149+ computeDeluxeLight(lightDir, normal, viewDir, lightColor, diffuse, reflectColor, color, u_EnvironmentMap0, u_EnvironmentMap1);
150+ #else // !USE_REFLECTIVE_SPECULAR
151+ computeDeluxeLight(lightDir, normal, viewDir, lightColor, diffuse, reflectColor, color);
152+ #endif // !USE_REFLECTIVE_SPECULAR
153+ #else // !USE_DELUXE_MAPPING && !USE_GRID_DELUXE_MAPPING
154+ computeLight(lightColor, diffuse, color);
155+ #endif // !USE_DELUXE_MAPPING && !USE_GRID_DELUXE_MAPPING
147156
148157 outputColor = color;
149158
0 commit comments