]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix polygon distance checks (the radius comparison was completely wrong)
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 3 Nov 2002 23:10:45 +0000 (23:10 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 3 Nov 2002 23:10:45 +0000 (23:10 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2596 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
model_brush.c

index 263bb96dd0659d80c3caa49f0b84e55b07b0249b..7177b46353b49fbc36b5425c45fd2cf5193ff83c 100644 (file)
@@ -1836,7 +1836,7 @@ void R_Model_Brush_DrawShadowVolume (entity_render_t *ent, vec3_t relativelighto
                        if (projectdistance >= 0.1 && projectdistance < lightradius)
                        {
                                VectorSubtract(relativelightorigin, surf->poly_center, temp);
-                               if (DotProduct(temp, temp) < (surf->poly_radius2 + lightradius2))
+                               if (DotProduct(temp, temp) < lightradius2 - surf->poly_radius2)
                                {
                                        for (mesh = surf->mesh;mesh;mesh = mesh->chain)
                                        {
@@ -1894,7 +1894,7 @@ void R_Model_Brush_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, v
                for (surfnum = 0, surf = ent->model->surfaces + ent->model->firstmodelsurface;surfnum < ent->model->nummodelsurfaces;surfnum++, surf++)
                {
                        VectorSubtract(relativelightorigin, surf->poly_center, temp);
-                       if (DotProduct(temp, temp) < lightradius2 + surf->poly_radius2)
+                       if (DotProduct(temp, temp) < lightradius2 - surf->poly_radius2)
                        {
                                f = PlaneDiff(relativelightorigin, surf->plane);
                                if (surf->flags & SURF_PLANEBACK)
@@ -1930,7 +1930,7 @@ void R_Model_Brush_DrawLight(entity_render_t *ent, vec3_t relativelightorigin, v
                        if (surf->visframe == r_framecount)
                        {
                                VectorSubtract(relativelightorigin, surf->poly_center, temp);
-                               if (DotProduct(temp, temp) < lightradius2 + surf->poly_radius2)
+                               if (DotProduct(temp, temp) < lightradius2 - surf->poly_radius2)
                                {
                                        f = PlaneDiff(relativelightorigin, surf->plane);
                                        if (surf->flags & SURF_PLANEBACK)
index 3296a68da26c9597559b9167b8e4f3a6a0946751..f62506f5d6e5c68f884a0e310e5a517f9f77c31e 100644 (file)
@@ -784,7 +784,7 @@ void Mod_ProcessLightList(void)
                                        if (dist > 0 && dist < e->cullradius)
                                        {
                                                VectorSubtract(e->origin, surf->poly_center, temp);
-                                               if (DotProduct(temp, temp) - surf->poly_radius2 < e->cullradius2)
+                                               if (DotProduct(temp, temp) < e->cullradius2 - surf->poly_radius2)
                                                        loadmodel->surfacevisframes[*mark] = -2;
                                        }
                                }