]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
Optimized AddDynamicLights and StainNode for axial surfaces/nodes (respectively)...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Jun 2002 00:25:18 +0000 (00:25 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Jun 2002 00:25:18 +0000 (00:25 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1950 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c

index 7ae39a86bb17cf416b8751bc5aa5066a8a224619..8ba24b8352215067c2c93db55fbf02ad8c0bfcc0 100644 (file)
@@ -99,9 +99,17 @@ static int R_AddDynamicLights (msurface_t *surf)
                if (dist2 >= maxdist)
                        continue;
 
-               impact[0] = local[0] - surf->plane->normal[0] * dist;
-               impact[1] = local[1] - surf->plane->normal[1] * dist;
-               impact[2] = local[2] - surf->plane->normal[2] * dist;
+               if (surf->plane->type < 3)
+               {
+                       VectorCopy(local, impact);
+                       impact[surf->plane->type] -= dist;
+               }
+               else
+               {
+                       impact[0] = local[0] - surf->plane->normal[0] * dist;
+                       impact[1] = local[1] - surf->plane->normal[1] * dist;
+                       impact[2] = local[2] - surf->plane->normal[2] * dist;
+               }
 
                impacts = DotProduct (impact, surf->texinfo->vecs[0]) + surf->texinfo->vecs[0][3] - surf->texturemins[0];
                impactt = DotProduct (impact, surf->texinfo->vecs[1]) + surf->texinfo->vecs[1][3] - surf->texturemins[1];
@@ -203,9 +211,17 @@ loc0:
        {
                maxdist3 = maxdist - dist2;
 
-               impact[0] = origin[0] - node->plane->normal[0] * ndist;
-               impact[1] = origin[1] - node->plane->normal[1] * ndist;
-               impact[2] = origin[2] - node->plane->normal[2] * ndist;
+               if (node->plane->type < 3)
+               {
+                       VectorCopy(origin, impact);
+                       impact[node->plane->type] -= ndist;
+               }
+               else
+               {
+                       impact[0] = origin[0] - node->plane->normal[0] * ndist;
+                       impact[1] = origin[1] - node->plane->normal[1] * ndist;
+                       impact[2] = origin[2] - node->plane->normal[2] * ndist;
+               }
 
                for (surf = model->surfaces + node->firstsurface, endsurf = surf + node->numsurfaces;surf < endsurf;surf++)
                {