]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - gl_rsurf.c
make other parts of DP able to retrieve the gamma table, and add a serial field so...
[xonotic/darkplaces.git] / gl_rsurf.c
index 17de2ac8aebc61cbc839c86a54271d6dff60cd27..76f4782cbc0fa1c811d068ef70f8b7996504a3a6 100644 (file)
@@ -339,6 +339,7 @@ static void R_DrawPortal_Callback(const entity_render_t *ent, const rtlight_t *r
        R_Mesh_VertexPointer(vertex3f, 0, 0);
        R_Mesh_ColorPointer(NULL, 0, 0);
        R_Mesh_ResetTextureState();
+       R_SetupGenericShader(false);
 
        i = surfacelist[0];
        GL_Color(((i & 0x0007) >> 0) * (1.0f / 7.0f) * r_refdef.view.colorscale,
@@ -556,10 +557,20 @@ void R_Q1BSP_DrawDepth(entity_render_t *ent)
        model_t *model = ent->model;
        if (model == NULL)
                return;
+       GL_ColorMask(0,0,0,0);
+       GL_Color(1,1,1,1);
+       GL_DepthTest(true);
+       GL_BlendFunc(GL_ONE, GL_ZERO);
+       GL_DepthMask(true);
+       GL_AlphaTest(false);
+       R_Mesh_ColorPointer(NULL, 0, 0);
+       R_Mesh_ResetTextureState();
+       R_SetupDepthOrShadowShader();
        if (ent == r_refdef.scene.worldentity)
                R_DrawWorldSurfaces(false, false, true, false, false);
        else
                R_DrawModelSurfaces(ent, false, false, true, false, false);
+       GL_ColorMask(r_refdef.view.colormask[0], r_refdef.view.colormask[1], r_refdef.view.colormask[2], 1);
 }
 
 void R_Q1BSP_DrawDebug(entity_render_t *ent)
@@ -1092,8 +1103,6 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
                                }
                                else
                                {
-                                       // use the bufferobject if all triangles are accepted
-                                       usebufferobject = true;
                                        batchnumtriangles = 0;
                                        batchfirsttriangle = surface->num_firsttriangle;
                                        for (l = k;l < kend;l++)
@@ -1122,7 +1131,8 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
                                                        {
                                                                r_refdef.stats.lights_lighttriangles += batchnumtriangles;
                                                                Mod_VertexRangeFromElements(batchnumtriangles*3, batchelements, &batchfirstvertex, &batchlastvertex);
-                                                               if (usebufferobject && batchnumtriangles >= 100)
+                                                               // use the element buffer if all triangles are consecutive
+                                                               if (m == batchfirsttriangle + batchnumtriangles)
                                                                        R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, ent->model->surfmesh.ebo, sizeof(int[3]) * batchfirsttriangle);
                                                                else
                                                                        R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, 0, 0);
@@ -1140,7 +1150,8 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
                                        {
                                                r_refdef.stats.lights_lighttriangles += batchnumtriangles;
                                                Mod_VertexRangeFromElements(batchnumtriangles*3, batchelements, &batchfirstvertex, &batchlastvertex);
-                                               if (usebufferobject && batchnumtriangles >= 100)
+                                               // use the element buffer if all triangles are consecutive
+                                               if (m == batchfirsttriangle + batchnumtriangles)
                                                        R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, ent->model->surfmesh.ebo, sizeof(int[3]) * batchfirsttriangle);
                                                else
                                                        R_Shadow_RenderLighting(batchfirstvertex, batchlastvertex + 1 - batchfirstvertex, batchnumtriangles, batchelements, 0, 0);