]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fixed bug that caused the wrong texture to be used on rtlight lighting when two or...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 23 Feb 2007 12:45:35 +0000 (12:45 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 23 Feb 2007 12:45:35 +0000 (12:45 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6908 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c

index ff9f78b99fc3544187bb9d2fb82f50ac8e93b538..8e9afe8dd958332a09711c44ee58af06c21fc7e8 100644 (file)
@@ -922,7 +922,7 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
 {
        model_t *model = ent->model;
        msurface_t *surface;
-       int i, j, k, l, endsurface, batchnumsurfaces;
+       int i, k, l, endsurface, batchnumsurfaces;
        msurface_t *batchsurfacelist[RSURF_MAX_BATCHSURFACES];
        texture_t *tex;
        CHECKGLERROR
@@ -933,30 +933,30 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
        // fast, and even if this is not the world model (and hence no visibility
        // checking) the input surface list and batch buffer are different formats
        // so some processing is necessary.  (luckily models have few surfaces)
-       for (i = 0;i < numsurfaces;i = j)
+       for (i = 0;i < numsurfaces;)
        {
                batchnumsurfaces = 0;
                endsurface = min(i + RSURF_MAX_BATCHSURFACES, numsurfaces);
                if (ent == r_refdef.worldentity)
                {
-                       for (j = i;j < endsurface;j++)
-                               if (r_viewcache.world_surfacevisible[surfacelist[j]])
-                                       batchsurfacelist[batchnumsurfaces++] = model->data_surfaces + surfacelist[j];
+                       for (;i < endsurface;i++)
+                               if (r_viewcache.world_surfacevisible[surfacelist[i]])
+                                       batchsurfacelist[batchnumsurfaces++] = model->data_surfaces + surfacelist[i];
                }
                else
                {
-                       for (j = i;j < endsurface;j++)
-                               batchsurfacelist[batchnumsurfaces++] = model->data_surfaces + surfacelist[j];
+                       for (;i < endsurface;i++)
+                               batchsurfacelist[batchnumsurfaces++] = model->data_surfaces + surfacelist[i];
                }
                if (!batchnumsurfaces)
                        continue;
                for (k = 0;k < batchnumsurfaces;k = l)
                {
-                       l = k + 1;
                        surface = batchsurfacelist[k];
                        tex = surface->texture;
                        rsurface_texture = tex->currentframe;
-                       for (;l < batchnumsurfaces && tex == batchsurfacelist[k]->texture;l++);
+                       for (l = k;l < batchnumsurfaces && tex == batchsurfacelist[l]->texture;l++);
+                               r_refdef.stats.lights_lighttriangles += batchsurfacelist[l]->num_triangles;
                        if (rsurface_texture->currentmaterialflags & (MATERIALFLAG_WALL | MATERIALFLAG_WATER))
                        {
                                if (rsurface_texture->currentmaterialflags & MATERIALFLAG_BLENDED)