]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - model_brush.c
setinfo *ip on every network connection (currently only meaningful to QW reconnect...
[xonotic/darkplaces.git] / model_brush.c
index 816e3b1ade3f76dc2fb7833dfc9664662a3362da..8b4581fe1a99bd83464f56a0fc869a66abd0df3a 100644 (file)
@@ -851,7 +851,7 @@ static void Mod_Q1BSP_TraceBox(struct model_s *model, int frame, trace_t *trace,
        Con_Printf("t(%f %f %f,%f %f %f,%i %f %f %f)", rhc.start[0], rhc.start[1], rhc.start[2], rhc.end[0], rhc.end[1], rhc.end[2], rhc.hull - model->brushq1.hulls, rhc.hull->clip_mins[0], rhc.hull->clip_mins[1], rhc.hull->clip_mins[2]);
        Mod_Q1BSP_RecursiveHullCheck(&rhc, rhc.hull->firstclipnode, 0, 1, rhc.start, rhc.end);
        {
-               
+
                double test[3];
                trace_t testtrace;
                VectorLerp(rhc.start, rhc.trace->fraction, rhc.end, test);
@@ -1117,7 +1117,7 @@ middle sample (the one which was requested)
 
 void Mod_Q1BSP_LightPoint(model_t *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal)
 {
-       Mod_Q1BSP_LightPoint_RecursiveBSPNode(model, ambientcolor, diffusecolor, diffusenormal, model->brush.data_nodes + model->brushq1.hulls[0].firstclipnode, p[0], p[1], p[2], p[2] - 65536);
+       Mod_Q1BSP_LightPoint_RecursiveBSPNode(model, ambientcolor, diffusecolor, diffusenormal, model->brush.data_nodes + model->brushq1.hulls[0].firstclipnode, p[0], p[1], p[2] + 0.125, p[2] - 65536);
        VectorSet(diffusenormal, 0, 0, -1);
 }
 
@@ -4235,16 +4235,19 @@ static void Mod_Q3BSP_LoadShaders(void)
                                }
                        }
                        // identify if this is a blended terrain shader or similar
-                       shader->primarylayer = shader->layers + 0;
-                       if (shader->layers[1].blendfunc[0] == GL_SRC_ALPHA && shader->layers[1].blendfunc[1] == GL_ONE_MINUS_SRC_ALPHA)
+                       if (shader->numlayers)
                        {
-                               // terrain blending or other effects
-                               shader->backgroundlayer = shader->layers + 0;
-                               shader->primarylayer = shader->layers + 1;
+                               shader->primarylayer = shader->layers + 0;
+                               if (shader->layers[1].blendfunc[0] == GL_SRC_ALPHA && shader->layers[1].blendfunc[1] == GL_ONE_MINUS_SRC_ALPHA)
+                               {
+                                       // terrain blending or other effects
+                                       shader->backgroundlayer = shader->layers + 0;
+                                       shader->primarylayer = shader->layers + 1;
+                               }
+                               // now see if the lightmap came first, and if so choose the second texture instead
+                               if (!strcasecmp(shader->primarylayer->texturename, "$lightmap"))
+                                       shader->primarylayer = shader->layers + 1;
                        }
-                       // now see if the lightmap came first, and if so choose the second texture instead
-                       if (!strcasecmp(shader->primarylayer->texturename, "$lightmap"))
-                               shader->primarylayer = shader->layers + 1;
                }
                Mem_Free(f);
        }
@@ -4601,28 +4604,8 @@ static void Mod_Q3BSP_LoadLightmaps(lump_t *l)
        loadmodel->brushq3.data_lightmaps = out;
        loadmodel->brushq3.num_lightmaps = count;
 
-       loadmodel->brushq3.deluxemapping_modelspace = false;
        for (i = 0;i < count;i++, in++, out++)
-       {
-               // if this may be a deluxemap, check if it's in modelspace or not
-               if ((i & 1) && !loadmodel->brushq3.deluxemapping_modelspace)
-               {
-                       int j;
-                       unsigned char *b = in->rgb;
-                       for (j = 2;j < 128*128*3;j += 3)
-                       {
-                               // if this is definitely negative Z, it is not facing outward,
-                               // and thus must be in modelspace, as negative Z would never
-                               // occur in tangentspace
-                               if (b[j] < 120)
-                               {
-                                       loadmodel->brushq3.deluxemapping_modelspace = true;
-                                       break;
-                               }
-                       }
-               }
                *out = R_LoadTexture2D(loadmodel->texturepool, va("lightmap%04i", i), 128, 128, in->rgb, TEXTYPE_RGB, TEXF_FORCELINEAR | TEXF_PRECACHE, NULL);
-       }
 }
 
 static void Mod_Q3BSP_LoadFaces(lump_t *l)
@@ -4657,6 +4640,7 @@ static void Mod_Q3BSP_LoadFaces(lump_t *l)
        // is also not a deluxemapped bsp if it has an odd number of lightmaps or
        // less than 2
        loadmodel->brushq3.deluxemapping = true;
+       loadmodel->brushq3.deluxemapping_modelspace = true;
        if (loadmodel->brushq3.num_lightmaps >= 2 && !(loadmodel->brushq3.num_lightmaps & 1))
        {
                for (i = 0;i < count;i++)