]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - r_light.c
disable hardware gamma if XF86VidModeGetGammaRampSize reports a size other than 256...
[xonotic/darkplaces.git] / r_light.c
index 4b25a3ba6b3034eecdb2f85568005998d32d7630..69b5097e425b3a4aab7afa817eb449afdc18abd1 100644 (file)
--- a/r_light.c
+++ b/r_light.c
@@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include "r_shadow.h"
 
 cvar_t r_modellights = {CVAR_SAVE, "r_modellights", "4"};
-cvar_t r_vismarklights = {0, "r_vismarklights", "1"};
 cvar_t r_coronas = {CVAR_SAVE, "r_coronas", "1"};
 cvar_t gl_flashblend = {CVAR_SAVE, "gl_flashblend", "0"};
 
@@ -35,7 +34,7 @@ void r_light_start(void)
 {
        float dx, dy;
        int x, y, a;
-       qbyte pixels[32][32][4];
+       unsigned char pixels[32][32][4];
        lighttexturepool = R_AllocTexturePool();
        for (y = 0;y < 32;y++)
        {
@@ -70,7 +69,6 @@ void r_light_newmap(void)
 void R_Light_Init(void)
 {
        Cvar_RegisterVariable(&r_modellights);
-       Cvar_RegisterVariable(&r_vismarklights);
        Cvar_RegisterVariable(&r_coronas);
        Cvar_RegisterVariable(&gl_flashblend);
        R_RegisterModule("R_Light", r_light_start, r_light_shutdown, r_light_newmap);
@@ -389,9 +387,11 @@ void R_LightModel_CalcVertexColors(const float *ambientcolor4f, const float *dif
                // silly directional diffuse shading
                if (usediffuse)
                {
+                       // we have to negate this result because it is the incoming light
+                       // direction, not simply the normal to dotproduct with.
                        dot = DotProduct(normal3f, dnormal);
-                       if (dot > 0)
-                               VectorMA(color, dot, diffusecolor, color);
+                       if (dot < 0)
+                               VectorMA(color, -dot, diffusecolor, color);
                }
 
                // pretty good lighting