]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
major speed gain in cavetest2 by checking if the portal is facing the wrong way
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Sep 2002 01:19:39 +0000 (01:19 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 11 Sep 2002 01:19:39 +0000 (01:19 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2354 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c

index f5fca7888c6db21d05c72e9a8088f01527d89227..ef815ae6c871507c080f4b19a9cdd7e355920ef8 100644 (file)
@@ -1523,7 +1523,7 @@ static void R_DrawPortal_Callback(const void *calldata1, int calldata2)
        memset(&m, 0, sizeof(m));
        m.blendfunc1 = GL_SRC_ALPHA;
        m.blendfunc2 = GL_ONE_MINUS_SRC_ALPHA;
-       m.wantoverbright = false;
+       //m.wantoverbright = false;
        R_Mesh_Matrix(&ent->matrix);
        R_Mesh_State(&m);
        R_Mesh_ResizeCheck(portal->numpoints, portal->numpoints - 2);
@@ -1774,13 +1774,18 @@ static void R_PortalWorldNode(entity_render_t *ent, mleaf_t *viewleaf)
                // follow portals into other leafs
                for (p = leaf->portals;p;p = p->next)
                {
-                       leaf = p->past;
-                       if (leaf->worldnodeframe != r_framecount)
+                       // LordHavoc: this DotProduct hurts less than a cache miss
+                       // (which is more likely to happen if backflowing through leafs)
+                       if (DotProduct(modelorg, p->plane.normal) < (p->plane.dist + 1))
                        {
-                               leaf->worldnodeframe = r_framecount;
-                               // FIXME: R_NotCulledBox is absolute, should be done relative
-                               if (leaf->pvsframe == r_pvsframecount && R_NotCulledBox(leaf->mins, leaf->maxs))
-                                       leafstack[leafstackpos++] = leaf;
+                               leaf = p->past;
+                               if (leaf->worldnodeframe != r_framecount)
+                               {
+                                       leaf->worldnodeframe = r_framecount;
+                                       // FIXME: R_NotCulledBox is absolute, should be done relative
+                                       if (leaf->pvsframe == r_pvsframecount && R_NotCulledBox(leaf->mins, leaf->maxs))
+                                               leafstack[leafstackpos++] = leaf;
+                               }
                        }
                }
        }
@@ -1788,7 +1793,6 @@ static void R_PortalWorldNode(entity_render_t *ent, mleaf_t *viewleaf)
                R_DrawPortals(ent);
 }
 
-
 void R_PVSUpdate (mleaf_t *viewleaf)
 {
        int i, j, l, c, bits, *surfacepvsframes, *mark;