]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
fix obvious bugs in r8214
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 19 Mar 2008 14:10:21 +0000 (14:10 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 19 Mar 2008 14:10:21 +0000 (14:10 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8217 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index 7b3efb2bc63a5982a8b0c1b625bf4a7c62a800a1..303516604b9fc1b94a5aca134405bb846e7da9b6 100644 (file)
@@ -5744,6 +5744,8 @@ void Mod_Q3BSP_Load(model_t *mod, void *buffer, void *bufferend)
                // which can in turn mess up the farclip (as well as culling when
                // outside the level - an unimportant concern)
                boxready = false;
+
+               //printf("Editing model %d... BEFORE re-bounding: %f %f %f - %f %f %f\n", i, mod->normalmins[0], mod->normalmins[1], mod->normalmins[2], mod->normalmaxs[0], mod->normalmaxs[1], mod->normalmaxs[2]);
                for (j = 0;j < mod->nummodelsurfaces;j++)
                {
                        const msurface_t *surface = mod->data_surfaces + j + mod->firstmodelsurface;
@@ -5752,20 +5754,26 @@ void Mod_Q3BSP_Load(model_t *mod, void *buffer, void *bufferend)
                        if (!surface->num_vertices)
                                continue;
                        if (!boxready)
+                       // (div0) do we REALLY want this? Above it says "enlarge the
+                       //        bounding box", but this completely regenerates this.
+                       //        Remove this part and the variable  to make it ACTUALLY
+                       //        enlarge the bbox.
                        {
                                VectorCopy(v, mod->normalmins);
                                VectorCopy(v, mod->normalmaxs);
+                               boxready = true;
                        }
                        for (k = 0;k < surface->num_vertices;k++, v += 3)
                        {
                                mod->normalmins[0] = min(mod->normalmins[0], v[0]);
                                mod->normalmins[1] = min(mod->normalmins[1], v[1]);
                                mod->normalmins[2] = min(mod->normalmins[2], v[2]);
-                               mod->normalmaxs[0] = min(mod->normalmaxs[0], v[0]);
-                               mod->normalmaxs[1] = min(mod->normalmaxs[1], v[1]);
-                               mod->normalmaxs[2] = min(mod->normalmaxs[2], v[2]);
+                               mod->normalmaxs[0] = max(mod->normalmaxs[0], v[0]);
+                               mod->normalmaxs[1] = max(mod->normalmaxs[1], v[1]);
+                               mod->normalmaxs[2] = max(mod->normalmaxs[2], v[2]);
                        }
                }
+               //printf("Editing model %d... AFTER re-bounding: %f %f %f - %f %f %f\n", i, mod->normalmins[0], mod->normalmins[1], mod->normalmins[2], mod->normalmaxs[0], mod->normalmaxs[1], mod->normalmaxs[2]);
                corner[0] = max(fabs(mod->normalmins[0]), fabs(mod->normalmaxs[0]));
                corner[1] = max(fabs(mod->normalmins[1]), fabs(mod->normalmaxs[1]));
                corner[2] = max(fabs(mod->normalmins[2]), fabs(mod->normalmaxs[2]));