]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
enabled portals on q3bsp for a small (occasionally huge) fps increase
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 Apr 2005 06:02:47 +0000 (06:02 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 20 Apr 2005 06:02:47 +0000 (06:02 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5202 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
model_brush.c
model_shared.h
portals.c

index fcfdf8c702ecd2c646bb1b7c3d94cb910dcacef9..82d9af45ed00a2ae66fb7e609f9440d1ca1f2e7c 100644 (file)
@@ -1593,7 +1593,7 @@ void R_WorldVisibility(void)
                return;
 
        // if possible find the leaf the view origin is in
-       viewleaf = model->brushq1.PointInLeaf ? model->brushq1.PointInLeaf(model, r_vieworigin) : NULL;
+       viewleaf = model->brush.PointInLeaf ? model->brush.PointInLeaf(model, r_vieworigin) : NULL;
        // if possible fetch the visible cluster bits
        if (model->brush.FatPVS)
                model->brush.FatPVS(model, r_vieworigin, 2, r_pvsbits, sizeof(r_pvsbits));
index 20856b6e50cd11d8c6d8bd84889f78cd35fbee17..de599574ed3691f894f90944dd1889897038fb5b 100644 (file)
@@ -2906,7 +2906,7 @@ void Mod_Q1BSP_Load(model_t *mod, void *buffer)
        mod->brush.FindNonSolidLocation = Mod_Q1BSP_FindNonSolidLocation;
        mod->brush.AmbientSoundLevelsForPoint = Mod_Q1BSP_AmbientSoundLevelsForPoint;
        mod->brush.RoundUpToHullSize = Mod_Q1BSP_RoundUpToHullSize;
-       mod->brushq1.PointInLeaf = Mod_Q1BSP_PointInLeaf;
+       mod->brush.PointInLeaf = Mod_Q1BSP_PointInLeaf;
 
        if (loadmodel->isworldmodel)
                Cvar_SetValue("halflifebsp", mod->brush.ishlbsp);
@@ -5410,6 +5410,7 @@ void Mod_Q3BSP_Load(model_t *mod, void *buffer)
        mod->brush.BoxTouchingVisibleLeafs = Mod_Q1BSP_BoxTouchingVisibleLeafs;
        mod->brush.LightPoint = Mod_Q3BSP_LightPoint;
        mod->brush.FindNonSolidLocation = Mod_Q1BSP_FindNonSolidLocation;
+       mod->brush.PointInLeaf = Mod_Q1BSP_PointInLeaf;
        mod->Draw = R_Q1BSP_Draw;
        mod->GetLightInfo = R_Q1BSP_GetLightInfo;
        mod->DrawShadowVolume = R_Q1BSP_DrawShadowVolume;
@@ -5445,6 +5446,9 @@ void Mod_Q3BSP_Load(model_t *mod, void *buffer)
        Mod_Q3BSP_LoadPVS(&header->lumps[Q3LUMP_PVS]);
        loadmodel->brush.numsubmodels = loadmodel->brushq3.num_models;
 
+       // the MakePortals code works fine on the q3bsp data as well
+       Mod_Q1BSP_MakePortals();
+
        // make a single combined shadow mesh to allow optimized shadow volume creation
        numshadowmeshtriangles = 0;
        for (j = 0, surface = loadmodel->brush.data_surfaces;j < loadmodel->brush.num_surfaces;j++, surface++)
index 349a9619439651fa9139974a88fe15b25eed4c7e..cf8aaf3adf3ea4ab7b2a993a69466b0c3e3b371b 100644 (file)
@@ -239,6 +239,7 @@ typedef struct model_brush_s
        int (*BoxTouchingVisibleLeafs)(struct model_s *model, const qbyte *visibleleafs, const vec3_t mins, const vec3_t maxs);
        void (*LightPoint)(struct model_s *model, const vec3_t p, vec3_t ambientcolor, vec3_t diffusecolor, vec3_t diffusenormal);
        void (*FindNonSolidLocation)(struct model_s *model, const vec3_t in, vec3_t out, vec_t radius);
+       mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
        // these are actually only found on brushq1, but NULL is handled gracefully
        void (*AmbientSoundLevelsForPoint)(struct model_s *model, const vec3_t p, qbyte *out, int outsize);
        void (*RoundUpToHullSize)(struct model_s *cmodel, const vec3_t inmins, const vec3_t inmaxs, vec3_t outmins, vec3_t outmaxs);
@@ -289,8 +290,6 @@ typedef struct model_brushq1_s
        int                             *light_stylevalue;
        msurface_t              ***light_styleupdatechains;
        msurface_t              **light_styleupdatechainsbuffer;
-
-       mleaf_t *(*PointInLeaf)(struct model_s *model, const float *p);
 }
 model_brushq1_t;
 
index f6f85766eb912791a7cd3c6a0d0b9c05f966cf15..4f62b17e34d9ef72fe648f4091dc6d837b30ad01 100644 (file)
--- a/portals.c
+++ b/portals.c
@@ -187,7 +187,7 @@ int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpo
        vec3_t center, v1, v2;
 
        // if there is no model, it can not block visibility
-       if (model == NULL || !model->brushq1.PointInLeaf)
+       if (model == NULL || !model->brush.PointInLeaf)
                return true;
 
        portal_markid++;
@@ -195,7 +195,7 @@ int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpo
        Mod_CheckLoaded(model);
        Portal_PolygonRecursiveMarkLeafs(model->brush.data_nodes, polypoints, numpoints);
 
-       eyeleaf = model->brushq1.PointInLeaf(model, eye);
+       eyeleaf = model->brush.PointInLeaf(model, eye);
 
        // find the center by averaging
        VectorClear(center);